You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

#!/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