» Welcome Guest
[ Log In :: Register ]

 

[ Track this topic :: Email this topic :: Print this topic ]

Topic: Custom regexp for trash< Next Oldest | Next Newest >
gerhard
Board Fan



Group: Members
Posts: 12
Joined: Oct. 2006
Posted: Oct. 14 2006,03:00

I would like to parse the title in "tag/rename from list" from something that looks like the following:
1.Song Name (Comment) 3:34 dummy comment

where Comment has a fixed no of variants, but 3:34 (track length) does not.
With a perl regexp I could do something like:
($trackno,$title)=$_=~m/\s(\d+).(.*?)\s*(\(Comment\;))?\s*(\d+:\d{2})?  \s*(dummy comment)?/;

I could do a similar thing in mp3ts if I had the grouping and ? options in the file row format or \d in the filtering format.
I would prefer a regexp trash like <trash-opt;dd:dd>

A possible workaround is to process files with i.e. perl first, then use the file in mp3ts, but I believe it will be simpler with only one tool.

Edited by gerhard on Oct. 14 2006,19:05
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: Oct. 16 2006,20:47

Please post a list of the possible variants of the track number format, and I'll see if I can think of a good method.

Regexps are currently not supported, because so few people would be able to use it. :(

--------------
Software author and website owner
Back to top
Profile PM WEB 
gerhard
Board Fan



Group: Members
Posts: 12
Joined: Oct. 2006
Posted: Oct. 18 2006,00:06

The practical problem right now is to remove the "3:34" (track length) in the example below. The comments are possible to handle with "case fix", but not the possible track lengths.

A "case fix" that removes trailing \d?\d:\d\d could do the job.

Regexps are fun!
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: Oct. 18 2006,00:44

I don't really see why e.g. the following simple template wouldn't work?

<TrackNr>.<Title> (<Comment>) <TRASH> <WhateverFieldYouWant>

--------------
Software author and website owner
Back to top
Profile PM WEB 
gerhard
Board Fan



Group: Members
Posts: 12
Joined: Oct. 2006
Posted: Oct. 19 2006,00:16

Quote (Magnus Brading @ Oct. 18 2006,00:44)
I don't really see why e.g. the following simple template wouldn't work?

<TrackNr>.<Title> (<Comment>) <TRASH> <WhateverFieldYouWant>

Because (<comment>) differs and may not occur at all.
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: Oct. 20 2006,12:55

In this case I recommend you to use the filter, in combination with a few different templates, inside a macro. Creating one giant regexp to handle all possible formats at the same time is bound to be very messy, which is why I haven't implemented it at this point.

--------------
Software author and website owner
Back to top
Profile PM WEB 
gerhard
Board Fan



Group: Members
Posts: 12
Joined: Oct. 2006
Posted: Oct. 21 2006,13:19

Quote (Magnus Brading @ Oct. 20 2006,12:55)
In this case I recommend you to use the filter, in combination with a few different templates, inside a macro.

Several macros can handle most situations, but a regexp can handle all in one expression.
However, a macro wont cut "TrackNo.title_I_want 3.30", so I have to use another program (at least to process the input files). (or have I missed how I can cut the "random" 3.30 part?)

Its hard to satisfy all. Even mp3ts is very powerful it cannot do everything.

Edited by gerhard on Oct. 22 2006,18:59
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: Oct. 22 2006,00:39

What I meant with "using a macro in combination with the filter" was that you can run multiple sweeps matching different formats in a macro. Your regexp (like any regexp) can also just parse a finite set of formats, so as long as you can put together filter rules for all the possible different formats, the two methods should be equal. But sure, that might not be easy/possible for an arbitrary format.

--------------
Software author and website owner
Back to top
Profile PM WEB 
Tazlord
Board Newbie



Group: Members
Posts: 1
Joined: June 2007
Posted: June 03 2007,03:23

I think the ability to use a PCRE compatible syntax would be very useful. I have a situation where I'm trying to rename files but I have specific truncation needs.

A typical filename might look like this:

a) Run DMC - Walk This Way.mp3
or
b) Run DMC feat. Aerosmith - Walk This Way.mp3

In the first case, I'd like to simply truncate everything from "feat." on (including the preceding space).
In the second case, I'd like to truncate everything from "feat." (including the preceding space) up to the field separator, " - " in this case.

I have been able to accomplish this by using "Direct rename files" using this syntax:
Code Sample
<Artist> feat. <TRASH> - <Title>.mp3

The problem I am running into is the "Expected file name format" parser is expecting my syntax to be present in every file. When it runs into a file without "feat." present, it renames the file but adds an extra field separator to the end of the file (before the extension). This means that example "a" (above) will end up looking like this:

Run DMC - Walk This Way - .mp3

I was under the impression that these parsers were conditional. Meaning, only apply changes to files that match my expressions. Files that do not, don't get changed. I'm sure if this was the case, I would not need a PCRE interpreter but then I would need to be able to add many regular expression conditions in sequence so I wouldn't have to make multiple passes.

Anyway, either solution would work for me but for now, I'm stuck having to manually rename files that have gone through the program's parser.

I'd also like to note that this is a GREAT program. I have used many "tagging" programs and this one is by far the best one I've used. Keep up the good work!
Back to top
Profile PM 
Magnus Brading
Almighty Author



Group: Super Administrators
Posts: 2751
Joined: Aug. 2002
Posted: June 03 2007,13:45

I'm glad you like Mp3/Tag Studio.

The method your describing is indeed the "regexp way", which can be very powerful for the right user. This way will be too complex for most users and situations though, so I chose a little other way to do it.

To solve your problem in Mp3/Tag Studio, simply apply a filter that checks if the "feat" is present in the name or not, and the only process the files where it is.

--------------
Software author and website owner
Back to top
Profile PM WEB 
9 replies since Oct. 14 2006,03:00 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]