mpv-xwinwrap: Change return code, polish notifications a bit
I really should just move this whole damn thing into a Python script and be done with it
This commit is contained in:
parent
6a02fbf727
commit
164c58068c
@ -89,6 +89,15 @@ modules-left = i3 bspwm
|
|||||||
modules-center = xwindow
|
modules-center = xwindow
|
||||||
modules-right =
|
modules-right =
|
||||||
|
|
||||||
|
# TEST BARS
|
||||||
|
#====================
|
||||||
|
[bar/pico]
|
||||||
|
inherit = template/bar
|
||||||
|
|
||||||
|
modules-left = cpu
|
||||||
|
modules-center =
|
||||||
|
modules-right =
|
||||||
|
|
||||||
#========================================
|
#========================================
|
||||||
# MODULES
|
# MODULES
|
||||||
#========================================
|
#========================================
|
||||||
|
@ -33,7 +33,6 @@ fi
|
|||||||
cachecontent="$(cat $cachefile)"
|
cachecontent="$(cat $cachefile)"
|
||||||
|
|
||||||
function video-play {
|
function video-play {
|
||||||
notify-send -u low -t 10 -a 'MPV' "Embedded Video" "Playing $1 as a stream embedded in the desktop"
|
|
||||||
pkill -x xwinwrap
|
pkill -x xwinwrap
|
||||||
#xwinwrap -g 1920x1048+0+0 -ni -b -nf -o 0.5 -ov -- urxvt -bg rgba:2828/2828/2828/FFFF -embed WID -e cava
|
#xwinwrap -g 1920x1048+0+0 -ni -b -nf -o 0.5 -ov -- urxvt -bg rgba:2828/2828/2828/FFFF -embed WID -e cava
|
||||||
xwinwrap -ni -fs -b -nf -ov -- mpv -wid WID --title="Desktop Video" --loop-playlist=inf $1
|
xwinwrap -ni -fs -b -nf -ov -- mpv -wid WID --title="Desktop Video" --loop-playlist=inf $1
|
||||||
@ -49,7 +48,7 @@ function video-validate {
|
|||||||
|
|
||||||
function cache-add {
|
function cache-add {
|
||||||
if [[ "$cachecontent" == *"$1"* ]]; then
|
if [[ "$cachecontent" == *"$1"* ]]; then
|
||||||
return 0
|
return 1
|
||||||
fi
|
fi
|
||||||
name="$(youtube-dl -e $1)"
|
name="$(youtube-dl -e $1)"
|
||||||
printf "$name\n$1\n" >> $cachefile
|
printf "$name\n$1\n" >> $cachefile
|
||||||
@ -67,7 +66,7 @@ function cache-lookup-by-name {
|
|||||||
if [ "$url" = "" ]; then
|
if [ "$url" = "" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
printf "$url"
|
printf "$url\n"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +75,16 @@ function input-get {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function soft-notify {
|
||||||
|
notify-send -u low -t 3000 -a 'mpv-xwinwrap' "$1" "$2"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function hard-notify {
|
||||||
|
notify-send -u normal -t 10000 -a 'mpv-xwinwrap' "$1" "$2"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
input="$(input-get | tr -d '\n')"
|
input="$(input-get | tr -d '\n')"
|
||||||
if [ "$input" = "" ]; then
|
if [ "$input" = "" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
@ -84,16 +93,19 @@ fi
|
|||||||
printf "Input: $input\n"
|
printf "Input: $input\n"
|
||||||
|
|
||||||
if cache-lookup-by-name "$input"; then
|
if cache-lookup-by-name "$input"; then
|
||||||
printf "Lookup successful: "
|
printf "Lookup successful: \n"
|
||||||
input="$(cache-lookup-by-name "$input")"
|
input="$(cache-lookup-by-name "$input")"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! video-validate $input; then
|
if ! video-validate $input; then
|
||||||
|
hard-notify "Unable to Find Video" "Please verify that the URL is a valid YouTube address and try again."
|
||||||
printf "Not a valid stream: $input\n"
|
printf "Not a valid stream: $input\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
soft-notify "Found Video" "Video $1 has been found and is buffering. It will be embedded in the desktop shortly."
|
||||||
|
|
||||||
cache-add $input
|
cache-add $input
|
||||||
video-play $input
|
video-play $input
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user