What are the properties of SDB items

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

Moderator: Gurus

What are the properties of SDB items

Postby Edgar » Thu Mar 17, 2016 4:59 pm

I have a script that is working great until…
Code: Select all
' remove "Alt" variations from
' Title field of selected tracks
' also trying to remove it from
' Artist field

Option Explicit

Sub Alts
  ' Define variables
  Dim list, song, i, temp

  ' Get list of selected tracks from MediaMonkey
  Set list = SDB.SelectedSongList
  If list.count=0 Then
  Set list = SDB.AllVisibleSongList
  End If

  ' Process all selected tracks
  For i=0 To list.count-1
    Set song = list.Item(i)

    ' strip the Alts
    temp = song.Title
    temp = Replace(temp, "[", "(")
    temp = Replace(temp, "]", ")")
    temp = Replace(temp, " (Alt)", "")
    temp = Replace(temp, " (Alt 1)", "")
    temp = Replace(temp, " (Alt 2)", "")
    temp = Replace(temp, " (Alt 3)", "")
    temp = Replace(temp, " (Alt 4)", "")
    temp = Replace(temp, " (Alt 5)", "")
    temp = Replace(temp, " (Alt 6)", "")
    temp = Replace(temp, " (Alt 7)", "")
    temp = Replace(temp, " (Alt 8)", "")
    temp = Replace(temp, " (Alt 9)", "")
    temp = Replace(temp, " (Alt 10)", "")
    temp = Replace(temp, " (alt)", "")
    temp = Replace(temp, " (alt 1)", "")
    temp = Replace(temp, " (alt 2)", "")
    temp = Replace(temp, " (alt 3)", "")
    temp = Replace(temp, " (alt 4)", "")
    temp = Replace(temp, " (alt 5)", "")
    temp = Replace(temp, " (alt 6)", "")
    temp = Replace(temp, " (alt 7)", "")
    temp = Replace(temp, " (alt 8)", "")
    temp = Replace(temp, " (alt 9)", "")
    temp = Replace(temp, " (alt 10)", "")
    temp = Replace(temp, " (alternate)", "")
    temp = Replace(temp, " (alternate take)", "")
    temp = Replace(temp, " (alternative take)", "")
    temp = Replace(temp, " (alternate version)", "")
    temp = Replace(temp, " (alternative version)", "")
    temp = Replace(temp, " (alternate mix)", "")
    temp = Replace(temp, " (alternative mix)", "")
    temp = Replace(temp, " (outtake)", "")
    temp = Replace(temp, " (Alternate)", "")
    temp = Replace(temp, " (Alternate Take)", "")
    temp = Replace(temp, " (Alternative Take)", "")
    temp = Replace(temp, " (Alternate Version)", "")
    temp = Replace(temp, " (Alternative Version)", "")
    temp = Replace(temp, " (Alternate Mix)", "")
    temp = Replace(temp, " (Alternative Mix)", "")
    temp = Replace(temp, " (Outtake)", "")
    temp = Replace(temp, " (live)", "")
    temp = Replace(temp, " (Live)", "")
    temp = Replace(temp, "( .)", ".")
    song.Title = temp

    ' temp = song.Artist
    ' temp = Replace(temp, " (alt)", "")
    ' song.Artist = temp

    ' temp = song.AlbumArtist
    ' temp = Replace(temp, " (alt)", "")
    ' song.AlbumArtist = temp

    ' Update the changes in DB
    song.UpdateDB
  Next
End Sub

At the very end of the code I have commented out two sections; as an example, in one of which:
Code: Select all
    temp = song.Artist
    ' temp = Replace(temp, " (alt)", "")
    ' song.Artist = temp

when the commenting is removed, song.Artist fails with a message saying that "Artist" is not a field of "song". Where can I find a list of all the various fields of "song"? FYI, I tried "Artists" without success. "song" is defined as:
Code: Select all
Set list = SDB.SelectedSongList
For i=0 To list.count-1
    Set song = list.Item(i)
---Edgar

64-bit Windows 7 SP1 MediaMonkey Lifetime Gold 3 & beta4
Asus P5E3 Deluxe motherboard (using AudioFire4 via FireWire)
sound system: Soundcraft mixer, JBL Eon 15 G2 speakers as mains and mains subs, and Tascam VL-5A mains with LF-S8 sub as near field monitors at the computer
Edgar
 
Posts: 63
Joined: Sun Aug 30, 2009 12:06 pm

Re: What are the properties of SDB items

Postby mcow » Sat Mar 19, 2016 12:30 pm

See: http://www.mediamonkey.com/wiki/index.php/SDBSongData
Artist is a read-only property ("Get")
ArtistName and AlbumArtistName are both read/write ("Get/Let")
AlbumArtist is not a property at all
mcow
 
Posts: 813
Joined: Sun Sep 21, 2008 9:35 pm
Location: Cupertino, California

Re: What are the properties of SDB items

Postby Edgar » Sat Mar 19, 2016 2:54 pm

---Edgar

64-bit Windows 7 SP1 MediaMonkey Lifetime Gold 3 & beta4
Asus P5E3 Deluxe motherboard (using AudioFire4 via FireWire)
sound system: Soundcraft mixer, JBL Eon 15 G2 speakers as mains and mains subs, and Tascam VL-5A mains with LF-S8 sub as near field monitors at the computer
Edgar
 
Posts: 63
Joined: Sun Aug 30, 2009 12:06 pm

Re: What are the properties of SDB items

Postby dtsig » Sat Mar 19, 2016 9:39 pm

The Scripting Forum wiki page has just about all you need for scripting .. helps a lot
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig
dtsig
 
Posts: 2740
Joined: Mon Jan 24, 2011 6:34 pm


Return to MediaMonkey 4 Addons developer forum

Who is online

Users browsing this forum: No registered users and 8 guests