diff options
Diffstat (limited to 'web/native-protocol/jellynative')
-rwxr-xr-x | web/native-protocol/jellynative | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/web/native-protocol/jellynative b/web/native-protocol/jellynative index e1b310c..8694272 100755 --- a/web/native-protocol/jellynative +++ b/web/native-protocol/jellynative @@ -4,9 +4,6 @@ set protocol $parts[1] set action $parts[3] set secret $parts[4] -if not test $protocol = "jellynative:" - die "Wrong protocol" -end function die notify-send -u critical -t 5000 'Jellynative Error' $argv[1] @@ -14,26 +11,23 @@ function die 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] + if not mpv --http-header-fields=(echo -s 'Cookie: session=' $argv[1]) $argv[3..] $argv[2] die 'Player exited with error code' end end +if not test $protocol = "jellynative:" + die "Wrong protocol" +end + set config_dir $XDG_CONFIG_HOME if test -z $config set config_dir ~/.config end set config $config_dir/jellynative_secret if not test -e $config - random 0 4000000000 >$config + head -c 16 /dev/urandom | xxd -p >$config end set secret (cat $config) @@ -47,9 +41,9 @@ switch $action case show-secret notify-send -u low Jellynative "Secret: $secret" case player - player (string join / $parts[5..]) + player $parts[5] (string join / $parts[6..]) case player-fullscreen - player (string join / $parts[5..]) --fullscreen + player $parts[5] (string join / $parts[6..]) --fullscreen case '*' die 'Unknown action' end |