Initial commit of utility scripts
This commit is contained in:
parent
ac77586a15
commit
1faeefffd7
34 changed files with 1328 additions and 1 deletions
46
bin/viewurl
Executable file
46
bin/viewurl
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Feed script a url.
|
||||
# If an image, it will view in feh,
|
||||
# if a video or gif, it will view in mpv
|
||||
# if a music file or pdf, it will download,
|
||||
# otherwise it opens link in browser.
|
||||
|
||||
# List of sites that will be opened in mpv.
|
||||
vidsites="youtube.com
|
||||
\|youtu.be
|
||||
\|hooktube.com
|
||||
\|bitchute.com
|
||||
\|lukesmith.xyz
|
||||
\|odysee.com
|
||||
\|rumble.com
|
||||
"
|
||||
if [ -p /dev/stdin ]; then
|
||||
read url
|
||||
else
|
||||
url=$1
|
||||
fi
|
||||
echo $url
|
||||
ext="${url##*.}"
|
||||
mpvFiles="ogg mkv mp4 gif mp3 mp3?source=feed"
|
||||
sxivFiles="png jpg jpeg jpe"
|
||||
mpvAdd="mp3?updated=*"
|
||||
wgetFiles="mp3 flac opus mp3?source=feed pdf"
|
||||
|
||||
if echo $sxivFiles | grep -w $ext > /dev/null; then
|
||||
view_url_image "$url" >/dev/null &
|
||||
elif echo $mpvFiles | grep -w $ext > /dev/null; then
|
||||
mpv --audio-display=no --loop "$url"
|
||||
elif echo $wgetFiles | grep -w $ext > /dev/null; then
|
||||
wget "$url" >/dev/null &
|
||||
elif echo "$url" | grep "$vidsites">/dev/null; then
|
||||
mpv "$url" > /dev/null &
|
||||
elif echo "$url" | grep "$mpvAdd" > /dev/null; then
|
||||
mpv --audio-display=no --loop "$url"
|
||||
elif echo "$url" | grep "doi.org" > /dev/null; then
|
||||
view_doc $url
|
||||
elif echo "$url" | grep "mp3" > /dev/null; then
|
||||
mpv --audio-display=no --loop "$url"
|
||||
else
|
||||
$BROWSER "$url" 2>/dev/null & disown
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue