2022-09-19 02:13:02 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2023-03-10 04:54:43 +00:00
|
|
|
WBROWSER="brave"
|
2022-09-19 02:13:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
#OPTS=" Torrent )
|
|
|
|
OPTS="Web
|
|
|
|
Video
|
|
|
|
YT
|
|
|
|
Audio
|
|
|
|
Youtube-dl audio
|
|
|
|
File
|
|
|
|
RSS
|
|
|
|
Torrent"
|
|
|
|
|
|
|
|
rss() {
|
|
|
|
#sfeed
|
|
|
|
sed -i '$d' ~/.config/sfeed/sfeedrc
|
|
|
|
FEED_NAME="$(echo "" | bemenu -p "Feed Name: ")"
|
|
|
|
echo "feed \"$FEED_NAME\" \"$1\"" >> ~/.config/sfeed/sfeedrc
|
|
|
|
echo "}" >> ~/.config/sfeed/sfeedrc
|
|
|
|
|
|
|
|
#newsboat
|
|
|
|
#echo "$1" >> ~/.config/newsboat/urls
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ydl() {
|
|
|
|
OPT="default
|
|
|
|
select"
|
|
|
|
|
|
|
|
SEL="$( echo "$OPT" | bemenu)"
|
|
|
|
|
|
|
|
LOC="$HOME/media/audio/"
|
|
|
|
|
|
|
|
if [ "$SEL" = "select" ]; then
|
|
|
|
if [ ! -f ~/.cache/lf/lastpath ]; then
|
|
|
|
mkdir -p ~/.cache/lf/
|
|
|
|
touch ~/.cache/lf/lastpath
|
|
|
|
echo "~" > ~/.cache/lf/lastpath
|
|
|
|
fi
|
|
|
|
$TERMINAL -e lf -last-dir-path ~/.cache/lf/lastpath "$(cat ~/.cache/lf/lastpath)"
|
|
|
|
LOC="$(cat ~/.cache/lf/lastpath)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$LOC"
|
|
|
|
youtube-dl "$1" -f 140
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sel() {
|
|
|
|
SEL="$( echo "$OPTS" | bemenu)"
|
|
|
|
|
|
|
|
|
2023-02-12 21:26:32 +00:00
|
|
|
case "$SEL" in
|
2022-09-19 02:13:02 +00:00
|
|
|
|
2023-02-12 21:26:32 +00:00
|
|
|
"Web") $WBROWSER "$1" ;;
|
2022-09-19 02:13:02 +00:00
|
|
|
|
2023-02-12 21:26:32 +00:00
|
|
|
"Video") mpv "$1";;
|
2022-09-19 02:13:02 +00:00
|
|
|
|
2023-02-12 21:26:32 +00:00
|
|
|
"YT") mpv --ytdl-format=18 "$1";;
|
2022-09-19 02:13:02 +00:00
|
|
|
|
2023-02-12 21:26:32 +00:00
|
|
|
"Audio") mpc insert "$1"
|
|
|
|
mpc next
|
|
|
|
mpc play ;;
|
2022-09-19 02:13:02 +00:00
|
|
|
|
2023-02-12 21:26:32 +00:00
|
|
|
"Youtube-dl audio") ydl "$1" ;;
|
|
|
|
|
2023-03-10 04:54:43 +00:00
|
|
|
"File")
|
|
|
|
DL_DIR="$(lf-dir.sh)"
|
|
|
|
cd "$DL_DIR" && curl -O -L "$1"
|
|
|
|
notify-send "$1 downloaded to: $DL_DIR";;
|
2023-02-12 21:26:32 +00:00
|
|
|
|
|
|
|
"RSS") rss "$1";;
|
|
|
|
|
|
|
|
"Torrent") transadd "$1";;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit
|
2022-09-19 02:13:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
#$WBROWSER #URL="$( xclip -o | sed 's/$//g')" && sel "$URL" && exit
|
|
|
|
#$WBROWSER #URL="$(wl-paste)" && sel "$URL" && exit
|
|
|
|
sel "$(wl-paste)"
|
|
|
|
else
|
|
|
|
#echo "$1" >> ~/.cache/log/browsersh.log
|
|
|
|
sel "$1"
|
|
|
|
fi
|