In 4.1.0.1683 Portable, however, it only works until I exit MediaMonkey. Next time I restart, any newly added tracks have blank fields until I re-install my plugin.
Has something changed in database triggers?
Here's my Install.vbs (Install.ini simply runs this, I don't expect to need to copy the file in):
Code: Select all
' Modify mediamonkey.ini to support the <DB ID> tag.
Dim ini: Set ini = SDB.IniFile
' I should technically look for an unused custom field, rather than just
' taking the first one. Oh well.
ini.StringValue("CustomFields","Fld1Name") = "DB ID"
ini.Flush
ini.Apply
' Preload all known song IDs into the custom field.
SDB.database.execSQL("UPDATE Songs SET Custom1 = ID where Custom1 <> ID")
' Tell the database to automatically place all DB IDs into the Custom1 field
' when new entries are made.
SDB.database.execSQL("drop trigger if exists dbid_maintenance")
SDB.database.execSQL("create trigger dbid_maintenance after insert on Songs" _
& " begin UPDATE Songs SET Custom1 = ID" _
& " where rowid=new.rowid" _
& "; end")