aboutsummaryrefslogtreecommitdiff
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
parent0010717b6e86bb662fa04dab94968eee6fe8de64 (diff)
downloadjellything-81326d9178a04814c0c8ed669bdf2f19fc865fbe.tar
jellything-81326d9178a04814c0c8ed669bdf2f19fc865fbe.tar.bz2
jellything-81326d9178a04814c0c8ed669bdf2f19fc865fbe.tar.zst
add protocol handler scripts
-rwxr-xr-xweb/native-protocol/install5
-rwxr-xr-xweb/native-protocol/jellynative34
-rw-r--r--web/native-protocol/jellynative.desktop6
3 files changed, 45 insertions, 0 deletions
diff --git a/web/native-protocol/install b/web/native-protocol/install
new file mode 100755
index 0000000..f197b01
--- /dev/null
+++ b/web/native-protocol/install
@@ -0,0 +1,5 @@
+#!/bin/fish
+install -Dm750 jellynative ~/.local/bin/jellynative
+install -Dm640 jellynative.desktop ~/.local/share/applications/jellynative.desktop
+update-desktop-database ~/.local/share/applications
+echo 'In firefox about:config set network.protocol-handler.expose.jellynative to true'
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
diff --git a/web/native-protocol/jellynative.desktop b/web/native-protocol/jellynative.desktop
new file mode 100644
index 0000000..f5de8c1
--- /dev/null
+++ b/web/native-protocol/jellynative.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Type=Application
+Name=Jellything Protocol Handler
+Exec=jellynative %u
+StartupNotify=false
+MimeType=x-scheme-handler/jellynative