What are the properties of SDB items

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

Moderators: Gurus, Addon Administrators

Edgar
Posts: 81
Joined: Sun Aug 30, 2009 12:06 pm

What are the properties of SDB items

Post by Edgar »

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 10 MediaMonkey Lifetime Gold 3, 4 & beta5
Asus ASUS Prime X299-Deluxe motherboard
sound system: Soundcraft Signature 12 MTK mixer, JBL Eon 15 G2 speakers as mains and mains subs, and JBL Eon610 mains with Tascam LF-S8 sub as near field monitors at the computer
mcow
Posts: 834
Joined: Sun Sep 21, 2008 9:35 pm
Location: Cupertino, California

Re: What are the properties of SDB items

Post by mcow »

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
Edgar
Posts: 81
Joined: Sun Aug 30, 2009 12:06 pm

Re: What are the properties of SDB items

Post by Edgar »

–Edgar

64-bit Windows 10 MediaMonkey Lifetime Gold 3, 4 & beta5
Asus ASUS Prime X299-Deluxe motherboard
sound system: Soundcraft Signature 12 MTK mixer, JBL Eon 15 G2 speakers as mains and mains subs, and JBL Eon610 mains with Tascam LF-S8 sub as near field monitors at the computer
dtsig
Posts: 3588
Joined: Mon Jan 24, 2011 6:34 pm

Re: What are the properties of SDB items

Post by dtsig »

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
Post Reply