Reusing id3lib

Each MP3 file contains meta-data called "ID3 tags" that can be accessed and manipulated through low-level file operations, or via a higher-level interface. We saw two interfaces for using the library in Section 16.3. For this exercise, we have provided you with classes from three libraries (http://oop.mcs.suffolk.edu/dist) and you are to write a program that reuses them all.

  • Reusing libraries (Chapter 7)
  • Visitor pattern (Section 8.1)
  • Command line arguments (Section 6.7.1)
  • id3lib (Section 16.3)
  • playgen (Section 25.2)


ID3 tags enable you to read and store meta-information about MP3 songs in a special part of the MP3 file itself. To manipulate MP3 files as though they were C++ objects, getting and setting properties that persist in the ID3 tags, we reuse an ID3 library. You will be provided with a FileTagger class that depends on id3lib, but implements the Mp3Song interface.

Check out some of the executables that come with id3lib: id3info, id3convert, id3tag, id3cp. They all have man pages.


The Assignment

1.

Install id3lib.

2.

Build filetagger.cpp with TestFileTagger.cpp and run it on a folder with some junk MP3 files that you do not care about. Verify that the test case passes.

3.

Enhance the playgen program so that its output playlist includes ID3 tag information in the playlist.

playgen [directory]
playgen [file1.mp3] [file2.mp3] ...


playgen generates a playlist of all MP3 files in the directory, or of all MP3 files supplied on the list of command line arguments. It should read the id3tag information from each file it visits and display each song in the format shown in Example 25.4.

Example 25.4. filetagger-examplefiles/test-winamp-playlist.m3u

#EXTM3U
#EXTINF:134,Tom Lehrer - Vatican Rag
Tom LehrerYearThatWas14_Vatican Rag_Tom Lehrer.mp3
#EXTINF:131,Tom Lehrer - Folk Song Army
Tom LehrerYearThatWas4_Folk Song Army_Tom Lehrer.mp3
#EXTINF:155,Tom Lehrer - National Brotherhood Week
Tom LehrerYearThatWas1_National Brotherhood Week_Tom Lehrer.mp3

It is suggested you use ArgumentList to process command line options, and FileVisitor to visit each file.



Part I: Introduction to C++ and Qt 4

C++ Introduction

Classes

Introduction to Qt

Lists

Functions

Inheritance and Polymorphism

Part II: Higher-Level Programming

Libraries

Introduction to Design Patterns

QObject

Generics and Containers

Qt GUI Widgets

Concurrency

Validation and Regular Expressions

Parsing XML

Meta Objects, Properties, and Reflective Programming

More Design Patterns

Models and Views

Qt SQL Classes

Part III: C++ Language Reference

Types and Expressions

Scope and Storage Class

Statements and Control Structures

Memory Access

Chapter Summary

Inheritance in Detail

Miscellaneous Topics

Part IV: Programming Assignments

MP3 Jukebox Assignments

Part V: Appendices

MP3 Jukebox Assignments

Bibliography

MP3 Jukebox Assignments



An Introduction to Design Patterns in C++ with Qt 4
An Introduction to Design Patterns in C++ with Qt 4
ISBN: 0131879057
EAN: 2147483647
Year: 2004
Pages: 268

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net