Script to import ratings from ID3

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

emobo
Posts: 1
Joined: Sun Sep 27, 2009 12:17 pm

Script to import ratings from ID3

Post by emobo » Sun Sep 27, 2009 12:24 pm

Hi all,

I'm new to scripting MediaMonkey (and to Media Monkey in general). I used to use iTunes and wrote a few scripts to save my ratings out to the ID3 tag. Now that I'm using Media Monkey, I'd like to write a quick script which will import my ratings into the MM format. I understand Media Monkey stores the ratings in the POPM tag, but I have my ratings in the comments section (I wasn't sure how to get iTunes to write anything else).
(Another approach could be to write something which converts my tags to the MM format...)

It seems like there is ample documentation, and I've looked through some of the API, but although it is straightforward to get a list of the current songs playing, it's not immediately obvious how to access the entire database to iterate over all tracks. I know this is an obvious thing, but I haven't seen a very straightforward example thus far, which does not involve SQL querys (I am not familiar with that.)

If somebody can't point me to something which I can use as a reference I should be able to figure out what I need to know. But in the meantime I thought I'd say hi and see if there was anything on the forums which I could leverage.

Thanks and take care

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Script to import ratings from ID3

Post by trixmoto » Mon Sep 28, 2009 3:33 am

You'll either need to use SDB.Database.QuerySongs or SDB.Database.OpenSQL, but either way these use SQL. The first returns a SongIterator though whereas the second returns a DBIterator. Here's how I'd do it...

Code: Select all

  Dim iter : Set iter = SDB.Database.QuerySongs("")
  Do While Not iter.EOF
    Dim song : Set song = iter.Item
    'do whatever with the song here
    iter.Next
  Loop
  Set iter = Nothing
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

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

Re: Script to import ratings from ID3

Post by Peke » Sat Oct 17, 2009 6:34 pm

In addition From time to time add SDB.ProcessMessages so that MM can do the background tasks while your script is executing. That will make MM still usable over long periods of Script Execution.

Feel free to share any ideas and we will try to help you as much as possible. Enjoy your stay here and welcome.
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

Post Reply