dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

commit 8dcfdc187f8d657937adfdb3e2c11e21d181f7e1
parent fc5ee12cb4db01f6e70ce20e5ea2872071e7895a
Author: Chris Noxz <chris@noxz.tech>
Date:   Sat, 28 Mar 2020 18:42:33 +0100

[bin] url fix for api.lbry.tv

Diffstat:
Mbin/.local/bin/dmenu_url_open | 57+++++++++++++++++++++++++++++++--------------------------
1 file changed, 31 insertions(+), 26 deletions(-)

diff --git a/bin/.local/bin/dmenu_url_open b/bin/.local/bin/dmenu_url_open @@ -1,51 +1,56 @@ #!/bin/sh options=" - copy - mpv - surf - vimb - w3m - wget - yt-dl + copy + mpv + surf + vimb + w3m + wget + yt-dl " url="$1"; shift visual="$url" if [ "${#visual}" -gt 30 ]; then - visual="$(expr substr $url 1 20)...$(expr substr $url $((${#url} -6)) 7)" + visual="$(expr substr $url 1 20)...$(expr substr $url $((${#url} -6)) 7)" fi args=" $@ -i -p $visual" +case "$url" in +*//api.lbry.tv*) + url="$(echo "$url" | sed "s/api.lbry.tv/player$((RANDOM%5+1)).lbry.tv/")";; +esac + case "$(printf "$options" \ | sed -e '/^$/d' -e 's/^[ \t]*//' \ | sort \ | dmenu_vtc${args})" in copy) - printf "$url" \ - | xclip -selection primary -f \ - | xclip -selection clipboard & ;; + printf "$url" \ + | xclip -selection primary -f \ + | xclip -selection clipboard & ;; mpv) - mpvc load "$url" ;; + mpvc load "$url" ;; yt-dl-video) - youtube-dl \ - -f webm \ - -o "$HOME/downloads/%(title)s-%(id)s.%(ext)s" \ - "$url" >/dev/null 2>&1 & ;; + youtube-dl \ + -f webm \ + -o "$HOME/downloads/%(title)s-%(id)s.%(ext)s" \ + "$url" >/dev/null 2>&1 & ;; yt-dl-audio) - youtube-dl \ - -extract-audio \ - --audio-format vorbis \ - --audio-quality 0 \ - -o "$HOME/downloads/%(title)s-%(id)s.%(ext)s" \ - "$url" >/dev/null 2>&1 & ;; + youtube-dl \ + -extract-audio \ + --audio-format vorbis \ + --audio-quality 0 \ + -o "$HOME/downloads/%(title)s-%(id)s.%(ext)s" \ + "$url" >/dev/null 2>&1 & ;; wget) - wget "$url" >/dev/null 2>&1 & ;; + wget "$url" >/dev/null 2>&1 & ;; surf) - surf "$url" >/dev/null 2>&1 & ;; + surf "$url" >/dev/null 2>&1 & ;; vimb) - vimb-tabbed "$url" >/dev/null 2>&1 & ;; + vimb-tabbed "$url" >/dev/null 2>&1 & ;; w3m) - w3m "$url" >/dev/null 2>&1 & ;; + w3m "$url" >/dev/null 2>&1 & ;; esac