Skip to content

Instantly share code, notes, and snippets.

@flxai
Created October 28, 2021 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flxai/5de32f0c0b657a6acac82751f1cc84ec to your computer and use it in GitHub Desktop.
Save flxai/5de32f0c0b657a6acac82751f1cc84ec to your computer and use it in GitHub Desktop.
c3sets.de client in bash using mpv and git

c3sets.de in bash

Install git and mpv, place somewhere and execute. It gives a menu like the following that allows you to select the set:

1) [15 Jahre Chaosdorf] Couchsofa - Spaaaaaace                          79) [gpn17] Morelle
2) [18 Jahre Chaosdorf] vidister - Topfschlagen an der Tschunkbar       80) [gpn17] Rio
3) [20 Jahre Chaosdorf] Couchsofa - Der Gute Stoff Muss Brennbar Sein   81) [gpn17] Tasmo
4) [20 Jahre Entropia] Couchsofa - Peleus and Thetis                    82) [gpn18] Alexeyan - I Made the Nerds Dance
5) [29c3] Tasmo - Poppen Pt2                                            83) [gpn18] Bam - Deployment Day
6) [30c3] Ratkat - Mad Max Mix                                          84) [gpn18] Couchsofa - Die Magische Spielfeuermaschine
7) [31c3] BarbNerdy - Antierror Lounge                                  85) [gpn18] Couchsofa - Diskordianische Lesung
8) [31c3] BarbNerdy - D&B/Footwork Mix                                  86) [gpn18] DJ Spock
9) [32c3] BarbNerdy - Antierror Lounge                                  87) [gpn18] dnc
10) [32c3] Couchsofa - Le Reve Et La Realite                             88) [gpn18] Faheus - Dantespokenhere
[...]
#?

You can quit mpv using either q or Ctrl + C to select another set.

#!/usr/bin/env bash
# Clones data for https://www.c3sets.de/ and present a CLI to select and stream sets
repo_dir=/tmp/c3sets
echo "Caching sets... Please accept host if asked..."
[[ -d "$repo_dir" ]] || git clone --depth 1 "https://chaos.expert/psy/c3sets.de.git" "$repo_dir"
IFS=\n mapfile -t titles < <(grep -hE '^title' "$repo_dir/content/set/"*.md | cut -d" " -f2- | sed 's/"//g' | sort)
while :; do
select title in "${titles[@]}"; do
echo "Selected $title"
fn=$(grep -Fl "$title" $repo_dir/content/set/*.md)
urls=$(grep -E 'https?://' "$fn" | tr '\n' ' ')
echo "Streaming $urls"
mpv --no-video $urls
break
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment