diff options
author | metamuffin <metamuffin@disroot.org> | 2024-01-31 23:15:22 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-01-31 23:15:22 +0100 |
commit | c4362adc4af0c4dcdbb2346a9e077bdf580d8007 (patch) | |
tree | 0500be10f312714973338969c50dd8319d839965 /web/native-protocol/jellynative | |
parent | 39a4b10789ff9f97ddc3de7d55bc845cabaac333 (diff) | |
download | jellything-c4362adc4af0c4dcdbb2346a9e077bdf580d8007.tar jellything-c4362adc4af0c4dcdbb2346a9e077bdf580d8007.tar.bz2 jellything-c4362adc4af0c4dcdbb2346a9e077bdf580d8007.tar.zst |
fix native player
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 |