aboutsummaryrefslogtreecommitdiff
path: root/Scripts/.local/scripts/localstream
blob: aa6b46f5e4d9a35e5919c5b29ff447746cfb2ed4 (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
35
#!/usr/bin/env sh

usage() {
    printf "Usage: localstream [-f|-p]
\t-f: Lookup video files
\t-p: Lookup playlists\n";
}

if [ $# -eq 0 ]
then
    usage && exit 1;
fi

case $1 in
    "-f")
        filtering="-name '*.mp4' -or -name '*.mkv' -or -name '*.webm' -or -name '*.opus'";
        selection="\(.*\)";;
    "-p")
        filtering="-name 'playlist'";
        selection="\(.*\)\/playlist";
        ending="/playlist";;
    *)
        usage && exit 1;;
esac

choice=$(ssh oreo@oldboy "find /media/hdd/content/ -type 'f' $filtering" |\
             sed "s/\/media\/hdd\/content\/$selection/\1/g" |\
             dmenu -i -l 5 -p "Choose file: ")

if [ $1 == "-f" ]
then
    mpv "sftp://oldboy:/media/hdd/content/$choice$ending"
else
    mpv --playlist="sftp://oldboy:/media/hdd/content/$choice$ending"
fi