getmusicbee.com

Support => Developers' Area => Topic started by: stax76 on February 27, 2017, 05:29:05 PM

Title: setting date added via API?
Post by: stax76 on February 27, 2017, 05:29:05 PM
Can date added be set via API? There are three things I want to import from MediaMonkey 4:

date added
play count
custom field

play count don't seem to be supported, could I add this via plugin? Would sorting then work? I guess not because alphanumerical sort would be needed. Could it be still be done with some workaround maybe?
Title: Re: setting date added via API?
Post by: Steven on February 27, 2017, 07:43:06 PM
For custom fields i recommend you map them in Preferences/ Tags(1)/ custom tags so any updates done in MB are saved
Search the forum for posts from other mediamonkey users who have already done this
Play count and date added can be imported from an iTunes xml file, for which there is a MediaMonkey plugin that generates that file.
Again search the forum as it has been discussed before
if you still want to use the API, date added is 12 and play count is 14. ie. cast those values to MetaDataType and use Library_SetFileTag
then Library_CommitTagsToFile
and MB_RefreshPanels once at the end
Title: Re: setting date added via API?
Post by: stax76 on February 28, 2017, 11:04:57 AM
Thanks, it worked.  :)

Just in case somebody else wants to do the same, here is the code:

http://pastebin.com/v1cppbNA

http://www.mediafire.com/file/lc5wiiuvdttr3xp/MusicBee_MediaMonkey_Import_Plugin.7z
Title: Re: setting date added via API?
Post by: leifel on September 23, 2017, 05:06:28 PM
if you still want to use the API, date added is 12 and play count is 14. ie. cast those values to MetaDataType and use Library_SetFileTag
then Library_CommitTagsToFile

I need this, but I also need to update the "Last Play Date" of some tracks. I can't find it represented in the MetaDataType enum. What is the value I can use to set it?
Title: Re: setting date added via API?
Post by: Steven on September 23, 2017, 05:57:33 PM
its 13
just look for the value in FilePropertyType and cast as MetaDataType
Title: Re: setting date added via API?
Post by: leifel on September 24, 2017, 02:38:44 AM
Thanks, it worked nicely.