ExtractFields v0.1.4 [MM2+3]

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

freeqboi
Posts: 20
Joined: Thu Aug 09, 2007 6:52 am

Post by freeqboi » Thu Aug 09, 2007 8:35 am

quick question, im not knowalgable at all on this stuff, and before i start breaking it, can i use this to, in the properties tab on a track automatically copy the artist field in to the album artist field, therefore replacing the annoying "various" in the album artist field that having compilaton albums causes?

if not anyone know of something that will? i ahve an inordinalte amount of comps, and dont wanna do them all by hand...

Eyal
Posts: 3109
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec

Post by Eyal » Thu Aug 09, 2007 10:44 am

Yes you can use this script to do that. But it will not do it automatically.
What you can do for your all your current songs, is select them all and apply

Code: Select all

<Artist>  -->  <AlbumArtist>
If you have the Gold version, you can use the Advanced Find function to find all song where AlbumArtist="Various", and the select them all before running the script.
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].

Peke
Posts: 12216
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Post by Peke » Thu Aug 09, 2007 5:48 pm

3'rd solution without scripts:
Eyal wrote:If you have the Gold version, you can use the Advanced Find function to find all song where AlbumArtist="Various", and the select them all before running the script.
Just make album artist Empty and MM will fill that with Artist if Album fields exists. Also I think that you can navigate Albums/Artist for Various and do tag edit there even in Free MM.
Best regards,
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add SCREENSHOTS to forum

freeqboi
Posts: 20
Joined: Thu Aug 09, 2007 6:52 am

Post by freeqboi » Tue Aug 14, 2007 7:09 am

thanks for the help guys, i went with peke's idea, mainly as i have no idea how to code scripts, and that did the job perfectly! fankoooo

judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Post by judas » Thu Aug 16, 2007 4:25 pm

Hi...i dunno if any1 else is having problem with this script on MM3....it works perfectly, changes the tags, but when i press close or the X to close it crashes MM...any ideas about what to change in order to make it work?

The error I get says:


MediaMonkey has encountered a problem.
Control '' has no parent window.

And it crashes!
Cheers, judas

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Fri Aug 17, 2007 3:06 am

I just posted a modification to the script I made a while ago. I suppose it was to fix the problem you're describing, but due to holidays and such I must've forgotten. Hopefully it works as supposed, if not please let me know.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Post by judas » Fri Aug 17, 2007 5:53 am

thanks a lot steegy!!!!!! will try it and post results, hopefully all is fine now :)

EDIT: Works Perfectly now on MM3 A7.
Cheers, judas

judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Post by judas » Wed Aug 29, 2007 11:25 pm

This question
cyclopede wrote:Thank you, it's working quite well !!
Is there a way thou to make it remember the mask and let the script working automatically as soon as a new file is added to the monitored folder ?

Thanks
Julien.
was asked here:
http://www.mediamonkey.com/forum/viewtopic.php?p=101275

(Partial) Answer:
You can specify the default mask, so the script remembers it everytime:

Code: Select all

'*****************************************************
'****                USER DEFAULTS                ****
'*****************************************************

Const def_EntryLinesCnt = 2
Const def_TagField = "Title"
Const def_TagMask = "%A - %S"
And this are the masks:

Code: Select all

%A = ArtistName"
 %C = Author"
 %G = Genre"
 %L = AlbumName"
 %M = BPM"
 %R = AlbumArtistName"
 %S = Title"
 %T = TrackOrder"
 %U = Custom1"
 %V = Custom2"
 %W = Custom3"
 %Y = Year"
 %P = Path"
Regarding your other question, I don't know how to trigger the script to run when a file is added to the library...
Cheers, judas

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Thu Aug 30, 2007 3:27 am

Hey Julien

ExtractFields can do what you want, with some modifications:
- change the script's defaults like Judas explained
- add an event handler for SDB.OnTrackAdded
- change some other code
- make that the dialog is closed automatically

So this is possible, but probably not the best tool for the task.

Solutions:
- Your song's file names contain the info (title, artist, copyright) you need in the tags: change the way MediaMonkey "infers" this info from the filename/path (and make sure that MM always uses this approach when adding files). ==> Add a custom [SongMasks] mask in MM's configuration file.
- The above doesn't apply, you want to get the info (title, artist, copyright) from the existing ID3 tags (not from the filename/path). ==> A small custom script would be much faster and easier to create.

According to your message, the 2nd solution is the way to go. Is that right?
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Thu Aug 30, 2007 4:10 am

Try this:

Code: Select all

Sub OnStartup

    Script.RegisterEvent SDB, "OnTrackAdded", "SDB_OnTrackAdded"
    
End Sub


Sub SDB_OnTrackAdded(NewTrack)

    If InStr(1, NewTrack.Path, "C:/hidownload/LiveBroadcast/", 1) = 0 Then Exit Sub

    NewTrack.Title = ""
    NewTrack.ArtistName = ""
    NewTrack.Custom3 = ""
    
    NewTrack.ParseText(NewTrack.Title, "%S, %A, Copyright:(C) %W")
    NewTrack.Copyright = NewTrack.Custom3
    NewTrack.Custom3 = ""
    
    NewTrack.UpdateDB
    NewTrack.WriteTags

End Sub
or this:

Code: Select all

Sub OnStartup

    Script.RegisterEvent SDB, "OnTrackAdded", "SDB_OnTrackAdded"
    
End Sub


Sub SDB_OnTrackAdded(NewTrack)

    If InStr(1, NewTrack.Path, "C:/hidownload/LiveBroadcast/", 1) = 0 Then Exit Sub

    Dim txt : txt = NewTrack.Title
    Dim pos1, pos2
    
    pos1 = InStr(1, txt, ",", 1)
    pos2 = InStr(pos1 + 1, txt, ",", 1)
    
    NewTrack.Title = Mid(txt, 1, pos1 - (1))
    NewTrack.ArtistName = Mid(txt, pos1 + 1 + 1, pos2 - (pos1 + 1 + 1))
    NewTrack.Copyright = Mid(txt, pos2 + 1 + 15)
    
    NewTrack.UpdateDB
    NewTrack.WriteTags

End Sub
Both are autoscripts. Put one of them in MediaMonkey's Scripts\Auto folder as explained here.
It might also be possible with regular expressions (but don't ask me that).
Last edited by Steegy on Fri Aug 31, 2007 3:25 am, edited 2 times in total.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Post by judas » Thu Aug 30, 2007 6:07 am

He who knows, knows! :-)
Cheers, judas

cyclopede
Posts: 4
Joined: Tue Aug 28, 2007 9:45 pm
Location: Singapore

Post by cyclopede » Thu Aug 30, 2007 9:52 am

Thank you Judas and Steegy, I do appreciate your help. The code you gave me is what I'm looking for.
Thou I'm afraid that if I save it in the scripts/auto folder, it's going to rename every files I add in MM, I only want to rename a daily download that I store in a specific folder. Can a line be added to the code to specify this folder ?

Thanks again,
Julien.

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Thu Aug 30, 2007 2:23 pm

Yes sure.

Just show how the paths for your normal music, and the paths for your daily downloads, look like (e.g. using an example name). That way, we can see what the difference is and add an extra condition to the script.

Just as a remark: the script will change the tags (title, artist, copyright) from the daily downloads, but not the file name (you can let the script do that too if you want).

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

cyclopede
Posts: 4
Joined: Tue Aug 28, 2007 9:45 pm
Location: Singapore

Post by cyclopede » Thu Aug 30, 2007 8:22 pm

Here's the path where the files are downloaded :
- C:/hidownload/LiveBroadcast/rmv8.bbc.net.uk/radio1

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Fri Aug 31, 2007 3:27 am

I updated the code above. It will only run if the path starts with "C:/hidownload/LiveBroadcast/" (which, of course, you can change to "C:/hidownload/LiveBroadcast/rmv8.bbc.net.uk/radio1" if you want)
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

Post Reply