Batch script for lrc2sylt on Linux

Posted by: TheAmigo

Batch script for lrc2sylt on Linux - 22/02/2003 18:03

Here's a perl script I hacked together. You give it a directory of .lrc files, tell it where your mp3s are and it will run lrc2sylt for all the files with matching names.

It will search recursively through both the dir you specify for .lrcs and the dir you specify for .mp3s, looking for matches. There are a couple option that are described by running:
lyrictagger -h


It's written for Linux (other unicies are probably fine) but if anyone wants to port it to windows, have at it. It also requires ynot_'s lrc2sylt prog.
Posted by: tonyc

Re: Batch script for lrc2sylt on Linux - 22/02/2003 18:16

Cool. I'm going to have a new lrctool coming out for both Windows and Linux, I'm sure a small change to the script will support lrctool's syntax as well. Though one option I'm adding to lrctool is the ability to auto-name the LRC files based on lrcdb's syntax, and I don't think anyone's going to have their MP3 filenames in that particular syntax. So that'd kinda break the script, which I'm assuming requires the filenames to be exactly the same, save the extensions.

Ideally lrctool would have some neato way for users to configure patterns for their MP3 filenames and the LRC filenames. That'd probably be easy to do in Perl with regex matching. Though providing a facility to match files when the MP3's are in hierarchical folders (as I'm sure most of ours are) might be a bit of a mess.

Hmmm.
Posted by: TheAmigo

Re: Batch script for lrc2sylt on Linux - 22/02/2003 18:29

I'm assuming requires the filenames to be exactly the same, save the extensions.
Yes, that's currently a requirement. As things change, we can come up with a new way to match them up.

hough providing a facility to match files when the MP3's are in hierarchical folders (as I'm sure most of ours are) might be a bit of a mess.
Already planned for that. Starting on the premise that most mp3s have unique names, it first builds a hash of all .mp3s that find finds. By default, if there are two .mp3s in different sub dirs that have the same name, lyrictagger won't run lrc2sylt on either one. There's a -m option that will tell it to put the lyrics in all files that have that name.

If there's a standard way, I could also have it check for the mp3 to be the same name as [artist] - [title] or some such by reading a bit of the .lrc. But is that in the .lrc?
Posted by: tonyc

Re: Batch script for lrc2sylt on Linux - 22/02/2003 18:36

But is that in the .lrc?

There's no particular standard for that stuff being in the file. I think one of the Winamp plugins automatically adds fields like this:
ar: Pearl Jam
ti: Once

But having to open each LRC file is probably wasteful just to get that info. It'd be better if it were in the filename, and you provided a facility to match LRC and MP3 files that aren't necessarily named the same. It'd be better to have in lrctool, but this kind of stuff is much easier to do with Perl.
Posted by: TheAmigo

Re: Batch script for lrc2sylt on Linux - 22/02/2003 18:44

It'd be better if it were in the filename, and you provided a facility to match LRC and MP3 files that aren't necessarily named the same.

Do you mean something like matching these:
/lyrics/823A45F9-BelindaCarlisle-HeavenIsAPlaceOnEarth.lrc
/Music/80's/Belinda Carlisle - Heaven Is A Place On Earth.mp3

that shouldn't be hard.
Posted by: tonyc

Re: Batch script for lrc2sylt on Linux - 22/02/2003 18:49

Something like that, yeah. Just let the user specify the LRC and MP3 filename patterns. You'd probably need to provide a facility (maybe just by letting the user specify a .* in a regular expression) for certain fields/characters to be skipped over, like in your example, that hexidecimal prefix, or like when the MP3 file has extraneous fields that the LRC filenames don't, or vice versa. I guess it could get kinda complex, but if the end user has a good command of regular expressions (assuming that's how the logic works) then it might not be a big deal.