[ fromfile: homework/playlists.xml id: playlists ]
In this assignment, we define some data types and some means to load and save playlists in m3u format.
M3u files are quite simple; they consist of one URL per line, which may be a relative path to a local track on disk. Optional extended information and comments appear after a # on the preceding line.
The preceding assignment started with an example media player program that you enhanced. Now you add some load/save playlist actions to that program.
The Phonon library has no code for handling M3u files, so you need to write serialization code yourself. The Qt Mobility example has a QMediaPlaylist->load()
method that can load M3u files.
Some example code for loading and saving m3u files to disk is provided in src/handouts.
Feel free to reuse that code.
The MetaDataLoader classes used in our code come from dist. There are three versions available, one that uses Phonon
, one that uses Taglib
, and another that uses Qt Mobility. You can choose one based on what works best on your platform. All three work on Linux. At press time, neither Phonon nor Mobility could read ID3 tags of MP3s on Windows, which is why we also offer a Taglib implementation.
This link has information to help you determine which tag is used to store song ratings by other popular MP3 players, if you want to make your player compatible with another one you use.
Write some test cases using QtTestLib to verify that you can read and write playlists.
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |