Compare commits

...

9 Commits

Author SHA1 Message Date
coolnsx
cf4b2095eb hacky sack 2025-10-22 22:31:28 +05:30
coolnsx
5f5d065c18 Spinning up the hamster... 2025-10-22 15:56:36 +05:30
coolnsx
870fb04c8e fixes 2025-10-22 15:55:17 +05:30
coolnsx
0338c5c80c ALL SORTS OF THINGS 2025-09-11 16:54:24 +05:30
coolnsx
b4e63b41ab Fix edge, single client, error case 2025-09-10 13:00:57 +05:30
coolnsx
e431d829ac wrapping should work properly. Probably. 2025-08-16 18:58:37 +05:30
coolnsx
5272006282 I would rather be playing SC2. 2025-08-16 18:52:49 +05:30
coolnsx
672adfdd12 I was told to leave it alone, but I have this thing called OCD, you see 2025-08-16 18:49:53 +05:30
coolnsx
f71f117880 Make that it works in 90% of the cases. 3:30. 2025-08-16 18:48:50 +05:30
9 changed files with 167 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
#shellcheck disable=SC2086 #shellcheck disable=SC2086,SC2068
menu_droid() { menu_droid() {
fzf --prompt="$1" $2 fzf --prompt="$1" $2
@@ -20,11 +20,11 @@ search_linux() {
} }
torrent_linux() { torrent_linux() {
setsid -f "$TERMINAL" -e "$(dirname "$0")/torrent" "$1" setsid -f "$TERMINAL" -e "${0%/*}/torrent" $@
} }
torrent_droid() { torrent_droid() {
"$(dirname "$0")/torrent" "$1" "${0%/*}/torrent" $@
} }
info_droid() { info_droid() {

View File

@@ -55,7 +55,7 @@ printf "%s\n" "$url" | while read -r id title; do
info_$os "Fetching $provider_name links" 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/")" 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 [ -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 provider_video=$provider_id
else else
response=$(curl -s "https://${domain}${provider_id}") response=$(curl -s "https://${domain}${provider_id}")
@@ -73,7 +73,10 @@ printf "%s\n" "$url" | while read -r id title; do
case $choice in case $choice in
stream) stream)
info_$os "opening $title" "mpv" 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 break
;; ;;
cast) cast)

View File

@@ -1,25 +1,59 @@
#!/bin/sh #!/bin/sh
# script for downloading videos/audios from sites... # script for downloading videos/audios from sites...
#shellcheck disable=SC2317 #shellcheck disable=SC2317,SC2329
info() { info() {
printf "\033[1;36m[ %s ] [ %s ] %s\033[0m\n" "$2" "$3" "$1" printf "\033[1;36m%s\033[0m\n" "$2" "$3" "$1"
}
error() {
printf "\033[1;31m[ %s ] [ %s ] %s\033[0m\n" "$2" "$3" "$1"
} }
notify_droid() { notify_droid() {
info "$1"
termux-notification -c "$1" termux-notification -c "$1"
} }
notify_linux() { notify_linux() {
info "$1"
notify-send -e "$1" -h "string:x-canonical-private-synchronous:${0##*/}" notify-send -e "$1" -h "string:x-canonical-private-synchronous:${0##*/}"
} }
send_matrix_msg() {
# file existance
[ -f "$1" ] || return 1
# upload file and get URI
file_uri=$(curl "$MX_URL/_matrix/media/v3/upload?filename=$filename" -sX POST -H 'Content-Type: application/octet-stream' -H "Authorization: Bearer $MX_TOKEN" -T "$1" | sed -nE 's|.*"content_uri":"([^"]*)".*|\1|p')
#extract specific data from metadata
filename="${1##*/}"
metadata=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -show_format "$1")
width=$(printf '%s' "$metadata" | sed -nE 's|^width=([^$]*)|\1|p')
height=$(printf '%s' "$metadata" | sed -nE 's|^height=([^$]*)|\1|p')
duration=$(printf '%s' "$metadata" | sed -nE 's|^duration=([^$]*)|\1|p' | tr -d '.' | sed 's/...$//')
durationMSec=$(printf '%d' "$duration")
size=$(printf '%s' "$metadata" | sed -nE 's|^size=([^$]*)|\1|p')
# generate unique key for message
uuid=$(uuidgen)
json='{
"msgtype": "m.video",
"body": "'"$filename"'",
"info": {
"size": "'"$size"'",
"mimetype": "video/mp4",
"duration": "'"$durationMSec"'",
"w": "'"$width"'",
"h": "'"$height"'"
},
"url": "'"$file_uri"'"
}'
# send a message with media URI
curl -sX PUT "$MX_URL/_matrix/client/v3/rooms/${2:-$MX_ROOM}/send/m.room.message/$uuid" -H 'Content-Type: application/json' -H 'Accept: application/json' -H "Authorization: Bearer $MX_TOKEN" -d "$json"
}
#main #main
link="$1" link="$1"
yt_dlp_logs="${TMPDIR:-/tmp}/${0##*/}-logs"
case $(uname -o) in case $(uname -o) in
*ndroid*) *ndroid*)
@@ -34,9 +68,28 @@ case $(uname -o) in
;; ;;
esac esac
printf "\033[1;34m Video link :\033[0m %s\n" "$link" printf "\033[1;34m Video link :\033[0m %s" "$link"
yt-dlp --no-skip-unavailable-fragments --fragment-retries infinite -N 16 -t mp4 "$link" -o "$download_dir/%(title)s.%(ext)s" info "Downloading Video.."
notify_$os "Video Downloaded" truncate -s0 "$yt_dlp_logs" # truncate file if exists, creates if doesn't exists
yt-dlp --no-skip-unavailable-fragments --fragment-retries infinite -N 16 -t mp4 "$link" -o "$download_dir/%(title)s.%(ext)s" | tee "$yt_dlp_logs"
filepath=$(sed -nE "s|.*($download_dir.*\.mp4).*|\1|p" "$yt_dlp_logs" | head -1)
#shellcheck disable=SC1091
. "$HOME"/.config/.env
# load matrix creds
matrix_creds
send_matrix_msg "$filepath"
# unload matrix creds
matrix_creds "unload"
notify_$os "Video Sent to Matrix"
rm -f "$filepath"
exit 0 exit 0

51
esphome Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
#shellcheck disable=SC2162
##########
# Config #
##########
url="<ip_of_ur_esphome_server>:6052"
fifo_file="${TMPDIR:-/tmp}/${0##*/}-fifo"
info() {
#shellcheck disable=SC2059
printf "\033[2K\r\033[1;${2:-36}m${1}\033[0m"
}
err() {
info "$1\n" "31"
}
menu() {
fzf --prompt="[Esphome] $1" --layout=reverse --border -d'\t' --with-nth=1
}
run_command() {
# this is done to make sure the file doesn't have anything stale left
rm -f "$fifo_file" && mkfifo "$fifo_file"
printf "%s\n" "$2" >"$fifo_file" &
tail -f "$fifo_file" | websocat "ws://$url/$1" | while read line; do
printf "%b\n" "$line" | sed -nE 's|.*"data": "(.*)n"}|\1|p' &
# exit this loop if we receive exit from response
printf "%b\n" "$line" | grep -q '"exit"' && pkill -P $$ tail &
done
rm -f "$fifo_file"
}
what_to_do=$(printf "logs\nupdate-all\nupdate" | menu "What to Do? >")
[ -z "$what_to_do" ] && err "Please Select Choice!!" && exit 1
if [ "$what_to_do" = "update-all" ]; then
data='{"type":"spawn"}'
else
device=$(curl -s "http://$url/devices" | tr '{}' '\n' | sed -nE 's|.*"friendly_name": "([^"]*)",.*"configuration": "([^"]*)".*|\1\t\2|p' | menu "Select Device >")
[ -z "$device" ] && err "Please Select a Device!!" && exit 1
dev_name=$(printf "%s" "$device" | cut -f1)
dev_config=$(printf "%s" "$device" | cut -f2)
info "Running $what_to_do for $dev_name...\n"
[ "$what_to_do" = 'update' ] && what_to_do="run"
data='{"type":"spawn","configuration":"'"$dev_config"'","port":"OTA"}'
fi
run_command "$what_to_do" "$data"

View File

@@ -95,25 +95,52 @@ mpv_jellyfin() {
success "Playing $2 on mpv" success "Playing $2 on mpv"
url="$JF_URL/Items/$1/Download?api_key=$JF_TOKEN" 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/$1/$1/Subtitles/0/0/Stream.ass?api_key=$JF_TOKEN"
! curl -s "$sub" | grep -q "Error processing request" && sub_arg="--sub-file=$sub" ! curl -s "$sub" | grep -q "Error processing request" && sub_arg="--sub-file=$sub"
if uname -o | grep -q 'ndroid'; then
text="Title: $2\nURL: $url"
[ -n "$sub_arg" ] && text="$text\nSub URL: $sub"
#shellcheck disable=SC2059
printf "\n$text"
#shellcheck disable=SC2059
printf "$text" | termux-clipboard-set
return 0
fi
#shellcheck disable=SC2086 #shellcheck disable=SC2086
nohup mpv --input-ipc-server="$socket" --start="$((playbackPositionTicks / 10000000))" --force-media-title="$2" "$url" $sub_arg >/dev/null 2>&1 & 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/$1/IntroSkipperSegments" -H 'Authorization: MediaBrowser Token="'"$JF_TOKEN"'"' -H "Accept: application/json" | sed 's|}|\n|g' | sed -nE 's|.*"Introduction".*"IntroStart":([^\.,]*).*,"IntroEnd":([^\.,]*).*|op_start=\1\nop_end=\2|p;s|.*"Credits".*"IntroStart":([^\.,]*).*"IntroEnd":([^\.,]*).*|ed_start=\1\ned_end=\2|p')
track_progress "$1"
} }
track_progress() { track_progress() {
ITEM_ID=$1
\cat <<EOF >"$progress_track_file" \cat <<EOF >"$progress_track_file"
#!/bin/sh #!/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 positionTicks=$playbackPositionTicks
$skipPositions
introSkipped=0
outroSkipped=0
while sleep 5;do 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') 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 [ -z "\$position" ] && break
positionTicks=\$position positionTicks=\$position
positionSec=\${position::-7}
[ "\$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 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' [ -n "\$positionTicks" ] && curl -s "$JF_URL/Users/$JF_USER_ID/PlayingItems/${1}?positionTicks=\$positionTicks" -X DELETE -H 'Authorization: MediaBrowser Token="$JF_TOKEN"' -H 'Content-Type: application/json'
rm "$socket" rm "$socket"
rm "\$0" rm "\$0"
EOF EOF
@@ -147,7 +174,10 @@ collection() {
collection_id=$(printf '%s' "$collection" | cut -f1) collection_id=$(printf '%s' "$collection" | cut -f1)
collection_title=$(printf '%s' "$collection" | cut -f3 | sed 's|.$||g') 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 [ -z "$data" ] && exit 1
id=$(printf "%s" "$data" | cut -f1) id=$(printf "%s" "$data" | cut -f1)
title=$(printf "%s" "$data" | cut -f3) title=$(printf "%s" "$data" | cut -f3)

2
rss
View File

@@ -15,4 +15,4 @@ name=$(printf "%s" "$data" | sed -nE 's_^.*Please\] (.*)</title>.*size>(.*)</sub
[ -z "$name" ] && exit 0 [ -z "$name" ] && exit 0
id=$(printf "%s" "$name" | sed -nE 's/.*\[(.*)\].*/\1/p') id=$(printf "%s" "$name" | sed -nE 's/.*\[(.*)\].*/\1/p')
magnet=$(printf "%s" "$data" | sed -nE "s_.*<link>(.*$id.*)</link>.*_\1_p" | sed 's/amp;//g') magnet=$(printf "%s" "$data" | sed -nE "s_.*<link>(.*$id.*)</link>.*_\1_p" | sed 's/amp;//g')
torrent_$os "$magnet" torrent_$os "$magnet" "f"

8
screen
View File

@@ -31,11 +31,7 @@ compress() {
record() { record() {
rm -f "$tmp_file" "$process_file" rm -f "$tmp_file" "$process_file"
#shellcheck disable=SC2034 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)
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")
[ -z "$source" ] && info "" "2000" "No option Selected" && return 0 [ -z "$source" ] && info "" "2000" "No option Selected" && return 0
@@ -43,7 +39,7 @@ record() {
[ -z "$monitor" ] && info "" "2000" "No option Selected" && return 0 [ -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 #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" "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)" info "simplescreenrecorder" "700" "Recording Started" "Capturing $monitor($source)"

13
torrent
View File

@@ -15,7 +15,7 @@ down() {
error_$os "Torrent: Error!!" error_$os "Torrent: Error!!"
} }
magnet="$*" magnet="$1"
if [ "$(uname -o)" = "Android" ]; then if [ "$(uname -o)" = "Android" ]; then
os="droid" os="droid"
script_dir="$HOME/.shortcuts" script_dir="$HOME/.shortcuts"
@@ -28,7 +28,10 @@ else
[ -z "$magnet" ] && magnet="$(wl-paste)" [ -z "$magnet" ] && magnet="$(wl-paste)"
terminal="${TERMINAL:-foot}" terminal="${TERMINAL:-foot}"
prefix="setsid -f $terminal -e" prefix="setsid -f $terminal -e"
pgrep -af "$0" | grep -q "$terminal" || { $prefix "$0" "$magnet"; exit 0; } pgrep -af "$0" | grep -q "$terminal" || {
$prefix "$0" "$magnet"
exit 0
}
fi fi
#import generic functions #import generic functions
@@ -40,7 +43,7 @@ filepath="$HOME/.cache"
! printf "%s" "$magnet" | grep -qE "magnet:\?xt=urn:btih:|\.torrent$" && error_$os "Not a valid magnet link!" && exit 0 ! printf "%s" "$magnet" | grep -qE "magnet:\?xt=urn:btih:|\.torrent$" && error_$os "Not a valid magnet link!" && exit 0
# check if the variable is actuall magnet-link or file # check if the variable is actuall magnet-link or file
if printf '%s' "$magnet" | grep -qE "\.torrent$";then if printf '%s' "$magnet" | grep -qE "\.torrent$"; then
filepath="$(dirname "$magnet")" filepath="$(dirname "$magnet")"
file="$(basename "$magnet")" file="$(basename "$magnet")"
is_file=1 is_file=1
@@ -49,13 +52,13 @@ fi
echo "$magnet" echo "$magnet"
printf "${c_yellow}Download>>\n${c_green}[f]ull torrent\n${c_cyan}[p]artial torrent \n${c_red}[q]uit" printf "${c_yellow}Download>>\n${c_green}[f]ull torrent\n${c_cyan}[p]artial torrent \n${c_red}[q]uit"
printf "${c_reset}\n\tenter choice:" printf "${c_reset}\n\tenter choice:"
read -r ch [ -z "$2" ] && read -r ch || ch=$2
case $ch in case $ch in
f) f)
down "$magnet" down "$magnet"
;; ;;
p) p)
if [ -z "$is_file" ];then if [ -z "$is_file" ]; then
file="$(printf "%s" "$magnet" | sed -nE 's|.*urn:btih:([^&]*).*|\1|p' | tr '[:upper:]' '[:lower:]').torrent" file="$(printf "%s" "$magnet" | sed -nE 's|.*urn:btih:([^&]*).*|\1|p' | tr '[:upper:]' '[:lower:]').torrent"
{ [ -f "$filepath/$file" ] && [ ! -f "$filepath/$file.aria2" ]; } || aria2c --dir="$filepath" --bt-metadata-only=true --bt-save-metadata=true "$magnet" -o "$file" { [ -f "$filepath/$file" ] && [ ! -f "$filepath/$file.aria2" ]; } || aria2c --dir="$filepath" --bt-metadata-only=true --bt-save-metadata=true "$magnet" -o "$file"
fi fi

View File

@@ -291,7 +291,6 @@ yt_agent="com.google.android.youtube/$yt_ver (Linux; U; Android 1$random_no) gzi
yt_music_ver="8.23.51" yt_music_ver="8.23.51"
yt_music_agent="com.google.android.apps.youtube.music/$yt_music_ver (Linux; U; Android 1$random_no) gzip" yt_music_agent="com.google.android.apps.youtube.music/$yt_music_ver (Linux; U; Android 1$random_no) gzip"
#call this script by script-name "function_name" "query" #call this script by script-name "function_name" "query"
[ -z "$1" ] && help "$@" [ -z "$1" ] && help "$@"
$1 "$2" "$3" $1 "$2" "$3"