summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksei <alex3kov@zoho.com>2024-11-15 20:01:06 +0300
committerAleksei <alex3kov@zoho.com>2024-11-15 20:01:06 +0300
commita59b724f118313bdd7c03ab7acf15d5f63df94d2 (patch)
tree161a6b7bf205e8a466ac7fe45d55a77e34277ed1
parent72d6d16224fcfd282c74c6654ff17193251e9b1e (diff)
-rw-r--r--shellconfig_aliases.sh2
-rw-r--r--shellconfig_functions.sh43
-rw-r--r--stowables-dotconfig/yt-dlp/config2
3 files changed, 40 insertions, 7 deletions
diff --git a/shellconfig_aliases.sh b/shellconfig_aliases.sh
index 20212a5..a6602aa 100644
--- a/shellconfig_aliases.sh
+++ b/shellconfig_aliases.sh
@@ -58,7 +58,7 @@ alias mkd='mkdir -pv'
alias moldrun='mold --run'
alias mpvytdlp18='mpv --ytdl-format=18'
alias mpvytdlp720p='mpv --ytdl-raw-options=format-sort=\"res:720,+fps\"'
-alias mpvytdlpworst_novideo='mpv --ytdl-raw-options="format=worst[ext!=timeline]" --no-video'
+alias mpvytdlpworst_novideo='mpv --ytdl-raw-options="format=worst[protocol!=rtmp][ext!=timeline]" --no-video'
alias mpvytdlp_91_novideo='mpv --ytdl-raw-options="format=91" --no-video'
alias mpvytdlp_95='mpv --ytdl-raw-options="format=95"'
alias mpvshuffle='mpv --shuffle'
diff --git a/shellconfig_functions.sh b/shellconfig_functions.sh
index 2b45780..f722093 100644
--- a/shellconfig_functions.sh
+++ b/shellconfig_functions.sh
@@ -43,18 +43,32 @@ wgettor() {
export ALL_PROXY="socks5h://127.0.0.1:9050"
wget "$@"
}
+seconds_to_htime() {
+ dur=$1
+ hours=$(expr $1 / 3600)
+ minutes=$(expr \( $1 - \( $hours \* 3600 \) \) / 60)
+ seconds=$(expr $1 % 60)
+ printf "%02u:%02u:%02u" $hours $minutes $seconds
+}
mediaduration() {
durtotal=0
for f in "$@"; do
[ -f "$f" ] && {
+ if [ "$(file -b --mime-type $f)" = "inode/x-empty" ] ; then
+ continue
+ fi
durcur=$(ffprobe -print_format json -show_entries format=duration \
-v quiet "$f" | jq -r '.format.duration|tonumber|round')
[ -z "$durcur" ] && durcur=0
durtotal=$(expr $durtotal + $durcur)
- printf "%s: %s\n" "${f##*/}" "$(date -u -d @${durcur} +'%T')"
+ printf "%s: " "${f##*/}"
+ seconds_to_htime $durcur
+ printf "\n"
}
done
- printf "Total: %s\n" "$(date -u -d @${durtotal} +'%T')"
+ printf "Total: "
+ seconds_to_htime $durtotal # "$(date -u -d @${durtotal} +'%T')"
+ printf "\n"
}
lftpsrv() {
lftp -u alarm,$(pass alarm@srv.homelan|head -n1) srv.homelan
@@ -222,6 +236,14 @@ ytdlpchoose_format() {
yt-dlp -f $fmt "$u"
done
}
+renamemedia_file_to_title() {
+ fname=$1
+ ext=${fname##*.}
+ title=$(mediainfo --Output=JSON "$fname"|
+ jq -Mr '.media.track[]|select(.["@type"]=="General").Title')
+ mv -v "$fname" "${title}.$ext"
+ detox "${title}.$ext"
+}
getquicknotesandroidphone() {
addr=$(awk '/^# hostname androi.*/ {name=$3 ; next} name!="" {print substr($0,9) ; exit}' /etc/systemd/network/00-vswitch.network)
sftp -q -P 1234 $addr:quicknote.md /tmp
@@ -244,12 +266,21 @@ sshsftplan() {
name=${name_ip% *}
ip=${name_ip#* }
case $name in
- *android*) sftp -P 1234 $ip ; return ;;
+ *android*) lftp -p 1234 sftp://$ip ; return ;;
*) ;;
esac
- tool=$(printf "ssh\nsftp"|fzy)
- [ -z $tool ] && return
- $tool me@$ip
+ tool=$(printf "ssh\nlftp"|fzy)
+ case $tool in
+ lftp)
+ $tool sftp://$ip
+ ;;
+ ssh)
+ $tool $ip
+ ;;
+ '')
+ return
+ ;;
+ esac
}
mpvchapters() {
for fname in "$@"; do
diff --git a/stowables-dotconfig/yt-dlp/config b/stowables-dotconfig/yt-dlp/config
index 7240d8d..62d8e44 100644
--- a/stowables-dotconfig/yt-dlp/config
+++ b/stowables-dotconfig/yt-dlp/config
@@ -7,3 +7,5 @@
--output /dev/shm/%(title)s_%(width)sx%(height)s_%(id)s.%(ext)s
#--output /media/storage/tmp/%(title)s_%(width)sx%(height)s_%(id)s.%(ext)s
--add-metadata
+--concurrent-fragments 5
+--restrict-filenames