aboutsummaryrefslogtreecommitdiff
path: root/web/native-protocol/jellynative
blob: 1653e3fc6d82eb7597e1739f2a2e2fa95529912b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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