diff options
-rwxr-xr-x | .local/bin/curlkg | 3 | ||||
-rwxr-xr-x | .local/bin/curlncm | 5 | ||||
-rwxr-xr-x | .local/bin/curlqb | 7 | ||||
-rwxr-xr-x | .local/bin/mpva | 1 | ||||
-rwxr-xr-x | .local/bin/mpvy | 2 | ||||
-rwxr-xr-x | .local/bin/o | 5 | ||||
-rwxr-xr-x | .local/bin/orgext | 7 | ||||
-rwxr-xr-x | .local/bin/reco | 7 | ||||
-rwxr-xr-x | .local/bin/upd | 2 |
9 files changed, 6 insertions, 33 deletions
diff --git a/.local/bin/curlkg b/.local/bin/curlkg index f7c0853c..9389e680 100755 --- a/.local/bin/curlkg +++ b/.local/bin/curlkg @@ -1,4 +1,5 @@ #!/bin/sh + # references: # https://blog.csdn.net/qq_41730930/article/details/79327757 # https://blog.csdn.net/u011112876/article/details/89634505 @@ -29,7 +30,6 @@ get_json () curl -s -G --data-urlencode type=get_uinfo -d outCharset=utf-8 -d start="$1" -d num=$num -d share_uid="$uid" "$homepage_url" | sed 's/.*({\(.*\)}).*/{\1}/' >> "$tmp_json_file" } -# is it possible not to write to a file? only pipe stdout? should I? get_json 1 ugc_total_count=$(jq '.data.ugc_total_count' "$tmp_json_file") # can also use while loop with i=$((i+1)) @@ -38,6 +38,5 @@ for i in $(seq 2 $(((ugc_total_count+num-1)/num))); do get_json "$i" done -# how to show less aria2c stdout? jq -r '.data.ugclist[]|"'"$music_url"'?shareid=\(.shareid)\n out=\(.title)_\(.time).m4a"' "$tmp_json_file" | aria2c -d "$download_dir" --auto-file-renaming=false --console-log-level=warn -i- rm "$tmp_json_file" diff --git a/.local/bin/curlncm b/.local/bin/curlncm index 2a096c6c..582214ac 100755 --- a/.local/bin/curlncm +++ b/.local/bin/curlncm @@ -1,5 +1,6 @@ #!/bin/sh # rewrite TianyiShi2001's python script which rewrite NeteaseCloudMusicApi node.js api + # references: # https://github.com/ytdl-org/youtube-dl/issues/18051#issuecomment-859964832 # https://github.com/Binaryify/NeteaseCloudMusicApi @@ -26,8 +27,7 @@ die () exit 1 } -# let a i r mutually exclusive, can improve by chain ids -# need to add usage help message after improvements +# let a i r mutually exclusive # artist, song, djradio id flag=0 while getopts a:i:r: opt; do @@ -54,7 +54,6 @@ if [ -n "$ids" ]; then # temporary solution, can improve by auto curl names data="$(echo "$ids" | tr ',' '\n' | awk '{printf("%s\t%s\n",$0,"songname")}')" else - # need to consider second page of djradio if [ -n "$rid" ]; then data="$(curl -s -G --data-urlencode id="$rid" -d limit="$dj_max" 'https://music.163.com/djradio' | grep 'songlist\|tt f-thide' | sed -e 's/.*songlist-\(.*\)" class.*/\1/g' -e 's/.*title="\(.*\)".*/\1/g' | paste -sd '\t\n' | sort | tr '/' '_')" # can only curl featured 50 songs for the artist, can improve diff --git a/.local/bin/curlqb b/.local/bin/curlqb index 67dc2f82..f98a41c8 100755 --- a/.local/bin/curlqb +++ b/.local/bin/curlqb @@ -1,12 +1,5 @@ #!/bin/sh -# how to not rewrite, maybe not? -# how to know if there's new? use rewrite? -# how to check if some script outdated? delete it? -# how qbittorrent auto update those scripts, maybe try the fork? -# how to make it a pure awk script? should I? -# can I replace awk $0 ~ /.../ with /.../ ? - curl -s 'https://github.com/qbittorrent/search-plugins/wiki/Unofficial-search-plugins' | awk -F'"' '/Plugins for Private sites/{exit} /\.py/{url=$2;getline;getline;getline;if($0 !~ /❗|✖/)print url}' | xargs curl -s -Z -L --remote-name-all --create-dirs --output-dir "$1" -- #curl -s 'https://github.com/qbittorrent/search-plugins/wiki/Unofficial-search-plugins' | awk -F'"' '{ diff --git a/.local/bin/mpva b/.local/bin/mpva index 0c775a50..7224cf46 100755 --- a/.local/bin/mpva +++ b/.local/bin/mpva @@ -2,7 +2,6 @@ if [ $# -eq 0 ]; then # fzf has --read0, maybe useful - # may further improve it by consider fzf select only one file, seems hard without bashism array find "$XDG_MUSIC_DIR" | fzf -m --print0 | xargs -0 mpv --af= --shuffle --loop-playlist=inf --video=no elif [ $# -eq 1 ]; then # use --loop-file for single file, better performance maybe diff --git a/.local/bin/mpvy b/.local/bin/mpvy index 2d3e5179..94898fe1 100755 --- a/.local/bin/mpvy +++ b/.local/bin/mpvy @@ -1,4 +1,5 @@ #!/bin/sh + # references: # https://www.rockyourcode.com/til-how-to-watch-youtube-videos-with-mpv-and-keyboard-shortcuts/ @@ -7,7 +8,6 @@ height=$SCRHEIGHT url="$(xsel -ob)" flag=s -# may improve to make some options mutually exclusive, see curlncm, maybe not # option f and h may do nothing if redownload? since same filename exist. yt-dlp won't download same file even without --auto-file-renameing=false. how improve? pass argument to aria2c? while getopts Aabd:f:h:su: opt; do case $opt in diff --git a/.local/bin/o b/.local/bin/o index a12eee46..21464974 100755 --- a/.local/bin/o +++ b/.local/bin/o @@ -5,11 +5,6 @@ # https://serverfault.com/questions/117152/do-background-processes-get-a-sighup-when-logging-off # https://wiki.archlinux.org/title/default_applications -# improve -# if $1 is executable script filename in current dir and no ./ in front, use ./$1 ? -# also consider if $1 is executable but is directory? -# consider directoy, using xdg-mime to get the application name, hope the application can open dir and use it to batch open them, maybe not use while to open them one by one - # I don't care about errors, I don't want to handle errors, just shut up please. # nohup seems not necessary if don't care about daemon SIGHUP requirement diff --git a/.local/bin/orgext b/.local/bin/orgext index 88950928..58cc8b86 100755 --- a/.local/bin/orgext +++ b/.local/bin/orgext @@ -1,9 +1,8 @@ #!/bin/sh -# can improve by passing $@ to functions, but seems need bashism, or abandon functions -# maybe seperate find extension part and output names as another script with options of recursive or not -# maybe add option for using ln instead of mv + # references: # https://stackoverflow.com/questions/1842254/how-can-i-find-all-of-the-distinct-file-extensions-in-a-folder-hierarchy + # not sure if find here need -depth, not sure if mv here need -n and -T outdir () @@ -12,8 +11,6 @@ outdir () find . -mindepth 1 -maxdepth 1 -type d -delete } -# may further optimize by output file extension names to a variable and use it for both mkdir and mv, current is fast enough for me -# maybe better if make all uppercase to lowercase, is it possible to use awk for that? indir () { find . -maxdepth 1 -type f | awk -F. '!a[$NF]++{print $NF}' | xargs mkdir -- diff --git a/.local/bin/reco b/.local/bin/reco index 512a259a..d56e61c2 100755 --- a/.local/bin/reco +++ b/.local/bin/reco @@ -5,13 +5,6 @@ # https://wiki.archlinux.org/title/FFmpeg#Screen_capture # https://trac.ffmpeg.org/wiki/Capture/Desktop -# better notify-send? keep send notify-send when recording? or not -# benchmark different encode codecs to choose a better one? -# consider audio, camera ... -# hardware acc? seems no for ffvhuff? see arch wiki -# sbar wait signal approach? or not -# reco sbar status? so no notify-send - infofile="/tmp/recoinfo" recodir="$XDG_VIDEOS_DIR/recordings/" mkdir -p "$recodir" diff --git a/.local/bin/upd b/.local/bin/upd index a1f38509..5f5ee657 100755 --- a/.local/bin/upd +++ b/.local/bin/upd @@ -1,5 +1,4 @@ #!/bin/sh -# may need mkdir -p for some of the dirs? kg and ncm no need, how about refl and gall all () { @@ -47,7 +46,6 @@ ncm () pac () { - # may improve to query updated packages' changelogs, using `pacman -Qc` sudo pacman --noconfirm -Syu paru --noconfirm -aSyu # part steal from aur comment |