reimplement config dotfiles with templates
This commit is contained in:
32
scripts/mpv.sh
Executable file
32
scripts/mpv.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
_BASENAME=$(basename "$0")
|
||||
_DIRNAME=$(dirname "$0")
|
||||
cd "$(dirname "$0")" || _exit 1
|
||||
|
||||
## if not $1
|
||||
if [[ -z $1 ]]
|
||||
then
|
||||
_LINES=$(curl "http://10.0.0.1:4447" 2>/dev/null | sed -e "s|.*<a href=\"\([^\"]*\).*|$1\1|" -e "s/.*<.*\|.*C=D.*\|.*\/\/$\|.*.nfo//" -e "/^$/d")
|
||||
else
|
||||
_LINES="$(curl "http://10.0.0.1:4447/$1" 2>/dev/null | sed -e "s|.*<a href=\"\([^\"]*\).*|$1\1|" -e "s/.*<.*\|.*C=D.*\|.*\/\/$\|.*.nfo//" -e "/^$/d")"
|
||||
fi
|
||||
|
||||
_RESULT=$(rofi -dmenu -i <<< "$_LINES")
|
||||
|
||||
# If no output
|
||||
echo "$_RESULT"
|
||||
if [[ -z $_RESULT ]]
|
||||
then
|
||||
echo "no output, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#if line end vith /
|
||||
if [[ "$_RESULT" =~ .*/$ ]]; then
|
||||
echo "output is a directory"
|
||||
./mpv.sh "$_RESULT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mpv "http://10.0.0.1:4447/$_RESULT"
|
||||
Reference in New Issue
Block a user