Jump Start
Introduction
What's the Jump Start?
While writing this tutorial, I realized just how boring it must be to read. I decided to use a different approach. This version of the tutorial jumps straight to writing a program that does a lot with little code. This program will do that using various libraries I and others have written. The tutorial will then go on to explain in greater detail the code of the program, using the original tutorial as a reference.
In the second section we will rewrite the libraries I've written for the program.
The Program
Imagine you and someone else are sharing the same MP3 collection. Both of you add files to the collection and to your playlist. From time to time you want to look at the files that the other one added. There's really no proper way to do this. File modification dates offer a clue, but just changing a file tag updates that too. And if you have the MP3s spread over various directories it will hardly work at all. At least not in a satisfying way. Then comes the problem that you and the other don't share exactly the same musical taste, so there are files you want and files you don't want. You have to sort them. That's not too hard. The annoying thing is that you can't simply delete the files you don't like.
Now imagine your playlist gets lost in a freak accident involving three confused aliens and lots of jam. You have to again find the files you want out of possibly thousands of files. It's a lot of work.
I actually had these problems a few years ago, when I was sharing the MP3 collection with my brother. I frequently lost my playlist in parts because I added files to the temporary Winamp list and forgot to save it, then deleted the entire list by loading a different list or file into Winamp.
This problem and several others will hopefully be solved by this program I want to write. Managing playlists, completing and reading file tags, adding new files, removing files, banning files completly and other things are handled by this program. I might even addaudio playback at some point.
The program will be programmed in a platform-independent way. It should work on Windows, Linux and maybe even MacOS (we'll see).
Program Structure
The program will be centered around one library, libm3u. A library is a repository for reusable code. There are several reasons why it should be a library.
- Only a library allows the approach this tutorial takes.
- GUI (Graphical User Interface) is advanced programming. The initial program will be a console application. Due to the use of a library we can later write a GUI program that offers the same functionality without rewriting a single line of code that doesn't need to be rewritten.
Libraries
Beside libm3u, the program will use several other libraries. The most important are the C++ Standard Library and the Boost Class Libraries. Credit will be given here to all other libraries and their authors.
The Standard C++ Library
The SC++L is a large set of classes that offer basic and not-so-basic services to C++ programmers. The C++ standard requires that this library is included with every C++ compiler.
The SC++L contains classes for input and output, data containers, algorithms to work on them, localization helper classes and much more. Many components follow abstract concepts that allow them to be combined to form truly amazing blocks of code.
The Boost Class Libraries
http://www.boost.org/The Boost web site provides free peer-reviewed portable C++ source libraries. The emphasis is on libraries which work well with the C++ Standard Library. One goal is to establish "existing practice" and provide reference implementations so that the Boost libraries are suitable for eventual standardization. Some of the libraries have already been proposed for inclusion in the C++ Standards Committee's upcoming C++ Standard Library Technical Report.
Or, as I would rather put it: most you'll ever need for programming.
Boost is an even larger set of classes than the SC++L. Parts of it extend on the SC++L, providing similar features as those already existing. Other parts provide completly different things, like the regular expression library. A must-have for every serious C++ programmer.
id3lib
http://www.id3lib.org/id3lib is an open-source, cross-platform software development library for reading, writing, and manipulating ID3v1 and ID3v2 tags. It is an on-going project whose primary goals are full compliance with the ID3v2 standard, portability across several platforms, and providing a powerful and feature-rich API with a highly stable and efficient implementation.
I will very likely use id3lib for the MP3 tag handling.
Prerequisites
For this tutorial, you need to know a few things about computers.
- You should have a good working knowledge with computers. You should be able to install and uninstall software and change various OS settings. While this is not directly necessary for this tutorial, it's about the knowledge you should have.
- You should know how to use the command line of your operating system. You should know basic commands there, like how to list the files in a directory.
- You should have read the theory part of the tutorial.