Fandom

Music Player Daemon Community Wiki

Hack:itunes2mpd

525pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

itunes2mpd is a single line of awk designed to load an iTunes playlist. It's not very practical for constant usage, but might be useful if there's a big playlist or two that took you ages to fine-tune that you don't feel like adding line-by-line into mpd. It does this by searching for the song via name and then via track number (just in case there's another album in your collection with said number).

Needed Programs (on top of MPD):

  • mpc
  • awk
  • cat

I don't think there's a *nix in existence without the latter two ;)

Steps:

  • Set your playlist's columns so that the first column is the song's name and the second column is the track number. (You can arrange any other columns as you like).
  • Highlight the entire playlist (Ctrl+A in Windows)
  • Copy it (Ctrl+C)
  • Paste it into a text file on the MPD computer. Say, playlist.txt. Add one blank line at the start (some strange bug with cat reads tabs wrong on the first line)
  • Run the script:
sh itunes2mpd playlist.txt

Obviously, you can avoid typing sh by chmod +x'ing it, and tossing it into a folder in your $PATH.

KEEP IN MIND THIS WILL CLEAR YOUR CURRENT MPD PLAYLIST

Source code Edit

mpc clear; 
cat $1 | awk '{FS = "\t" ;gsub(/"/,"\\\"",$1);sub(/ of.*/,"",$2); print "mpc findadd title \"" $1"\"" " track "  $2}' | sh ; 
mpc play

Also on Fandom

Random Wiki