Make that it works in 90% of the cases. 3:30.

This commit is contained in:
coolnsx
2025-08-16 18:48:50 +05:30
parent 39fdebbc99
commit f71f117880
3 changed files with 39 additions and 12 deletions

View File

@@ -55,7 +55,7 @@ printf "%s\n" "$url" | while read -r id title; do
info_$os "Fetching $provider_name links"
provider_id="$(printf "%s" "$data" | sed -n "/$provider_regex :/p" | cut -d':' -f2 | sed 's/../&\n/g' | sed 's/^79$/A/g;s/^7a$/B/g;s/^7b$/C/g;s/^7c$/D/g;s/^7d$/E/g;s/^7e$/F/g;s/^7f$/G/g;s/^70$/H/g;s/^71$/I/g;s/^72$/J/g;s/^73$/K/g;s/^74$/L/g;s/^75$/M/g;s/^76$/N/g;s/^77$/O/g;s/^68$/P/g;s/^69$/Q/g;s/^6a$/R/g;s/^6b$/S/g;s/^6c$/T/g;s/^6d$/U/g;s/^6e$/V/g;s/^6f$/W/g;s/^60$/X/g;s/^61$/Y/g;s/^62$/Z/g;s/^59$/a/g;s/^5a$/b/g;s/^5b$/c/g;s/^5c$/d/g;s/^5d$/e/g;s/^5e$/f/g;s/^5f$/g/g;s/^50$/h/g;s/^51$/i/g;s/^52$/j/g;s/^53$/k/g;s/^54$/l/g;s/^55$/m/g;s/^56$/n/g;s/^57$/o/g;s/^48$/p/g;s/^49$/q/g;s/^4a$/r/g;s/^4b$/s/g;s/^4c$/t/g;s/^4d$/u/g;s/^4e$/v/g;s/^4f$/w/g;s/^40$/x/g;s/^41$/y/g;s/^42$/z/g;s/^08$/0/g;s/^09$/1/g;s/^0a$/2/g;s/^0b$/3/g;s/^0c$/4/g;s/^0d$/5/g;s/^0e$/6/g;s/^0f$/7/g;s/^00$/8/g;s/^01$/9/g;s/^15$/-/g;s/^16$/./g;s/^67$/_/g;s/^46$/~/g;s/^02$/:/g;s/^17$/\//g;s/^07$/?/g;s/^1b$/#/g;s/^63$/\[/g;s/^65$/\]/g;s/^78$/@/g;s/^19$/!/g;s/^1c$/$/g;s/^1e$/&/g;s/^10$/\(/g;s/^11$/\)/g;s/^12$/*/g;s/^13$/+/g;s/^14$/,/g;s/^03$/;/g;s/^05$/=/g;s/^1d$/%/g;' | tr -d '\n' | sed "s/\/clock/\/clock\.json/")"
[ -z "$provider_id" ] && continue
if printf '%s' "$provider_id" | grep -q "https:";then
if printf '%s' "$provider_id" | grep -q "https:"; then
provider_video=$provider_id
else
response=$(curl -s "https://${domain}${provider_id}")
@@ -73,7 +73,10 @@ printf "%s\n" "$url" | while read -r id title; do
case $choice in
stream)
info_$os "opening $title" "mpv"
player_$os "$provider_video" "$title" --referrer="https://$domain" --sub-file="$subtitle"
subs_flag=
[ -n "$subtitle" ] && subs_flag="--sub-file=$subtitle"
# shellcheck disable=SC2086
player_$os "$provider_video" "$title" --referrer="https://$domain" $subs_flag
break
;;
cast)

View File

@@ -93,25 +93,50 @@ mpv_jellyfin() {
[ -z "$1" ] && return 0
[ -z "$2" ] && return 0
ITEM_ID=$(printf '%s' "$1" | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{12})/\1-\2-\3-\4-\5/')
success "Playing $2 on mpv"
url="$JF_URL/Items/$1/Download?api_key=$JF_TOKEN"
sub="$JF_URL/Videos/$(printf '%s' "$1" | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{12})/\1-\2-\3-\4-\5/')/$1/Subtitles/0/0/Stream.ass?api_key=$JF_TOKEN"
sub="$JF_URL/Videos/$ITEM_ID/$1/Subtitles/0/0/Stream.ass?api_key=$JF_TOKEN"
! curl -s "$sub" | grep -q "Error processing request" && sub_arg="--sub-file=$sub"
if uname -o | grep -q 'ndroid'; then
printf "Title %s\n" "$2"
printf "URL: %s\n" "$url"
[ -n "$sub_arg" ] && printf "Sub URL: %s\n" "$sub"
return 0
fi
#shellcheck disable=SC2086
nohup mpv --input-ipc-server="$socket" --start="$((playbackPositionTicks / 10000000))" --force-media-title="$2" "$url" $sub_arg >/dev/null 2>&1 &
track_progress "$(printf '%s' "$1" | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{12})/\1-\2-\3-\4-\5/')"
skipPositions=$(curl -s "$JF_URL/Episode/$ITEM_ID/IntroSkipperSegments" -H 'Authorization: MediaBrowser Token="'"$JF_TOKEN"'"' -H "Accept: application/json" | sed -nE 's|.*"Introduction".*"IntroStart":([^\.]*).*,"IntroEnd":([^\.]*).*"Credits".*"IntroStart":([^\.]*).*"IntroEnd":([^\.]*).*|op_start=\1;op_end=\2;ed_start=\3;ed_end=\4|p')
track_progress
}
track_progress() {
ITEM_ID=$1
\cat <<EOF >"$progress_track_file"
#!/bin/sh
skipPos(){
[ -z "\$3" ] && printf 1 && return 0
[ -z "\$4" ] && printf 1 && return 0
if [ "\$2" -ge "\$3" ] && [ "\$2" -lt "\$4" ]; then
echo '{"command" :["seek" ,"'"\$4"'","absolute"]}' | socat - "$socket" >/dev/null
echo '{"command": ["show-text", "'"\$5"'", 3000]}' | socat - "$socket" >/dev/null
printf 1
return 0
fi
printf 0
}
positionTicks=$playbackPositionTicks
$skipPositions
introSkipped=0
outroSkipped=0
while sleep 5;do
position=\$(echo '{"command" :["get_property","playback-time"]}' | socat - "$socket" 2>/dev/null | sed -nE 's_.*data":([^,]*).*_\1_p' | tr -d '.' | sed 's|$|0|g')
[ -z "\$position" ] && break
positionTicks=\$position
positionSec=\$((position / 10000000))
[ "\$introSkipped" -eq 0 ] && introSkipped=\$(skipPos "\$introSkipped" "\$positionSec" "\$op_start" "\$op_end" "Intro Skipped")
[ "\$outroSkipped" -eq 0 ] && outroSkipped=\$(skipPos "\$outroSkipped" "\$positionSec" "\$ed_start" "\$ed_end" "Outro Skipped")
done
[ -n "\$positionTicks" ] && curl -s "$JF_URL/Users/$JF_USER_ID/PlayingItems/$ITEM_ID?positionTicks=\$positionTicks" -X DELETE -H 'Authorization: MediaBrowser Token="'"$JF_TOKEN"'"' -H 'Content-Type: application/json'
rm "$socket"
@@ -147,7 +172,10 @@ collection() {
collection_id=$(printf '%s' "$collection" | cut -f1)
collection_title=$(printf '%s' "$collection" | cut -f3 | sed 's|.$||g')
data=$(get_data "Items?IncludeItemTypes=$collection_title&Recursive=false&ParentId=$collection_id" "Select $collection_title >")
recursive="false"
[ "$collection_title" = "Movie" ] && recursive="true"
data=$(get_data "Items?IncludeItemTypes=$collection_title&Recursive=$recursive&ParentId=$collection_id" "Select $collection_title >")
[ -z "$data" ] && exit 1
id=$(printf "%s" "$data" | cut -f1)
title=$(printf "%s" "$data" | cut -f3)

8
screen
View File

@@ -31,11 +31,7 @@ compress() {
record() {
rm -f "$tmp_file" "$process_file"
#shellcheck disable=SC2034
mic="alsa_input.pci-0000_04_00.6.analog-stereo" #It is called in eval on line 9
#shellcheck disable=SC2034
speaker="alsa_output.pci-0000_04_00.6.analog-stereo.monitor" #It is called in eval on line 9
source=$(printf "screen only\n%s" "$(pactl -f json list sources | sed 's|"index":|\n|g' | sed -nE 's|.*,"name":"([^"]*)","description":"([^"]*)".*|\2\t\1|p')" | menu "Audio Source:" "3")
source=$(printf "screen only\n%s" "$(pactl -f json list sources | sed 's|"index":|\n|g' | sed -nE 's|.*,"name":"([^"]*)","description":"([^"]*)".*|\2\t\1|p')" | menu "Audio Source:" "3" | cut -f2)
[ -z "$source" ] && info "" "2000" "No option Selected" && return 0
@@ -43,7 +39,7 @@ record() {
[ -z "$monitor" ] && info "" "2000" "No option Selected" && return 0
[ "$source" != "screen only" ] && pactl set-default-source "$(eval "printf \$$source")" && arg=-a
[ "$source" != "screen only" ] && pactl set-default-source "$source" && arg=-a
#shellcheck disable=SC2086
info "simplescreenrecorder" "1000" "Select Region" "Tap/Click to select full" && setsid -f wf-recorder -x yuv420p -f /tmp/screenrecord.mp4 --output "$monitor" $arg -g "$(slurp)" >/dev/null 2>&1
info "simplescreenrecorder" "700" "Recording Started" "Capturing $monitor($source)"