diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-09-23 17:09:50 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-09-23 17:09:50 +0100 |
commit | 28df0b5ad53e41cc0f328ded49a84a62580c72ed (patch) | |
tree | 7fc54869438734ef7a397580e07ba2da408d2e7f /Scripts | |
parent | 1f4b17312dd56eb4572f396e0d69ba158efe7ff2 (diff) | |
download | dotfiles-28df0b5ad53e41cc0f328ded49a84a62580c72ed.tar.gz dotfiles-28df0b5ad53e41cc0f328ded49a84a62580c72ed.tar.bz2 dotfiles-28df0b5ad53e41cc0f328ded49a84a62580c72ed.zip |
(Scripts)+localstream script
Uses the oldboy server, which may or may not be configured on YOUR
machine, to find playlists or video files to watch via MPV
Diffstat (limited to 'Scripts')
-rwxr-xr-x | Scripts/.local/scripts/localstream | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Scripts/.local/scripts/localstream b/Scripts/.local/scripts/localstream new file mode 100755 index 0000000..fece208 --- /dev/null +++ b/Scripts/.local/scripts/localstream @@ -0,0 +1,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'" && + 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 -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 |