commit 4cd2da271a72e85621caac8ba35a86e3b644436a Author: konsthol Date: Fri Apr 29 03:05:10 2022 +0300 doh. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..891dc37 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 konsthol + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..96ae85a --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# tv.sh + +A small script to offer a selection menu of channels in ustvgo.tv using rofi (or dmenu if you change the code) and start playing in mpv. + +Intended for those who like the selection but don't necessarily want to add the m3u file to a program like vlc. + +You should first go get [ustvgo_to_m3u](https://github.com/benmoose39/ustvgo_to_m3u) which actually does everything for this to be useful and then change the path to the ustvgo.m3u file in the script + +## Installation + +``` +git clone https://git.konsthol.eu/konsthol/UsTvGo_Menu +cd UsTvGo_Menu +sudo cp tv.sh /usr/bin/ +(Or cp tv.sh anywhere in your $PATH) +``` + +## Usage + +Simply run ./tv.sh or even better assign it to run with a keybinding + +Also as benmoose39 says in his repo the playlist url changes every 4 hours so if you don't hate setting up cron jobs you should do the following + +``` +crontab -e (to open the cronjobs file) +0 */4 * * * ~/PATH_UP_TO/ustvgo_to_m3u/autorun.sh +``` + +If you want it to renew before 4 hours have passed or after, you can change the cron parameters according to [crontab.guru](https://crontab.guru/) + +## Dependencies + +* grep +* awk +* sed +* rofi (or dmenu) +* mpv +* tail +* notify-send (Optional) + +## Credits go to + +* [benmoose39](https://github.com/benmoose39) + +As this script uses his [ustvgo_to_m3u](https://github.com/benmoose39/ustvgo_to_m3u) script + +* [USTVGO](https://ustvgo.tv/) + +As they provide the channel streams + diff --git a/tv.sh b/tv.sh new file mode 100755 index 0000000..f7b1082 --- /dev/null +++ b/tv.sh @@ -0,0 +1,12 @@ +#!/bin/sh +channel="$(grep tvg-id ~/Gits/ustvgo_to_m3u/ustvgo.m3u | awk '{print $2}' | sed 's/[^"]*"\([^"]*\)".*/\1/' | rofi -dmenu -i -l 20 -p 'Channels')" + +if [[ -n $channel ]] +then + notify-send -t 2000 "Playing "$channel + mpv "$(grep "$channel" ~/Gits/ustvgo_to_m3u/ustvgo.m3u | tail -n 1)" +else + notify-send "Nothing was chosen" +fi + +