MusicMatch Ratings 1.1 [MM2+3]

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

Moderators: Peke, Gurus

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

MusicMatch Ratings 1.1 [MM2+3]

Post by trixmoto »

As requested, this script copies ratings from MusicMatch (which apparently appear as values 1-5 in the Quality field) to MediaMonkey ratings (in the ratings field), of all the selected tracks. It does not remove the information from the Quality field (so the ratings should still appear fine in MusicMatch).

Code: Select all

'
' MediaMonkey Script
'
' NAME: MusicMatchRatings 1.1
'
' AUTHOR: trixmoto (http://trixmoto.net)
' DATE : 04/12/2007
'
' INSTALL: Copy to Scripts directory and add the following to Scripts.ini 
'          Don't forget to remove comments (') and set the order appropriately
'
' [MusicMatchRatings]
' FileName=MusicMatchRatings.vbs
' ProcName=MusicMatchRatings
' Order=19
' DisplayName=MusicMatch Ratings
' Description=Convert MusicMatch Ratings
' Language=VBScript
' ScriptType=0 
'
' FIXES: Added text values are now also converted
'

Option Explicit 
Dim Debug : Debug = False

Sub MusicMatchRatings
  Dim list : Set list = SDB.CurrentSongList  
  If list.Count = 0 Then
    Call SDB.MessageBox("MusicMatchRatings: There are no selected tracks to process.",mtError,Array(mbOk))
    Exit Sub
  End If    
  
  Dim prog : Set prog = SDB.Progress
  prog.Text = "Initialising script..."
  prog.MaxValue = list.Count
  
  Dim log : Set log = Nothing
  If Debug Then
    Set log = SDB.Tools.FileSystem.CreateTextFile(Script.ScriptPath&".log",True)
    If log Is Nothing Then
      Debug = False
    Else
      Call log.WriteLine("*Processing "&list.Count&" tracks")
    End If
  End If
    
  Dim c : c = 0
  Dim i : i = 0
  For i = 0 To list.Count-1
    Dim itm : Set itm = list.Item(i)
    prog.Text = "Checking track '"&itm.Title&"' ("&(i+1)&"/"&list.Count&")..."
    prog.Value = i
    SDB.ProcessMessages
    
    Dim r : r = -1
    If isNumeric(itm.Quality) Then
      Dim q : q = Int(itm.Quality)
      If q > -1 Then
        If q < 6 Then
          r = q * 20
          c = c + 1
        End If
      End If
    Else
      Select Case itm.Quality
        Case "Bad Taste"
          r = 0
          c = c + 1
        Case "Poor"
          r = 20
          c = c + 1
        Case "Fair"
          r = 40
          c = c + 1
        Case "Good"
          r = 60
          c = c + 1
        Case "Very Good"
          r = 80
          c = c + 1
        Case "Excellent"
          r = 100
          c = c + 1
      End Select
    End If
    itm.Rating = r
    
    If Debug Then
      Call log.WriteLine(itm.ID&":"&itm.Quality&"="&q&"="&r&"~"&itm.Title)
    End If
    
    If prog.Terminate Then 
      If Debug Then
        Call log.WriteLine("*Cancelled by user")
      End If
      Exit For
    End If
  Next
  
  prog.Text = "Finalising script..."
  prog.Value = prog.MaxValue
  If Not (prog.Terminate) Then
    Call list.UpdateAll
    If Debug Then
      Call log.WriteLine("*Processed all")
    End If    
  End If
  If Debug Then
    Call log.WriteLine("*Tracks updated: "&c&"/"&list.Count)
    log.Close
  End if  
  Call SDB.MessageBox("Tracks updated: "&c&" out of "&list.Count,mtInformation,Array(mbOk))
End Sub

Sub Install()
  Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
  Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
  If Not (inif Is Nothing) Then
    inif.StringValue("MusicMatchRatings","Filename") = "MusicMatchRatings.vbs"
    inif.StringValue("MusicMatchRatings","Procname") = "MusicMatchRatings"
    inif.StringValue("MusicMatchRatings","Order") = "19"
    inif.StringValue("MusicMatchRatings","DisplayName") = "MusicMatch Ratings"
    inif.StringValue("MusicMatchRatings","Description") = "Convert MusicMatch Ratings"
    inif.StringValue("MusicMatchRatings","Language") = "VBScript"
    inif.StringValue("MusicMatchRatings","ScriptType") = "0"
    SDB.RefreshScriptItems
  End If
End Sub
Last edited by trixmoto on Tue Dec 04, 2007 11:32 am, edited 3 times in total.
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.
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

I think this one is going to be most appreciated by many!

Good one trix! (As always :D )

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

Post by trixmoto »

Appreciated if it works! As I've never used MusicMatch I have no real data to test it with. Although I tested it with the data the way I was told it was, and that worked! :)
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.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Rik,

You are awesome!!
The script you wrote works perfectly.
I certainly didn't expect such a fast answer, I love you man!

...

Thanks a million again. I think now I'm finally cured of a long-lasting MMJB addiction! ;-)

- Martin
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.
judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Post by judas »

Nice one again trix,,..i dont use MMJB and have never, but as bex said many are going to appreciate this (unless thay have manually re-rated they're library...in this case they wouldn't like you so much!!!)

keep it up...

judas
pkdrojo

... Can you help me with itunes?

Post by pkdrojo »

That's nice ... But ... you can do the same with itunes?
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Erm.... No idea! :)

I don't use iTunes but hopefully somone else will be able to help you!
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.
jiri
Posts: 5417
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

MM can import ratings from iTunes - the dialog shows after you scan some tracks.

Jiri
felixxx999
Posts: 12
Joined: Sat Dec 09, 2006 10:59 am

YMJ

Post by felixxx999 »

Do you have a script for Yahoo Music Jukebox?
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Currently, no. But if you can give me some information on how the ratings are stored, I might be able to write one. Do they appear in any of the other MM fields?
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.
felixxx999
Posts: 12
Joined: Sat Dec 09, 2006 10:59 am

Post by felixxx999 »

trixmoto wrote:Currently, no. But if you can give me some information on how the ratings are stored, I might be able to write one. Do they appear in any of the other MM fields?
I did some research and I guess Yahoo stores the data on-line. Shame, because I've rated so many on YMJ....

Thanks anyway.
Image
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

If you can export playlists in M3U format from Yahoo then you can create one playlist per rating and import them into MM. Then just select all tracks per playlists in MM and set the rating.
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
TexFlood
Posts: 1
Joined: Tue May 29, 2007 10:12 pm

Not quite understanding.

Post by TexFlood »

Hi there, I'm a long time user of MusicMatch and have compiled/rated/sorted a large library using MusicMatch tagging.
:oops:

Well, it has come time for me to move on to greener pastures, I've done my due diligence with all the big music players and found MM to be *way* more flexible than the rest. So here I am all ready to get set up. I've downloaded all kinds of scripts, but I first want to get my ratings moved over from MusicMatch to MM.

When I run this MusicMatch script on a few of my MP3's that were all tagged in MusicMatch everything works perfectly, the star ratings appear in MM. What I don't understand is where this new rating is being saved. If I pull up the mp3 in mp3Tag, I don't see these ratings getting saved. Are they being saved externally in a central file instead?

If I remove the mp3s from MM and re-add them the ratings are gone... (The Quality value is still there so I can rerun the script, but I would like to permanently save the rating to a tag such as in the POPM tag. What am I not understanding?

Edit:
Looking through the script and trying to understand, at the end it runs the Update DB command and the HTML Help says the UpdateDB command:
"Writes changes that were made to track's properties back to the Library."
Does that mean within the mp3 file or elsewhere?

Edit Again:
lol Ok I've figured it out, I've added the following line under the itm.UpdateDB:
itm.WriteTags
I'm going to assume that its ok to run both those commands, not sure where in the heck the UpdateDB is saving...

As my final note for the evening, the scripting capabilities in MM are awesome! I'm hoping that saving these POPM values in MM's star numerologically (made up word) settings will not affect my ability to sync my brand new 8G Ipod Nano and use ratings! Or am I in for the battle of evermore (ie only change these ratings from MM and deal with the inaccuracies)? I'll keep searching these boards as this post is turning into a blog.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

The script only saves the values into the database. You can then synchronise the track to save the ratings to the tags, or have your settings setup to do this automatically (like mine) or indeed add this line to the script. I'm glad you found the script useful. :)
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.
Mitch470
Posts: 132
Joined: Wed Jul 04, 2007 11:13 am

Re: MusicMatch Ratings 1.0 [MM2+3]

Post by Mitch470 »

trixmoto wrote:As requested, this script copies ratings from MusicMatch (which apparently appear as values 1-5 in the Quality field) to MediaMonkey ratings (in the ratings field), of all the selected tracks. It does not remove the information from the Quality field (so the ratings should still appear fine in MusicMatch).
Trix,

I installed the above code into my scripts.ini file and then started MediaMonkey Gold 2.5.5. I clicked that Script

I finally figured out that I needed to create a VBS file separately. Then I loaded all unrated songs into the main pane and selected all of them. It worked like a charm.

Thanks for a great script.
Cheers,

Mitch
Post Reply