aboutsummaryrefslogtreecommitdiff
path: root/local/mpd_playlist.sh
blob: a82b9615eff848bcc401af5cfe17843284b2d367 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Update the mpd playlist from RSS fields

playlist_directory="/home/playlists"

update_playlist () {
    mpc clear
    mpc load $2
    echo "#EXTM3U" > "${playlist_directory}/Podcast - $1.m3u"
    mpc -f "##EXTINF:0,%title%\n%file%" playlist >> "${playlist_directory}/Podcast - $1.m3u"
    mpc clear
}

case $(mpc status "%state%") in
    stopped|paused)
        update_playlist "Transe fip Express" "https://radiofrance-podcast.net/podcast09/rss_23649.xml"
        update_playlist "Fip Tape" "https://radiofrance-podcast.net/podcast09/rss_24684.xml"
        update_playlist "Live à Fip" "https://radiofrance-podcast.net/podcast09/rss_13416.xml"
        ;;
    *)
esac