Linux MP3 ID3 Tag Sorting Script
Posted by: barkered in C++, Linux, Projects, Source Code, TechnicalThis is old code and quite a ‘hack’. It worked for my purposes so development unfortunately stopped after the task was completed.
On my linux server I had a directory of unsorted music files. I like my music to be organised by folders, for example:
%artist%\%album%\*.mp3 – Death\Scream Bloody Gore\
So I began writing a simple C++ program to read the artist and album tags from the files, create and move the files into the correct structure.
This is a relatively simple task and I know C++ is not the best choice of language but I thought I would continue and see how the development of C++ within Linux would fair. Mainly from a libraries point of view and an IDE.
Trying to find an IDE which would do code auto completion was a task which proved difficult. KDevelop seemed bloated and unusable. I settled on using a simple code editor called codeblocks. Simple, effective and easy to use.
Next task was to either write a library to read tags from the files or find a suitable library.
http://developer.kde.org/~wheeler/taglib.html
Was my choice, a simple generic interface for multiple music files. Quite nice.
So I set about writing the file, here are my results:
The archive contains 3 files, the .cpp file, a simple Readme file and an sh build command.
To build the mp3_sorter.cpp might require you to change the include paths at the top of the file.
Below is the command used to build, note the taglib-config part, it automatically adds the includes and linker options for taglib.
g++ mp3_sorter.cpp -Wno-deprecated `taglib-config –cflags –libs` -o mp3_sorter
Tags: C++, ID3, Linux, MP3, Script, Sorting, Source
Entries (RSS)