Application for managing playlist files on a music player
|Latest on Hackage:||0.2|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
This is a utility for extracting the contents of an iTunes playlist
and copying the associated files to an external MP3 player. I've
tested this with a Sansa Clip running Rockbox, but any player that
mounts like a USB disk and uses a similar directory structure should
work. It assumes that playlists live in a folder called "Playlists"
in the root player directory and music files live in a folder called
"Music" in the root player directory. The Music folder can be (and is)
organized according to artist and album. It should be easy to change
the code to reflect a different directory structure. Patches to make
this configurable rather than requiring source modifications would be
The AppleScript contained in Applescript.hs does all the real work of
dumping the contents of an iTunes playlist to a file. This code is
adapter from Bery Rinaldo's "Export Playlist to M3U" script, found at:
Due to the use of AppleScript, I expect that this application is Mac-
only. But I would welcome patches to make it work on other platforms.
=== Installation ===
$ runhaskell Setup configure --configure-option=--music-player-root=/Volumes/SANSA\ CLIP \
$ runhaskell Setup build
$ sudo runhaskell Setup install
In place of "/Volumes/SANSA\ CLIP", substitute where your machine mounts your music player.
In place of /Users/tjc/converted, substitute a cache directory containing .mp3 files. If you
supply this config-time option and your playlist contains .m4a files, hplaylist will look
in the cache directory for a corresponding .mp3 files instead of in wherever iTunes claims
the file is. This is meant to support devices that can't play .m4a files. You can omit
the --m4a-dir option, but you must supply the --music-player-root option.
=== Usage ===
$ hplaylist "gym February 2011"
where the name in quotes is the name of an iTunes playlist. You can also do:
$ hplaylist --dry-run "gym February 2011"
and instead of copying files directly to your device, hplaylist will generate a
shell script that, when executed, copies all the files in the "gym February 2011"
playlist. For example, hplaylist might print out:
To copy the files, execute the script /var/folders/Ig/Ig9WMUQwHsWDznqEdIsAfU+++TI/-Tmp-/hplaylist_copyit5084
and then you could read the file /var/folders/Ig/Ig9WMUQwHsWDznqEdIsAfU+++TI/-Tmp-/hplaylist_copyit5084
before you execute it, to make sure everything looks OK.
==== Flags ====
--dry-run doesn't change any files on your device, but rather,
creates a shell script that can be executed to copy the files.
--quiet suppresses most output from hplaylist.
--keep-temp-files stops intermediate files from being
deleted (mostly for developers).
--temp-dir DIRECTORY attempts to store any files that are created
in DIRECTORY. By default, hplaylist uses the current directory.
=== Gotchas ===
hplaylist will not delete any existing files on your player. It also won't clobber
files with the same name that already exist. I usually just delete everything using
the Finder, and run hplaylist to set things up afresh.
=== Github page ===
=== Known issues ===
Filenames containing special characters do not currently get escaped correctly. Such files
get ignored. You'll have to rename your Moxy Früvous tracks or copy them by hand.
=== Further questions ===
Patches, bug reports: Tim Chevalier <email@example.com>