aboutsummaryrefslogtreecommitdiff
path: root/web/native-protocol/jellynative
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-30 14:21:12 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-30 14:21:12 +0100
commit81326d9178a04814c0c8ed669bdf2f19fc865fbe (patch)
treed5a884ddbae185dd9404c0497a26031a304f9fd7 /web/native-protocol/jellynative
parent0010717b6e86bb662fa04dab94968eee6fe8de64 (diff)
downloadjellything-81326d9178a04814c0c8ed669bdf2f19fc865fbe.tar
jellything-81326d9178a04814c0c8ed669bdf2f19fc865fbe.tar.bz2
jellything-81326d9178a04814c0c8ed669bdf2f19fc865fbe.tar.zst
add protocol handler scripts
Diffstat (limited to 'web/native-protocol/jellynative')
-rwxr-xr-xweb/native-protocol/jellynative34
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