Creating cue playlists for a list of mp3 files from a folder
Very often, after downloading controversial music from torrents, I see that the author of the distribution either did not register the tags in mp3, or did not register them correctly. If I fix these mp3-files and write normal tags in them, then I will not be able to sit just downloaded. Which is not very good. On the other hand, I collect my music statistics in last.fm and I want to keep the tags up to date. There is, of course, the option to copy the music you just downloaded to a separate place and fix the tags there, but it's somehow unsportsmanlike.
The first ten times I created a cue playlist manually, but then I remembered that I still had to do with programming and wrote a small Perl script that creates a cue playlist from the list of mp3 files. Now you can change information about the artist, album, song names in it, without physically touching mp3-shki. These playlists are readily readable by foobar.
The script has one parameter: pattern - the code that is executed for each file. In this code fragment, the variables $ track, $ title and $ performer should be set - this is the track number, song name and artist, respectively.
For example, for file names like “22. Baby I Need Your Loving - Four Tops.mp3 »script should be called like this:
perl c: \ util \ playlist_cue.pl "--pattern = ($ track, $ title, $ performer) = $ f = ~ / (\ d \ d) \. (. +) - (. +) \. mp3 /; " >> playlist.cue
It is believed that the playlist.cue file already contains album information.
The first ten times I created a cue playlist manually, but then I remembered that I still had to do with programming and wrote a small Perl script that creates a cue playlist from the list of mp3 files. Now you can change information about the artist, album, song names in it, without physically touching mp3-shki. These playlists are readily readable by foobar.
The script has one parameter: pattern - the code that is executed for each file. In this code fragment, the variables $ track, $ title and $ performer should be set - this is the track number, song name and artist, respectively.
For example, for file names like “22. Baby I Need Your Loving - Four Tops.mp3 »script should be called like this:
perl c: \ util \ playlist_cue.pl "--pattern = ($ track, $ title, $ performer) = $ f = ~ / (\ d \ d) \. (. +) - (. +) \. mp3 /; " >> playlist.cue
It is believed that the playlist.cue file already contains album information.
use strict;
use warnings;
use Getopt :: Long;
my ($ track, $ performer, $ title);
my $ pattern = '($ track, $ title) = $ f = ~ / (\ d *) - (. +) \. mp3 /';
GetOptions ("pattern = s" => \ $ pattern);
for my $ f (<*. mp3>) {
eval ($ pattern);
print <
As a result of the script, it turns out something like (the header was written manually):
REM GENRE Motown
REM DATE 1992
PERFORMER "Various Artists"
TITLE "Hitsville USA: The Motown Singles Collection 1959-1971 (disc 1)"
FILE "01. Money (That's What I Want) - Barrett Strong.mp3" MP3
TRACK 01 AUDIO
TITLE "Money (That's What I Want)"
PERFORMER "Barrett Strong"
INDEX 01 00:00:00
FILE "02. Shop Around - The Miracles.mp3" MP3
TRACK 02 AUDIO
TITLE "Shop Around"
PERFORMER "The Miracles"
INDEX 01 00:00:00
FILE "03. Please Mr. Postman - The Marvelettes.mp3" MP3
TRACK 03 AUDIO
TITLE "Please Mr. Postman"
PERFORMER "The Marvelettes"
INDEX 01 00:00:00
FILE "04. Jamie - Eddie Holland.mp3" MP3
TRACK 04 AUDIO
TITLE "Jamie"
PERFORMER "Eddie Holland"
INDEX 01 00:00:00
Now the names of tracks and artists can be corrected without affecting the original mp3-shki.
In this way, you can leave on distribution even those mp3 files whose tags do not suit you.
Corrections, comments and normal simple solutions to the problem are welcome.