Merge branch 'master' of github.com:LukeSmithxyz/voidrice

This commit is contained in:
Luke Smith 2022-09-27 21:32:54 -04:00
commit 2a57d5a07b
5 changed files with 27 additions and 47 deletions

View file

@ -32,7 +32,7 @@ color article white default bold
browser linkhandler browser linkhandler
macro , open-in-browser macro , open-in-browser
macro t set browser "qndl" ; open-in-browser ; set browser linkhandler macro t set browser "qndl" ; open-in-browser ; set browser linkhandler
macro a set browser "tsp yt-dlp --embed-metadata -xic -f bestaudio/best" ; open-in-browser ; set browser linkhandler macro a set browser "tsp yt-dlp --embed-metadata -xic -f bestaudio/best --restrict-filenames" ; open-in-browser ; set browser linkhandler
macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler
macro w set browser "lynx" ; open-in-browser ; set browser linkhandler macro w set browser "lynx" ; open-in-browser ; set browser linkhandler
macro d set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler macro d set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler

View file

@ -10,7 +10,8 @@ case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv
"mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;; "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
"mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;; "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
"queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;; "queue yt-dlp") qndl "$feed" >/dev/null 2>&1 ;;
"queue yt-dlp audio") qndl "$feed" 'yt-dlp --embed-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;; "queue yt-dlp audio") qndl "$feed" 'yt-dlp -o '%(title)s.%(ext)s' -f bestaudio --embed-metadata --restrict-filenames'
' >/dev/null 2>&1 ;;
"queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;; "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;; sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;

View file

@ -7,7 +7,7 @@
basename="${1%.*}" basename="${1%.*}"
case "${*}" in case "${*}" in
*.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) target="$(getcomproot "$1" || echo "$1")" ; setsid -f xdg-open "${target%.*}".pdf >/dev/null 2>&1 ;; *.tex|*.sil|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) target="$(getcomproot "$1" || echo "$1")" ; setsid -f xdg-open "${target%.*}".pdf >/dev/null 2>&1 ;;
*.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;; *.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
*.sent) setsid -f sent "$1" >/dev/null 2>&1 ;; *.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
esac esac

View file

@ -9,31 +9,29 @@
# computer to have its time properly synced. This can be done with the command # computer to have its time properly synced. This can be done with the command
# below which requires the package `ntp`. # below which requires the package `ntp`.
ifinstalled pass pass-otp ifinstalled pass pass-otp || exit 1
dir="${PASSWORD_STORE_DIR}" dir="${PASSWORD_STORE_DIR}"
choice="$({ echo "🆕add" ; echo "🕙sync-time" ; ls ${dir}/*-otp.gpg ;} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")" choice="$({ echo "🆕add" ; echo "🕙sync-time" ; ls "$dir"/*-otp.gpg ;} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")"
case $choice in case $choice in
🆕add ) 🆕add )
ifinstalled maim zbar xclip || exit 1 ifinstalled maim zbar || exit 1
temp="$dir/temp.png" temp=$(mktemp -p "$XDG_RUNTIME_DIR" --suffix=.png)
otp="otp-test-script" otp="otp-test-script"
trap 'shred -fu $temp; pass rm $otp' HUP INT QUIT TERM PWR EXIT trap 'rm -f $temp; pass rm -f $otp' HUP INT QUIT TERM PWR EXIT
notify-send "Scan the image." "Scan the OTP QR code." notify-send "Scan the image." "Scan the OTP QR code."
maim -s "$temp" || exit 1 maim -s "$temp" || exit 1
info="$(zbarimg -q "$temp")" info="$(zbarimg -q "$temp")"
info="${info#QR-Code:}" info="${info#QR-Code:}"
issuer="$(echo "$info" | grep -o "issuer=[A-z0-9]\+")"
name="${issuer#issuer=}"
if echo "$info" | pass otp insert "$otp"; then if echo "$info" | pass otp insert "$otp"; then
while true ; do while true ; do
export name="$(dmenu -p "Give this One Time Password a one-word name:")" export name="$(echo | dmenu -p "Give this One Time Password a one-word name:")"
echo "$name" | grep -q -- "^[A-z0-9-]\+$" && break echo "$name" | grep -q -- "^[A-z0-9-]\+$" && break
done done
pass mv "$otp" "$name-otp" pass mv "$otp" "$name-otp"
@ -41,7 +39,6 @@ case $choice in
else else
notify-send "No OTP data found." "Try to scan the image again more precisely." notify-send "No OTP data found." "Try to scan the image again more precisely."
fi fi
;; ;;
🕙sync-time ) 🕙sync-time )
ifinstalled ntp || exit 1 ifinstalled ntp || exit 1

View file

@ -13,7 +13,7 @@ Options:
-c: comment -c: comment
You will be prompted for title, artist, album and track if not given." && exit 1 ;} You will be prompted for title, artist, album and track if not given." && exit 1 ;}
while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in while getopts "a:t:A:n:N:d:g:c:" o; do case "${o}" in
a) artist="${OPTARG}" ;; a) artist="${OPTARG}" ;;
t) title="${OPTARG}" ;; t) title="${OPTARG}" ;;
A) album="${OPTARG}" ;; A) album="${OPTARG}" ;;
@ -22,7 +22,6 @@ while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in
d) date="${OPTARG}" ;; d) date="${OPTARG}" ;;
g) genre="${OPTARG}" ;; g) genre="${OPTARG}" ;;
c) comment="${OPTARG}" ;; c) comment="${OPTARG}" ;;
f) file="${OPTARG}" ;;
*) printf "Invalid option: -%s\\n" "$OPTARG" && err ;; *) printf "Invalid option: -%s\\n" "$OPTARG" && err ;;
esac done esac done
@ -30,38 +29,21 @@ shift $((OPTIND - 1))
file="$1" file="$1"
[ ! -f "$file" ] && echo "Provide file to tag." && err temp="$(mktemp -p "$(dirname "$file")")"
trap 'rm -f $temp' HUP INT QUIT TERM PWR EXIT
[ -z "$title" ] && echo "Enter a title." && read -r title [ ! -f "$file" ] && echo 'Provide file to tag.' && err
[ -z "$artist" ] && echo "Enter an artist." && read -r artist
[ -z "$album" ] && echo "Enter an album." && read -r album
[ -z "$track" ] && echo "Enter a track number." && read -r track
case "$file" in [ -z "$title" ] && echo 'Enter a title.' && read -r title
*.ogg) echo "Title=$title [ -z "$artist" ] && echo 'Enter an artist.' && read -r artist
Artist=$artist [ -z "$album" ] && echo 'Enter an album.' && read -r album
Album=$album [ -z "$track" ] && echo 'Enter a track number.' && read -r track
Track=$track
Total=$total cp -f "$file" "$temp" && ffmpeg -i "$temp" -map 0 -y -codec copy \
Date=$date -metadata title="$title" \
Genre=$genre -metadata album="$album" \
Comment=$comment" | vorbiscomment -w "$file" ;; -metadata artist="$artist" \
*.opus) echo "Title=$title -metadata track="${track}${total:+/"$total"}" \
Artist=$artist ${date:+-metadata date="$date"} \
Album=$album ${genre:+-metadata genre="$genre"} \
Track=$track ${comment:+-metadata comment="$comment"} "$file"
Total=$total
Date=$date
Genre=$genre
Comment=$comment" | opustags -i -S "$file" ;;
*.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;;
*.flac) echo "TITLE=$title
ARTIST=$artist
ALBUM=$album
TRACKNUMBER=$track
TOTALTRACKS=$total
DATE=$date
GENRE=$genre
DESCRIPTION=$comment" | metaflac --remove-all-tags --import-tags-from=- "$file" ;;
*) echo "File type not implemented yet." ;;
esac