Created
May 2, 2020 18:59
-
-
Save SydLambert/e15622c7ef9f30ee27b02a29172bcfbc to your computer and use it in GitHub Desktop.
Add all channels on Soma FM to MPD as individual playlists. Requires mpc and GNU grep. Will empty playlist before starting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
mpc clear | |
curl -s https://somafm.com/channels.xml | grep -Po '((?<=<title><!\[CDATA\[).+?(?=\])|(?<=id=").+?(?="))' | sed 'N;s/\n/ /' | while read -r p; do | |
curl -s "https://somafm.com/$(echo "$p" | grep -Po '^.+?(?= )')130.pls" | grep -Po '(?<=File\d=).+$' | head -n 1 | xargs mpc add; | |
mpc save "Soma FM - $(echo "$p" | grep -Po '(?<= ).+$')" | |
mpc clear | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment