mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2026-03-01 04:10:35 +05:30
Compare commits
3 Commits
cf4b2095eb
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
5ca03f6a75
|
|||
|
|
993b828617 | ||
|
|
2344bd7dfb |
@@ -49,5 +49,5 @@ player_droid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
player_linux() {
|
player_linux() {
|
||||||
setsid -f mpv "$1" --force-media-title="$2" $@
|
setsid -f mpv "$1" --force-media-title="$2" $3
|
||||||
}
|
}
|
||||||
|
|||||||
2
ani-new
2
ani-new
@@ -76,7 +76,7 @@ printf "%s\n" "$url" | while read -r id title; do
|
|||||||
subs_flag=
|
subs_flag=
|
||||||
[ -n "$subtitle" ] && subs_flag="--sub-file=$subtitle"
|
[ -n "$subtitle" ] && subs_flag="--sub-file=$subtitle"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
player_$os "$provider_video" "$title" --referrer="https://$domain" $subs_flag
|
player_$os "$provider_video" "$title" "--referrer=https://$domain $subs_flag"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
cast)
|
cast)
|
||||||
|
|||||||
29
download
29
download
@@ -13,7 +13,25 @@ notify_droid() {
|
|||||||
|
|
||||||
notify_linux() {
|
notify_linux() {
|
||||||
info "$1"
|
info "$1"
|
||||||
notify-send -e "$1" -h "string:x-canonical-private-synchronous:${0##*/}"
|
notify-send -e -i "$3" -h "string:x-canonical-private-synchronous:${0##*/}" -t "${2:-5000}" "$1" "$4"
|
||||||
|
}
|
||||||
|
|
||||||
|
compress() {
|
||||||
|
duration=$(ffprobe -hide_banner -i "$1" 2>&1 | sed -nE 's|.*Duration: ([^,]*).*|\1|p')
|
||||||
|
i=20
|
||||||
|
|
||||||
|
while :; do
|
||||||
|
ffmpeg -loglevel error -i "$1" -c:v libx264 -c:a copy -crf "$i" "$process_file" -y -progress - | while read -r line; do
|
||||||
|
complete=$(printf "%s\n" "$line" | sed -nE 's|out_time=(.*)|\1|p')
|
||||||
|
size=$(du -m "$process_file" | cut -f1)
|
||||||
|
[ -n "$complete" ] && notify_$os "Compressing File under $target_size_mb MB Using Quality Preset : $i.." "700" "ffmpeg" "$complete / $duration ($size MB)"
|
||||||
|
[ "$size" -gt "$target_size_mb" ] && killall -s KILL ffmpeg && break
|
||||||
|
done
|
||||||
|
[ "$(du -m "$process_file" | cut -f1)" -lt "$target_size_mb" ] && break
|
||||||
|
: $((i += 1))
|
||||||
|
done
|
||||||
|
notify_$os "File Successfully compressed with Quality Preset : $i" "1000" "ffmpeg"
|
||||||
|
[ -f "$process_file" ] && filepath=$process_file
|
||||||
}
|
}
|
||||||
|
|
||||||
send_matrix_msg() {
|
send_matrix_msg() {
|
||||||
@@ -54,6 +72,8 @@ send_matrix_msg() {
|
|||||||
#main
|
#main
|
||||||
link="$1"
|
link="$1"
|
||||||
yt_dlp_logs="${TMPDIR:-/tmp}/${0##*/}-logs"
|
yt_dlp_logs="${TMPDIR:-/tmp}/${0##*/}-logs"
|
||||||
|
process_file="${TMPDIR:-/tmp}/processed.mp4"
|
||||||
|
target_size_mb=10
|
||||||
|
|
||||||
case $(uname -o) in
|
case $(uname -o) in
|
||||||
*ndroid*)
|
*ndroid*)
|
||||||
@@ -74,7 +94,7 @@ info "Downloading Video.."
|
|||||||
|
|
||||||
truncate -s0 "$yt_dlp_logs" # truncate file if exists, creates if doesn't exists
|
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"
|
yt-dlp -S "filesize:10M" -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)
|
filepath=$(sed -nE "s|.*($download_dir.*\.mp4).*|\1|p" "$yt_dlp_logs" | head -1)
|
||||||
|
|
||||||
@@ -84,6 +104,9 @@ filepath=$(sed -nE "s|.*($download_dir.*\.mp4).*|\1|p" "$yt_dlp_logs" | head -1)
|
|||||||
# load matrix creds
|
# load matrix creds
|
||||||
matrix_creds
|
matrix_creds
|
||||||
|
|
||||||
|
# compresses the video file under 10 MB
|
||||||
|
[ "$(du -m "$filepath" | cut -f1)" -gt "$target_size_mb" ] && compress "$filepath"
|
||||||
|
|
||||||
send_matrix_msg "$filepath"
|
send_matrix_msg "$filepath"
|
||||||
|
|
||||||
# unload matrix creds
|
# unload matrix creds
|
||||||
@@ -91,5 +114,5 @@ matrix_creds "unload"
|
|||||||
|
|
||||||
notify_$os "Video Sent to Matrix"
|
notify_$os "Video Sent to Matrix"
|
||||||
|
|
||||||
rm -f "$filepath"
|
rm -f "$filepath" "$process_file" "$yt_dlp_logs"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
2
yt-music
2
yt-music
@@ -65,7 +65,7 @@ get_cookies() {
|
|||||||
# the user has firefox installed
|
# the user has firefox installed
|
||||||
if [ ! -f "$HOME/.config/google-chrome/Default/Cookies" ]; then
|
if [ ! -f "$HOME/.config/google-chrome/Default/Cookies" ]; then
|
||||||
cp "$(find "$HOME/.mozilla" -type f -iname 'cookies.sqlite' | head -1)" "$logdir/cookies.sqlite"
|
cp "$(find "$HOME/.mozilla" -type f -iname 'cookies.sqlite' | head -1)" "$logdir/cookies.sqlite"
|
||||||
sqlite3 "$logdir/cookies.sqlite" "SELECT name, value FROM moz_cookies WHERE host='.youtube.com' and name NOT like 'ST-%' and name NOT like 'VISITOR%' and name NOT like 'PREF%';" | tr '|\n' '=;' >"$cookie"
|
sqlite3 "$logdir/cookies.sqlite" "SELECT name, value FROM moz_cookies WHERE host='.youtube.com' and name NOT like 'ST-%' and name NOT like 'VISITOR%' and name NOT like 'PREF%' and name NOT like '%Secure-%';" | tr '|\n' '=;' >"$cookie"
|
||||||
rm "$logdir/cookies.sqlite"
|
rm "$logdir/cookies.sqlite"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user