From 9b3066453bdb1740ca1f1acd07e2293547a07d59 Mon Sep 17 00:00:00 2001 From: odweta Date: Mon, 26 Oct 2026 11:44:44 +0100 Subject: [PATCH] initial commit --- Makefile | 10 ++++++++++ README.md | 7 +++++++ muni-streamer.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100755 muni-streamer.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..74601e5 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +MS_BIN:="$(HOME)/.local/bin" +MS_NAME:="muni-streamer" +MS_CONFIG:="$(HOME)/.config/$(MS_NAME)" + +install: + mkdir -p $(MS_BIN) + mkdir -p $(MS_CONFIG) + cp $(MS_NAME).sh $(MS_BIN)/$(MS_NAME) + chmod 744 $(MS_BIN)/$(MS_NAME) + touch $(MS_CONFIG)/streams.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..c96f190 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# A tool for playing MUNI streams hosted on cesnet via mpv on linux + +install with `make install` + +you will need to put streams into streams.txt at $(MS_CONFIG) ($HOME/.config/muni-streamer by default) with html urls (one on each line) + + <url>, e.g. `SUBJECT https://live.cesnet.cz/xyz.html` diff --git a/muni-streamer.sh b/muni-streamer.sh new file mode 100755 index 0000000..f420ab1 --- /dev/null +++ b/muni-streamer.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +# Gruvbox +col_gray1="#1d2021" +col_gray2="#504945" +col_gray3="#ebdbb2" +col_gray4="#ebdbb2" +col_main="#3c3836" + +# Font +font="JetBrainsMono Nerd Font Propo:size=14" + +# Prompt +prompt="Select a stream to watch:" + +# Dimentions +rows=10 +cols=1 + +MS_BIN="$HOME/.local/bin" +MS_NAME="muni-streamer" +MS_CONFIG="$HOME/.config/$MS_NAME" + +declare -A items + +while IFS= read -r line; do + [[ -z "$line" ]] && continue + read -r key val <<< "$line" + items["$key"]="$val" +done < $MS_CONFIG/streams.txt + + +DMENU_OPTS=( + -l "$rows" -g "$cols" + -nb "$col_gray1" -nf "$col_gray3" + -sb "$col_main" -sf "$col_gray4" + -fn "$font" -p "$prompt" +) + +choice=$( + for key in "${!items[@]}"; do + printf '%s - %s\n' "$key" "${items[$key]}" + done | dmenu "${DMENU_OPTS[@]}" +) + +[ "$choice" != "" ] && mpv ${choice#* -}