From b8539e4b6bc0f65b84c490b048891092dea33ec8 Mon Sep 17 00:00:00 2001 From: ray Date: Tue, 27 Oct 2020 10:49:20 +0000 Subject: [PATCH] rewrite to use dmenu --- README.md | 13 +++---------- cams/czechia-prague-ai | 3 +-- cams/italy-syracuse-airport-south | 3 +-- cams/japan-nagasaki-airport | 3 +-- cams/launcher.sh | 7 ------- cams/mars | 3 +-- cams/romania-brasov-michael-weiss | 3 +-- cams/russia-yсть-kут | 3 +-- cams/thailand-koh-samui-tropical-murphys-bar | 3 +-- cams/usa-everett-smith-ave | 3 +-- launch | 13 +++++++++++++ new | 10 ---------- 12 files changed, 24 insertions(+), 43 deletions(-) delete mode 100755 cams/launcher.sh create mode 100755 launch delete mode 100755 new diff --git a/README.md b/README.md index 27ebda5..fa3800a 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,6 @@ -Create a stream launcher with: +## Usage -```sh -./new name url -``` +URL of cam to be saved in individual text files in `cams` directory. -Launch an mpv cam feed with: +Launch with `launch`. -```sh -./cam/name [max-quality] -``` - -Where `max-quality` is a height (e.g., `720` means a maximum quality of '720p'). diff --git a/cams/czechia-prague-ai b/cams/czechia-prague-ai index 372ada6..181af3a 100755 --- a/cams/czechia-prague-ai +++ b/cams/czechia-prague-ai @@ -1,2 +1 @@ -#!/bin/sh -"$(pwd)/cams/launcher.sh" "https://www.youtube.com/watch?v=Wi2h6BpRcns" "$1" +https://www.youtube.com/watch?v=Wi2h6BpRcns diff --git a/cams/italy-syracuse-airport-south b/cams/italy-syracuse-airport-south index 582a591..2ed6dd3 100755 --- a/cams/italy-syracuse-airport-south +++ b/cams/italy-syracuse-airport-south @@ -1,2 +1 @@ -#!/bin/sh -"$(pwd)/cams/launcher.sh" "https://www.youtube.com/watch?v=dSycFECDqME" "$1" +https://www.youtube.com/watch?v=dSycFECDqME diff --git a/cams/japan-nagasaki-airport b/cams/japan-nagasaki-airport index 6810c60..ebc99b8 100755 --- a/cams/japan-nagasaki-airport +++ b/cams/japan-nagasaki-airport @@ -1,2 +1 @@ -#!/bin/sh -"$(pwd)/cams/launcher.sh" "https://www.youtube.com/watch?v=Z591sNEtPgs" "$1" +https://www.youtube.com/watch?v=Z591sNEtPgs diff --git a/cams/launcher.sh b/cams/launcher.sh deleted file mode 100755 index 9ebba5f..0000000 --- a/cams/launcher.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -if [ -n "$2" ] ; then - _max_quality="$2" -else - _max_quality="480" -fi -bspc rule --add mpv --one-shot state=tiled && mpv --ytdl-raw-options=format='best[height<='"$_max_quality"']' "$1" & disown diff --git a/cams/mars b/cams/mars index d268e8a..fe6d367 100755 --- a/cams/mars +++ b/cams/mars @@ -1,2 +1 @@ -#!/bin/sh -"$(pwd)/cams/launcher.sh" "https://www.youtube.com/watch?v=6B_6K-splRU" "$1" +https://www.youtube.com/watch?v=6B_6K-splRU diff --git a/cams/romania-brasov-michael-weiss b/cams/romania-brasov-michael-weiss index 274d255..17f4a77 100755 --- a/cams/romania-brasov-michael-weiss +++ b/cams/romania-brasov-michael-weiss @@ -1,2 +1 @@ -#!/bin/sh -"$(pwd)/cams/launcher.sh" "https://www.youtube.com/watch?v=G05wmWFDtSo" "$1" +https://www.youtube.com/watch?v=G05wmWFDtSo diff --git a/cams/russia-yсть-kут b/cams/russia-yсть-kут index ea8738c..5e3a309 100755 --- a/cams/russia-yсть-kут +++ b/cams/russia-yсть-kут @@ -1,2 +1 @@ -#!/bin/sh -"$(pwd)/cams/launcher.sh" "https://www.youtube.com/watch?v=hO9Nkorupv4" "$1" +https://www.youtube.com/watch?v=hO9Nkorupv4 diff --git a/cams/thailand-koh-samui-tropical-murphys-bar b/cams/thailand-koh-samui-tropical-murphys-bar index b58a2b3..a1e7381 100755 --- a/cams/thailand-koh-samui-tropical-murphys-bar +++ b/cams/thailand-koh-samui-tropical-murphys-bar @@ -1,2 +1 @@ -#!/bin/sh -"$(pwd)/cams/launcher.sh" "https://www.youtube.com/watch?v=0Ns1sNoUSaY" "$1" +https://www.youtube.com/watch?v=0Ns1sNoUSaY diff --git a/cams/usa-everett-smith-ave b/cams/usa-everett-smith-ave index 39282f6..c7e9ceb 100755 --- a/cams/usa-everett-smith-ave +++ b/cams/usa-everett-smith-ave @@ -1,2 +1 @@ -#!/bin/sh -"$(pwd)/cams/launcher.sh" "https://www.youtube.com/watch?v=neo1hRZTO0s" "$1" +https://www.youtube.com/watch?v=neo1hRZTO0s diff --git a/launch b/launch new file mode 100755 index 0000000..a50f0fa --- /dev/null +++ b/launch @@ -0,0 +1,13 @@ +#!/bin/sh + +_cam_dir='/home/ray/mpv-cam-views/' + +_qualities="360\n480\n720\n1080" + +_file="$(ls cams | dmenu)" +_url="$(cat cams/$_file)" +_quality="$(echo -e $_qualities | dmenu)" + +echo "Playing '$_file' at $_quality ($_url)" + +bspc rule --add mpv --one-shot state=tiled && mpv --ytdl-raw-options=format='best[height<='"$_quality"']' "$_url" diff --git a/new b/new deleted file mode 100755 index f2ea64e..0000000 --- a/new +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -_cam_directory='cams' -mkdir -p "$_cam_directory" - -echo '#!/bin/sh' >> "$_cam_directory/$1" -# FIXME fails when run from parent directory (see mars for poss solution) -echo '"$(pwd)"'"/cams/launcher.sh \"$2\" "'"$1"' >> "$_cam_directory/$1" -chmod +x "$_cam_directory/$1" -