diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 20:42:43 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 20:42:43 +0200 |
commit | 64d9d82afbe9fcdabc9e4b9c5f02bf12c093645c (patch) | |
tree | d9c2218c51716e77ea62cfe5c662274f49a2f3a2 /bin | |
parent | d7d9eb0f21770d4467a31d16e2adf7e9c8a21edf (diff) |
checkpoint
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/extra/trl | 33 | ||||
-rwxr-xr-x | bin/extra/ytplay | 7 | ||||
-rwxr-xr-x | bin/guiscripts/dmfm | 22 | ||||
-rwxr-xr-x | bin/menuscripts/mmedia | 91 | ||||
-rwxr-xr-x | bin/menuscripts/tsh | 6 |
5 files changed, 76 insertions, 83 deletions
diff --git a/bin/extra/trl b/bin/extra/trl index 55d65ee..957d0fb 100755 --- a/bin/extra/trl +++ b/bin/extra/trl @@ -5,33 +5,7 @@ # returns available languages languages () { - cat <<-EOF - arabic - dutch - french - german - polish - english - portuguese - spanish - romanian - hebrew - swedish - italian - turkish - japanese - ukrainian - korean - chinese - czech - hungarian - danish - persian - greek - slovak - hindi - thai - EOF + printf 'arabic\nchinese\nczech\ndanish\ndutch\nenglish\nfrench\ngerman\ngreek\nhebrew\nhindi\nhungarian\nitalian\njapanese\nkorean\npersian\npolish\nportuguese\nromanian\nslovak\nspanish\nswedish\nthai\nturkish\nukrainian\n' } if [ -z "${word:=$1}" ] @@ -47,11 +21,12 @@ primary="$(languages | fzf --prompt="from:")" secondary="$(languages | fzf --prompt="to:")" [ "$secondary" ] || exit 1 -curl -s "https://context.reverso.net/translation/$primary-$secondary/$word" \ +# url="https://www.reverso.net/text-translation#sl=$primary&tl=$secondary&text=$word" +url="https://context.reverso.net/translation/$primary-$secondary/$word" +curl -s "$url" \ --compressed \ -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0' \ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' \ - -H 'Accept-Language: en-US,en;q=0.5' \ -H 'Accept-Encoding: gzip, deflate, br' | pup 'a.link_highlighted em text{}' | sed 's/.*/\L&/' | diff --git a/bin/extra/ytplay b/bin/extra/ytplay index 5243364..4b23732 100755 --- a/bin/extra/ytplay +++ b/bin/extra/ytplay @@ -1,4 +1,9 @@ #!/bin/sh url="$(ytlink)" herbe "playing: $url" & -yt-dlp -o - "$url" | mpv - +yt-dlp "$url" \ + --embed-chapters \ + -f "b" \ + -S "res:1080" \ + -o - | + mpv - diff --git a/bin/guiscripts/dmfm b/bin/guiscripts/dmfm index 9485469..b7a68d2 100755 --- a/bin/guiscripts/dmfm +++ b/bin/guiscripts/dmfm @@ -1,20 +1,20 @@ #!/bin/sh -while true -do - dir="$(printf '%s' "$PWD" | sed "s#^$HOME#\~#;s#\([^/]\)[^/]*/#\1/#g")" - file=$(find . -maxdepth 1 -mindepth 1 -not -name '.*' -printf '%y\t%f\n' | +[ -d "$1" ] && cd "$1" + +while true; do + choice=$(find . -maxdepth 1 -mindepth 1 -not -name '.*' -printf '%y\t%f\n' | sort -k 1 -k 2 | cut -f 2- | - commander -xc -p "$dir") + dmenu -x -c -i -p "$(pwd)") - [ "$file" ] || break - [ ! -e "$file" ] && continue + [ "$choice" ] || break + [ -e "$choice" ] || continue - if [ -d "$file" ] - then - cd "$file" || continue + if [ -d "$choice" ]; then + cd "$choice" || continue else - setsid xdg-open "$PWD/$file" & + setsid xdg-open "$choice" & + exit fi done diff --git a/bin/menuscripts/mmedia b/bin/menuscripts/mmedia index 3141c3b..f4e6e3c 100755 --- a/bin/menuscripts/mmedia +++ b/bin/menuscripts/mmedia @@ -6,52 +6,65 @@ dirs="$HOME/dl" concat_path() { sed "s#^$HOME#\~#;s#\([^/]\)[^/]*/#\1/#g"; } -case "$1" in - "video") - regex='^.\+\.\(webm\|mp4\|mpeg\|mkv\)$' - dirs="$dirs $HOME/vids" - viewer() { $PLAYER "$1"; } ;; - "pdf") - regex='^.\+\.\(pdf\)$' - dirs="$dirs $HOME/docs" - viewer() { $VIEWER "$1"; } ;; - "image") - regex='^.\+\.\(png\|avif\|jpg\)$' - dirs="$dirs $HOME/pics" - viewer() { $IMAGE "$1"; } ;; - "cursus") - regex='^.*/[cC]ursus/index.html$' - dirs="$HOME/docs/school/Vakken" - concat_path() { sed "s#$dirs/##;s#/[cC]ursus/index.html##"; } - viewer() { $BROWSER "$1"; } ;; - "schoolpdf") - regex='^.\+\.\(pdf\)$' - dirs="$HOME/docs/school/Vakken" - concat_path() { sed "s#$dirs/##;s#/[cC]ursus/index.html##;s#/Cursus/viewer/files/#: #"; } - viewer() { $VIEWER "$1"; } ;; - *) - choice="$(cat <<-EOF | dmenu -g 5 -l 1 -c - video - pdf - image - cursus - schoolpdf +case "$1" in +"video") + regex='^.\+\.\(webm\|mp4\|mpeg\|mkv\)$' + dirs="$dirs $HOME/vids" + viewer() { $PLAYER "$1"; } + ;; +"pdf") + regex='^.\+\.\(pdf\)$' + dirs="$dirs $HOME/docs" + viewer() { $VIEWER "$1"; } + ;; +"image") + regex='^.\+\.\(png\|avif\|jpg\)$' + dirs="$dirs $HOME/pics" + viewer() { $IMAGE "$1"; } + ;; +"cursus") + regex='^.*/[cC]ursus/index.html$' + dirs="$HOME/docs/school/Vakken" + concat_path() { sed "s#$dirs/##;s#/[cC]ursus/index.html##"; } + viewer() { $BROWSER "$1"; } + ;; +"schoolpdf") + regex='^.\+\.\(pdf\)$' + dirs="$HOME/docs/school/Vakken" + concat_path() { sed "s#$dirs/##;s#/[cC]ursus/index.html##;s#/Cursus/viewer/files/#: #"; } + viewer() { $VIEWER "$1"; } + ;; +"lecture") + dmfm $HOME/docs/lecture + exit + ;; +*) + choice="$( + cat <<-EOF | dmenu -g 6 -l 1 -c + video + pdf + image + cursus + schoolpdf + lecture EOF - )" - [ "$choice" ] || exit 1 - "$0" "$choice" - exit ;; + )" + [ "$choice" ] || exit 1 + "$0" "$choice" + exit + ;; esac shift [ "$1" ] && dirs="$1" choice="$( - find -L $dirs 2> /dev/null | - grep "$regex" | - sort | tee "$tmp" | - concat_path | - dmenu -px -c -i -l 10 -g 1 -x)" + find -L $dirs 2>/dev/null | + grep -i "$regex" | + sort | tee "$tmp" | + concat_path | + dmenu -px -c -i -l 10 -g 1 -x +)" file="$(sed -n "${choice}p" "$tmp")" [ -r "$file" ] || exit 1 diff --git a/bin/menuscripts/tsh b/bin/menuscripts/tsh index 0c57ee0..72670f2 100755 --- a/bin/menuscripts/tsh +++ b/bin/menuscripts/tsh @@ -170,8 +170,11 @@ then # Get results rm -f "$results" "$links" + # shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091 . "$MODULES_PATH/$module" + get_torrents + [ -f "$results" ] || die "No results." # Save which module was used @@ -180,9 +183,6 @@ else module="$(tail -n 1 "$links")" fi -# acquire get_magnet function -# shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091 -getfunctions=1 . "$MODULES_PATH/$module" # select result from "$results" for choice in $(select_result | xargs) |