#!/usr/bin/env bash DOCKER_IMAGE=magnetikonline/acestream-server:3.1.49_debian_8.11 PORT=6878 select_channel() { channel_list=( "Gol TV" "Gol 2 TV" "beIN Sports 1 France" "BBC One" ) channel=$(printf '%s\n' "${channel_list[@]}" | rofi -no-auto-select -i "$@" -dmenu -p "Choose a channel") channel_selection "$channel" } streaming_server() { if [ "$1" = "start" ]; then echo "Spinning up the server" docker run --publish "$PORT:$PORT" --name acestream-server --rm --tmpfs "/dev/disk/by-id:noexec,rw,size=4k" \ --tmpfs "/root/ACEStream:noexec,rw,size=4096m" \ "$DOCKER_IMAGE" >/dev/null 2>&1 echo "Server started" else echo "Stopping the server" docker stop acestream-server >/dev/null 2>&1 echo "Server stopped" fi } stream_channel() { echo "Starting the stream" nix-shell -p vlc --run "$HOME/.local/share/scripts/playstream.py --ace-stream-pid $1 --player '$(whereis vlc | cut -d ":" -f 2)'" } channel_selection() { echo "Selection time" case "$1" in "Gol ") stream_channel "dfffbcdd9c7e32d5dc88d268dee830ff2a0d3ab6" ;; "Gol 2") stream_channel "2aab272d05089ce881538a1b3288d391de152d53" ;; "beIN Sports 1 France") stream channel "bba1905fcd1c4975aec544047bf8e4cd23ce3fe0" ;; "BBC One") stream channel "243eaccd38b9a0c43b800b6c7a30b1ad2cadc1f1" ;; esac } streaming_server "start" select_channel "$@" streaming_server "stop"