HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: swayzak on 2008-11-08 00:15:45

Title: "Undoing" AutoCapitilise ?
Post by: swayzak on 2008-11-08 00:15:45
hi

After a few too many glasses of wine (  ) I stupidly Capitilised my entire 160GB music collection - thereby correcting some annoying problems with letters, but creating annoying problems

e.g all "DJ"s became Dj, MCs to Mc, vol II to vol Ii, CD1 to Cd1 etc.

Is there anyway I can correct this relatively painlessly ?


PS. FB2K is far to powerful a tool to be toyed with on alcohol ...
Title: "Undoing" AutoCapitilise ?
Post by: Andreasvb on 2008-11-08 00:27:00
You can use Mp3tag and create actions that replaces specific words.

I've several for e.g.
dj = DJ
Ft. = feat.
Vs = vs.

It's very powerful, and free.

Give it a try.
Title: "Undoing" AutoCapitilise ?
Post by: swayzak on 2008-11-08 00:31:50
You can use Mp3tag and create actions that replaces specific words.

I've several for e.g.
dj = DJ
Ft. = feat.
Vs = vs.

It's very powerful, and free.

Give it a try.



thanks

just installed it & will give it a go !

PS Is this program better suited than FB2K to do this ?
Title: "Undoing" AutoCapitilise ?
Post by: Yirkha on 2008-11-08 00:42:40
Awfully late, however:
Properties for all items > Right-click on "Track title" whatever you mangled > Format from Other Fields... > "$replace(%title%,Dj,DJ,Mc,MC,Ii,II,Cd,CD)" etc. > Review, apply.
Title: "Undoing" AutoCapitilise ?
Post by: ExUser on 2008-11-08 01:16:11
PS Is this program better suited than FB2K to do this ?


IMO, not at all. There have been a few people recommending third-party software for tasks that foobar2000 can perform lately. This is silly and should stop.
Title: "Undoing" AutoCapitilise ?
Post by: Lyx on 2008-11-08 01:42:04
Here's a better fix, since i became "victim" of the same problem a while ago:

Code: [Select]
[$trim($replace($meta(title)' ',' ep ',' EP ',' Ep ',' EP ',' cd ',' CD ',' Cd ',' CD ',' dj ',' DJ ',' Dj ',' DJ ',' Ii ',' II ',' Iii ',' III ',' Iv ',' IV ',' Vi ',' VI ',' Vii ',' VII ',' Viii ',' VIII ',' Ix ',' IX '))]


Replace $meta(title) with any field of your choice.


Explanation:
This avoids three issues. First, by making the whole string [conditional], the return will never be "?" and therefore the field will not be created if it doesn't exist. Second, by using $meta() it avoids fieldremappings. Third, by first adding a space to the end of the value and then trimming it away again, you avoid accidentally doing false matches. For example, ' ep' would also match ' episode', thus turning it into ' EPisode'. Since there is no way to define "end of value", i simply cheat by first adding a space to the end of the value, so that we can just match ' ep '. Then after the replacement i $trim the space away again.
Title: "Undoing" AutoCapitilise ?
Post by: Frank Bicking on 2008-11-08 01:46:49
You don't actually need any of those apostrophes:

Code: [Select]
[$trim($replace($meta(title) , ep , EP , Ep , EP , cd , CD , Cd , CD , dj , DJ , Dj , DJ , Ii , II , Iii , III , Iv , IV , Vi , VI , Vii , VII , Viii , VIII , Ix , IX ))]
Title: "Undoing" AutoCapitilise ?
Post by: Lyx on 2008-11-08 01:47:56
Same reply as yesterday. If whitespace is important, i prefer to explicitely quote it, regardless of it not being "required".

If you can give me a hint how i can set a monospace font for all formattingstring inputareas in fb2k, i may drop that habbit :)
Title: "Undoing" AutoCapitilise ?
Post by: Lyx on 2008-11-08 02:09:43
P.S.:

Doing such replacement operations for MC can result in false matches, because there IS an abbreviation which is capitalized as "Mc". You dont want "Mc Donalds" turned into "MC Donalds", right? For that case, better do a manual DB search and then apply a fix to handselected set of tracks.
Title: "Undoing" AutoCapitilise ?
Post by: kwanbis on 2008-11-08 22:28:57
Second, by using $meta() it avoids fieldremappings.

Sorry, what do you mean?
Title: "Undoing" AutoCapitilise ?
Post by: Lyx on 2008-11-08 22:33:39

Second, by using $meta() it avoids fieldremappings.

Sorry, what do you mean?

Example: %title% will use the filename if the title-field is missing. In masstagging-scripts however, you typically do not want a file which as no title to get the filename applied as title. Especially not in a script which is supposed to only correct wrong capitalization.
Title: "Undoing" AutoCapitilise ?
Post by: kwanbis on 2008-11-08 22:47:40
Example: %title% will use the filename if the title-field is missing. In masstagging-scripts however, you typically do not want a file which as no title to get the filename applied as title. Especially not in a script which is supposed to only correct wrong capitalization.

really? i never seen that behavior before, and i use masstager, a lot (not that it means that i know it ).

so you mean that if i have a script like:

Format Value: Destination Field: TITLE: Formating Pattern: $ansi(%title%)

but there is no TITLE field, i would get $ansi($filename)?
Title: "Undoing" AutoCapitilise ?
Post by: Lyx on 2008-11-08 22:52:40
Just tested - the answer is "yes".
Title: "Undoing" AutoCapitilise ?
Post by: swayzak on 2008-11-09 00:08:22
Wow - so many further helpful replies ! Thanks.

However, I have again consumed several glasses of red wine so will refrain from implementing suggestions until tomorrow ... 
Title: "Undoing" AutoCapitilise ?
Post by: swayzak on 2008-11-09 00:21:44
Wow - so many further helpful replies ! Thanks.

However, I have again consumed several glasses of red wine so will refrain from implementing suggestions until tomorrow ... 


Actually that's a lie.

Here is a first attempt using "title" - the new value for Roman numerals is unchanged !? Am I doing something wrong ?

(http://img83.imageshack.us/img83/4497/clipboard01ro7.jpg) (http://imageshack.us)
(http://img83.imageshack.us/img83/clipboard01ro7.jpg/1/w1024.png) (http://g.imageshack.us/img83/clipboard01ro7.jpg/1/)
Title: "Undoing" AutoCapitilise ?
Post by: Lyx on 2008-11-09 01:30:02
Works here with 0.9.6 beta. The behaviour of that input-field by the way is VERY WEIRD here (inputfield-limit is set by window-width - and no scrolling allowed).

edit: inputfield length issue described above was reported and verified.
Title: "Undoing" AutoCapitilise ?
Post by: Yirkha on 2008-11-09 03:52:59
You'd need to add another space between "$replace(" and "$meta" for it to work at the beginning of the title. As well as add another set with a dot for it to work with titles like "Ii. Adagio".
Title: "Undoing" AutoCapitilise ?
Post by: swayzak on 2008-11-09 11:00:15
You'd need to add another space between "$replace(" and "$meta" for it to work at the beginning of the title. As well as add another set with a dot for it to work with titles like "Ii. Adagio".


Brilliant - thanks again.

There does seem to be a character limit though - after adding most Roman numerals with dots I couldn't type in V. . It just wouldn't let me.

ie. I got as far as :

[$trim($replace( $meta(title) , ep , EP , Ep , EP , cd , CD , Cd , CD , dj , DJ , Dj , DJ , Ii , II , Iii , III , Iv , IV , Vi , VI , Vii , VII , Viii , VIII , I. , I , Ix , IX , Ii. , II , Iii. , III , Iv. , IV , Vi. , VI , Vii. , VII , Viii., VIII , Ix. , IX , X. , X , Xi. , XI , Xii. , XII , Xiii. , XIII , Xiv. , XIV  ))]
Title: "Undoing" AutoCapitilise ?
Post by: swayzak on 2008-11-09 11:59:42
I've tried to adapt that string to correct the album field as well - but it seems to still want to change the title field .. ??

(http://img378.imageshack.us/img378/1061/clipboard01ev2.jpg) (http://imageshack.us)
(http://img378.imageshack.us/img378/clipboard01ev2.jpg/1/w1024.png) (http://g.imageshack.us/img378/clipboard01ev2.jpg/1/)

Am I doing this wrong ?
Title: "Undoing" AutoCapitilise ?
Post by: Yirkha on 2008-11-09 12:07:23
The column "Title" is apparently only for reference, the old value of the field you selected is not shown.
Title: "Undoing" AutoCapitilise ?
Post by: swayzak on 2008-11-09 12:22:32
The column "Title" is apparently only for reference, the old value of the field you selected is not shown.


Ah - so if I go with this, I'm not going to rename all those tracks to the new album value ?
Title: "Undoing" AutoCapitilise ?
Post by: Yirkha on 2008-11-09 12:26:02
No.
Besides, no changes are done to your files until you close the Properties dialog, so you can safely verify the result. You would save yourself a lot of time if you had just tried it right away.
Title: "Undoing" AutoCapitilise ?
Post by: swayzak on 2008-11-09 12:49:40
Thanks.

Does FB2K have an undo function that could correct "accidental" massive changes like this ?

That would be very useful ....
Title: "Undoing" AutoCapitilise ?
Post by: Yirkha on 2008-11-09 13:12:43
No.
The closest you can get to such a feature would probably be opening the Properties dialog twice - once for managing, once as a backup. Then if something goes wrong, you'd display another Properties, copy all data from the backup one to the new one and rewrite it back. (Simply pressing OK on the backup dialog wouldn't work, as it doesn't write anything if no items were changed in it.)
Title: "Undoing" AutoCapitilise ?
Post by: swayzak on 2008-11-09 13:15:36
OK - thanks. That's useful to know ..
Title: "Undoing" AutoCapitilise ?
Post by: odyssey on 2008-11-09 18:20:17
P.S.:

Doing such replacement operations for MC can result in false matches, because there IS an abbreviation which is capitalized as "Mc". You dont want "Mc Donalds" turned into "MC Donalds", right? For that case, better do a manual DB search and then apply a fix to handselected set of tracks.

I took that into account by replacing any Mca > McA, Mcb > McB etc. Ugly, but very good!

For anyone interested, this is what I do:

Code: [Select]
$replace($caps2(%title%),'[','(',']',')',N''',n''','''N,'''n,'''N''','''n''', ?,?, !,!,  , ,Inch,",Th ,th ,Feat.,feat.,Feat ,feat. ,Featuring ,feat. ,Ft ,feat. ,Ft. ,feat. ,Versus ,vs. ,Vs , vs.,Vs.,vs.,Pres.,pres.,Pres ,pres. ,Presents ,pres. ,Present ,pres. ,Meets ,meets ,Van ,van ,Von ,von ,Mc ,MC ,Dj,DJ,A ,a ,An ,an ,The ,the ,And ,and ,But ,but ,Or ,or ,Nor ,nor ,At ,at ,By ,by ,For ,for ,From ,from ,In ,in ,Into ,into ,Of ,of ,Off ,off ,On ,on ,Onto ,onto ,Out ,out ,Over ,over ,To ,to ,Up ,up ,With ,with ,Mca,McA,Mcb,McB,Mcc,McC,Mcd,McD,Mce,McE,Mcf,McF,Mcg,McG,Mch,McH,Mci,McI,Mcj,McJ,Mck,McK,Mcl,McL,Mcm
,McM,Mcn,McN,Mco,McO,Mcp,McP,Mcq,McQ,Mcr,McR,Mcs,McS,Mct,McT,Mcu,McU,Mcv,McV,Mcw,McW,Mcx,McX,Mcy,McY
,
Mcz,McZ)


It also does it best, lowercasing all words that shouldn't be uppercased
Title: "Undoing" AutoCapitilise ?
Post by: Mar2zz on 2008-11-09 19:20:42
What is the order of process in your string, odyssey?
Caps2 capitalizes every first letter in a word, but then you replace every To with to, With with with ^^...

Does it recognize a song titled With You, where With should stay capitalized?
Title: "Undoing" AutoCapitilise ?
Post by: odyssey on 2008-11-09 21:27:17
What is the order of process in your string, odyssey?
Caps2 capitalizes every first letter in a word, but then you replace every To with to, With with with ^^...

Does it recognize a song titled With You, where With should stay capitalized?

It capitalizes first letter on all words, and corrects words that should stay lowercase.
Title: "Undoing" AutoCapitilise ?
Post by: Purple Monkey on 2008-11-09 23:13:10
I think Mar2zz meant that if you have the title "into the breach" it should become "Into the Breach" not "into the Breach." i.e the first letter should always be capitalised.
Title: "Undoing" AutoCapitilise ?
Post by: odyssey on 2008-11-10 08:36:58
I see it now. It's true with the string I posted, but the one I use is a little more complicated and takes that into account  I'll post it later maybe
Title: "Undoing" AutoCapitilise ?
Post by: Mar2zz on 2008-11-10 10:17:25
That could be solved with nesting your string inside $caps($left(%title%,1) if I am correct.

like this:
Code: [Select]
$caps($left($replace($caps2(%title%),'[','(',']',')',N''',n''','''N,'''n,'''N''','''n''', ?,?, !,!,  , ,Inch,",Th ,th ,Feat.,feat.,Feat ,feat. ,Featuring ,feat. ,Ft ,feat. ,Ft. ,feat. ,Versus ,vs. ,Vs , vs.,Vs.,vs.,Pres.,pres.,Pres ,pres. ,Presents ,pres. ,Present ,pres. ,Meets ,meets ,Van ,van ,Von ,von ,Mc ,MC ,Dj,DJ,A ,a ,An ,an ,The ,the ,And ,and ,But ,but ,Or ,or ,Nor ,nor ,At ,at ,By ,by ,For ,for ,From ,from ,In ,in ,Into ,into ,Of ,of ,Off ,off ,On ,on ,Onto ,onto ,Out ,out ,Over ,over ,To ,to ,Up ,up ,With ,with ,Mca,McA,Mcb,McB,Mcc,McC,Mcd,McD,Mce,McE,Mcf,McF,Mcg,McG,Mch,McH,Mci,McI,Mcj,McJ,Mck,McK,Mcl,McL,Mcm
,McM,Mcn,McN,Mco,McO,Mcp,McP,Mcq,McQ,Mcr,McR,Mcs,McS,Mct,McT,Mcu,McU,Mcv,McV,Mcw,McW,Mcx,McX,Mcy,McY
,Mcz,McZ),1)
Title: "Undoing" AutoCapitilise ?
Post by: odyssey on 2008-11-10 12:21:28
AFAIR, that's exactly what I'm doing. The reason it's not included in my previous post, is that I put this in a variable before further processing
Title: "Undoing" AutoCapitilise ?
Post by: Lyx on 2008-11-10 17:39:38
Coming soon to a screen near you:



From the people who brought you panels mayhem...

FOO_TITLEFORMATTING-DICTIONARY.DLL

Now with $div(100,$div(11,4))% more insanity!
Title: "Undoing" AutoCapitilise ?
Post by: foorious on 2008-11-16 02:34:36
Hi everyone,

Just a few words to say that unless I'm mistaken, some of the above-mentioned words should in fact be capitalized, and some others shoudl'nt. Here are a few examples according to Wikipedia :

[should] Off : http://en.wikipedia.org/wiki/Call_off_the_search (http://en.wikipedia.org/wiki/Call_off_the_search)
[shouldn't] On : http://en.wikipedia.org/wiki/Come_on_over (http://en.wikipedia.org/wiki/Come_on_over)
[should] Up : http://en.wikipedia.org/wiki/Wake_Up_Little_Susie (http://en.wikipedia.org/wiki/Wake_Up_Little_Susie)
[should] Meets : http://en.wikipedia.org/wiki/More_than_mee...on_1_.281984.29 (http://en.wikipedia.org/wiki/More_than_meets_the_eye#Season_1_.281984.29)


Here's my own Masstagger script for the whole job on the %title% tag field (feel free to change %title% to whatever you like). It may not be optimized, but I've been using it for some months and it performs beautifully. Here it is:

Code: [Select]
* Action to perform      : "Format value from other fields"
* Destination field name : TITLE
* Formatting pattern     : $caps2(%title%)

* Action to perform      : "Format value from other fields"
* Destination field name : TITLE
* Formatting pattern     : [$if($strchr(%title%, ),$replace(%title%,'  ',' ',' By A ',' by a ',' For A ',' for a ',' In A ',' in a ',' Of A ',' of a ',' On A ',' on a ',' A ',' a ',' To An ',' to an ',' An ',' an ',' And The ',' and the ',' And ',' and ',' As ',' as ',' At The ',' at the ',' At ',' at ',' By The ',' by the ',' By ',' by ',' But ',' but ',' For The ',' for the ',' For ',' for ',' From A ',' from a ',' From The ',' from the ',' From ',' from ',' In A ',' in a ',' In An ',' in an ',' In The ',' in the ',' In ',' in ',' Into ',' into ',' Nor ',' nor ',' Out Of A ',' out of a ',' Out Of The ',' out of the ',' Out Of ',' out of ',' Of A ',' of a ',' Of The ',' of the ',' Of ',' of ',' On The ',' on the ',' On ',' on ',' Onto ',' onto ',' Or The ',' or the ',' Or ',' or ',' To The ',' to the ',' With The ',' with the ',' The ',' the ',' To ',' to ',' With ',' with '),%title%)]

* Action to perform      : "Format value from other fields"
* Destination field name : TITLE
* Formatting pattern     : [$if($strchr(%title%, ),$left(%title%,$sub($len(%title%),3))$replace($right(%title%,3),' by',' By',' in',' In',' of',' Of',' on',' On',' or',' Or',' to',' To'),%title%)]

* Action to perform      : "Format value from other fields"
* Destination field name : TITLE
* Formatting pattern     : [$if($strchr(%title%, ),$left(%title%,$sub($len(%title%),4))$replace($right(%title%,4),' for',' For',' out',' Out'),%title%)]

* Action to perform      : "Format value from other fields"
* Destination field name : TITLE
* Formatting pattern     : [$if($strchr(%title%, ),$left(%title%,$sub($len(%title%),5))$replace($right(%title%,5),' into',' Into',' from',' From',' with',' With'),%title%)]

* Action to perform      : "Format value from other fields"
* Destination field name : TITLE
* Formatting pattern     : [$if($strchr(%title%, ),$replace(%title%,'Best of','Best Of','- the ','- The ',': the ',': The ','& the ','& The '),%title%)]


Like I said, it may not be optimized... but it works. Feel free to remove all relevant ' if you wish. I like them.


EDIT - small improvement (' As ')