Recent changes Random page
GAMING
Technology
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
See more...

Hack:di.fm-playlists

From Music Player Daemon Community Wiki

Jump to: navigation, search

This tiniy script downloads all playlists from www.di.fm, converts them from .pls to .m3u and places them in you MPD-playlists directory. it is free to be modified/extended. but if you do so, please update the version is this wiki, too.

Usage:

  • execute this script
  • execute `mpd lsplaylists` to see what you've got :)

have fun with it, DocFX <docfx at softeys dot de>

#!/bin/bash

TMP_HTML="/tmp/html.txt"
TMP_PLSNAMES="/tmp/plsnames.txt"
TMP_PLSDIR="/tmp/pls/"
MPC_PLSDIR="/var/lib/mpd/playlists/"

wget www.di.fm -O ${TMP_HTML}
grep -ioe "[0-9a-z/\.:]*\\.pls" ${TMP_HTML} |\
  grep -v aacplus| \
  sed s/^\\//http:\\/\\/di.fm\\// > ${TMP_PLSNAMES}

mkdir ${TMP_PLSDIR}
wget -i ${TMP_PLSNAMES} -P ${TMP_PLSDIR}

for pls in `ls ${TMP_PLSDIR}`; do
  out="${MPC_PLSDIR}di.fm-${pls/pls/m3u}"
  cat ${TMP_PLSDIR}${pls}| \
    grep File[0-9]*| \
    sed s/^File[0-9]=// > ${out}
  chown mpd:audio ${out}
done

rm -r ${TMP_PLSDIR}
rm ${TMP_PLSNAMES}
rm ${TMP_HTML}
Rate this article:
Share this article: