Is there a script to change "dont" into "don'

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

teemac

Is there a script to change "dont" into "don'

Post by teemac »

I have nearly 50,000 tracks and have only just recently noticed many tracks have grammar/spelling errors of the sort: dont instead of don't, cant instead of can't, Ill instead of I'll, etc.

I have tried to search for a script to convert all these types of errors into the correct spelling, but have been unable to find one.

Does any one know of such a thing, or must they all be done manually.

Thanks for any help you can give me.

teemac (Australia) Gold Rego
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Yes there is a powerfull script which among other good corrections can do that. You have to add the corrections you want to be done yourself. Read more here:
http://www.mediamonkey.com/forum/viewtopic.php?t=8044

And as stated, be careful! Make sure just to try on one track when you test your changes.


/Bex
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
teemac
Posts: 30
Joined: Sun Apr 02, 2006 1:09 am

Will give it a try

Post by teemac »

Bex - Thanks for the link and it looks like something like what I'm after - I'll give it a try. Some corrections were mentioned in the latest posts on that thread, but no copy of the script - Do you have it?? I am not a scripter and don't have a clue about what changes are needed or how to do it.

Thanks again.

teemac (Australia) Gold User
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Hello Teemac

The latest version is the last one in that thread ( http://www.mediamonkey.com/forum/viewto ... 6830#36830 ). The mentioned corrections are included in that one.

More people are finding this an interesting script so I will take a look to create a preview page, to see what will be changed before actually applying.

EDIT: I just updated the script so it now has a preview function, and it has some minor improvements.

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Excellent Steegy!


Thanks
/Bex
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
teemac
Posts: 30
Joined: Sun Apr 02, 2006 1:09 am

Enhanced tagger update

Post by teemac »

Steegy - thanks for the 'heads up' on the new version. I am glad you updated it as the old one changed the files as shown in Monkey's library view, but did not actually change anything in the mp3 file's tag when looked at with Tag&Rename. The old errors were still there but Monkey showed them correctly.

Will give the new version a go and will get back with any problems.

Thank you

teemac(Australia) Gold User
teemac
Posts: 30
Joined: Sun Apr 02, 2006 1:09 am

New version requests

Post by teemac »

Steegy - Just a few quick requests for some extras to your latest script.

By the way, the new script now edits the tags in the mp3 file OK showing whatever Monkey library shows after running PersonalTagEnhancer.vbs script.

I also need the following words searched for and corrected :

aint > ain't
isnt > isn't
cant > can't
ill > i'll
wouldnt > wouldn't
wouldve > would've
shouldnt > shouldn't
shouldve > should've

I also noticed that the brackets corrections and word corrections only apply to the Title field and do not apply to Artist, Album or Album Artist fields.

If all of the above words (including existing words and brackets etc in the new script) could be applied to these extra 3 fields as well, it would make the script more extremely usefull. What I really mean is that the exact same corrections are applied to all 4 fields. It is already saving me so much time in my library of nearly 50k tracks.

Any chance of commenting the script lines to save me annoying you all the time?? That way if I come across any extra words, I could add them myself and learn something about scripting at the same time.

Thanks a lot for your time,

teemac (Australia) Gold User
teemac
Posts: 30
Joined: Sun Apr 02, 2006 1:09 am

Quick update of my encounters

Post by teemac »

Steegy - just a quick update:

In Brief:

Title Field - Word and bracket corrections - OK.
Artist Field - Word corrections ONLY - NO bracket corrections applied.
Album Artist Field - NO word corrections and NO bracket corrections applied.
Album Field - NO word corrections and NO bracket corrections applied.



Title Field works perfectly.
Artist field does word corrections ok but does not seem to have bracket corrections applied to it.
Album Artist and Album Fields do not have any corrections made of either type.

I am using a dummy set of mp3 files with all the errors in each field that I need to have corrected. I refresh the scan of this dummy set after applying any changes or running the script.

Thanks for your time.

teemac (Australia) Gold User
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Hello Teemac

Thanks for the useful comments.

My personal explanation:
Album: Greatest Hits [Bonus Disc] (CD1)
Artist: Trance[]Control (and also Album Artist)
=> Personally I want to keep it that way. That's the reason why I didn't call the FixBrackets function on these fields.

Album ==> I usually let this as it is, because most of the time it's right and I want to respect the real album name as the artist intended it to be (like Featuring instead of feat.).

And... the more corrections you do, the slower the script.


Explanation of the script:
It has some functions to enhance a tag:
:: ChangeCharacters, FixBrackets, FixCommonWords, FixWrongGenre
These functions are in the "ENHANCER METHODS" section.
Please only edit the ones mentioned above (better *not* change ReplaceBadTagPortion, as this function is called by FixCommonWords, so edit that one instead).

These functions are called in the preview form, in the "FORM CREATION AND CALLING OF ENHANCER METHODS" section.
They are between decorative lines of ///.


People can always ask me to make improvements, or to assist them in getting their personal enhancement wishes in the script.
(here in the forum, by PM, by mail, ...)
In that way, I'm also sure that I hear about these and the posted script here on the forum is updated too, if needed.



My "enhancement section" is like this:

Code: Select all

    '///////////////////////////////////////////////////////////////////////
    '//////////////////////////////////////////
    '//////////////


	artist = FixCommonWords(ChangeCharacters(Trim(itm.ArtistName)))
	title = FixCommonWords(FixBrackets(ChangeCharacters(Trim(itm.Title))))
	genre = FixWrongGenre(Trim(itm.Genre))
	album = ChangeCharacters(Trim(itm.AlbumName))
	If album = "" Then 
       albumArtist = "" 
       trackOrder = 0
    Else
		albumArtist = FixCommonWords(ChangeCharacters(Trim(itm.AlbumArtistName)))
    	trackOrder = itm.trackOrder
    End If 

    '                                                         //////////////
    '                             //////////////////////////////////////////
    '///////////////////////////////////////////////////////////////////////
What this one does:
Artist: FixCommonWords, ChangeCharacters, Remove Spaces on begin and end
Title: FixCommonWords, FixBrackets, ChangeCharacters, Remove Spaces on begin and end
Genre: FixWrongGenre, Remove Spaces on begin and end
Album: ChangeCharacters, Remove Spaces on begin and end

Empty AlbumArtist and TrackOrder (Track#) if no Album is specified
AlbumArtist: FixCommonWords, ChangeCharacters, Remove Spaces on begin and end



I updated the "FixCommonWords" function with your suggestions:

Code: Select all

     Tag = ReplaceBadTagPortion(Tag, "aint", "ain't") 
     Tag = ReplaceBadTagPortion(Tag, "isnt", "isn't") 
     Tag = ReplaceBadTagPortion(Tag, "cant", "can't") 
     Tag = ReplaceBadTagPortion(Tag, "ill", "i'll")      'Good changes outweigh the bad ones (real "ill") 
     Tag = ReplaceBadTagPortion(Tag, "wouldnt", "wouldn't") 
     Tag = ReplaceBadTagPortion(Tag, "wouldve", "would've") 
     Tag = ReplaceBadTagPortion(Tag, "shouldnt", "shouldn't") 
     Tag = ReplaceBadTagPortion(Tag, "shouldve", "should've") 
Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
tinana
Posts: 210
Joined: Sat Apr 15, 2006 1:52 pm
Location: new orleans los angeles

Post by tinana »

Hi Steegy,

Would it be possible, using this script, to edit the "artist" field so that I can take a tag like "lastname,firstname" and convert it to "firstname lastname".

I've been trying to find a solution for some time using other scripts, but because there are no spaces, this string gets treated as one word and so the script doesn't see two names from which to reorder; of course there's also the dang comma in there that I've been trying to get rid of.

I've found a way to do this in MP3Tag using regexps, but it'd be nice to have the ability in MM if it were possible.
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Sure

In the "editable section" (line number about 145), change

Code: Select all

	artist = FixCommonWords(ChangeCharacters(Trim(itm.ArtistName)))
to

Code: Select all

	artist = FixCommonWords(ChangeCharacters(Trim(itm.ArtistName)))
	
	Dim CommaPosition : CommaPosition = InStr(artist, ",")
	artist = Mid(artist, CommaPosition + 1) & " " & Left(artist, CommaPosition - 1)
(so the change has just 2 lines of code extra)



BTW: The "editable section" starts with

Code: Select all

    '///////////////////////////////////////////////////////////////////////
    '//////////////////////////////////////////
    '//////////////
Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
tinana
Posts: 210
Joined: Sat Apr 15, 2006 1:52 pm
Location: new orleans los angeles

Post by tinana »

Thank-you so much, Steegy. I love this script, and haaaaate having to always be a bother and ask questions. It's nice to have at least a small idea how these things work...thanks for your help, and again, for the script.
tinana
Posts: 210
Joined: Sat Apr 15, 2006 1:52 pm
Location: new orleans los angeles

Post by tinana »

Oh G*D!

Thank-you thank-you thank-you Steegy!

I just gave the script with the modifications a try, oh man oh man oh man. I had a backlog of albums with badly formatted (to me) tags and this just took care of all of them.


Oh man, what a godsend.

Thanks again.
Nebbin
Posts: 316
Joined: Mon May 30, 2005 4:52 am
Location: Australia

Post by Nebbin »

For a long time now I've been using a script named "Custom Scripts". It was written by W. Kyle White, and the thread is: http://www.mediamonkey.com/forum/viewtopic.php?t=5160

It's been absolutely priceless as among it's numerous scripting jobs it includes a "Replace String In Field" function. This can replace any text within a number of fields (you can easily edit the script to add more, such as the custom fields). Currently I can replace, when required, any text within any field of my tags I wish - and it uses an input box to do it so there's no need to edit the script at all (obviously after you've initially made sure all your required editable fields are included). Sadly though, it doesn't include a "preview" pane.

Just thought I'd mention it here in case someone's interested. I've yet to try out Steegy's (I will soon :) ), so I have no idea how this compares. It's hard to find many scripts which have been written to address common issues - thus unfortunately much work becomes buried and forgotten.
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Actually, the "PersonalTagEnhancer" script could use some GUI indeed.
E.g. an easy way to set the "change 'featuring' to 'ft.'" stuff. I think that would be the most used setting.
But for now, normally you only have to dive once in the script to change what you want.

And thanks for the nice comments too Tinana. I hadn't seen them until now.
If there's any question about anything, please just ask. It's better to ask and (tried to) be helped directly, instead of stay sitting with that problem. It certainly doesn't bother me. Actually, it bothers me to see people with problems. So they have to be solved...
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Post Reply