diff options
Diffstat (limited to 'web/native-protocol/jellynative')
-rwxr-xr-x | web/native-protocol/jellynative | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/web/native-protocol/jellynative b/web/native-protocol/jellynative new file mode 100755 index 0000000..1653e3f --- /dev/null +++ b/web/native-protocol/jellynative @@ -0,0 +1,34 @@ +#!/bin/fish +set parts (string split / $argv[1]) +set protocol $parts[1] +set action $parts[3] +set arg (string join / $parts[4..]) + +function die + notify-send -u critical 'Jellynative Error' $argv[1] + exit 1 +end +if not test $protocol = "jellynative:" + die "Wrong protocol" +end +function player + if which mpv &>/dev/null + set playercommand mpv + else if which vlc &>/dev/null + set playercommand vlc + else + die "No Media Player detected" + end + notify-send -u low -t 1000 Jellynative 'Player ist launching...' + if not $playercommand $argv[2..] $argv[1] + die "Player exited with error code" + end +end +switch $action + case player + player $arg + case player-fullscreen + player $arg --fullscreen + case '*' + die "Unknown action" +end |