Writing playcount to tag

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

C.D
Posts: 3
Joined: Wed Sep 30, 2009 8:57 am

Writing playcount to tag

Post by C.D »

Since the playcount isn't physically written to the file, I would very much like a script that takes care of that.
After reorganizing my server, I had to wipe the databse, thus losing several months of playcounts, which is abit annoying when you try to establish stats etc.
I'm not really into vbs scripting and got only some experience from making databases in access. Therefore I would very much appreciate some help.I believe this is a function many would enjoy.


This script could be useful when:
- Moving files or wiping database.
- Merging data from several computers
- General usefulness.

I've tried some basic scripting, but it doesn't seem like MM likes my typing..

How the script could look like:

- Check if the user has write access to the files.
- Check if any items are listed or selected, if not give error. Else list a menu of two choices below, or cancel.
-Write data to tags (overwrite) then wipe DB
-Merge data with tag then wipe

Allthough I can't contribute much with the scripting, I've got a good test environment and a headful of ideas :)
nohitter151
Posts: 23640
Joined: Wed Aug 09, 2006 10:20 am
Location: NJ, USA
Contact:

Re: Writing playcount to tag

Post by nohitter151 »

2 problems:

1: Which tag do you write the tags to? Consider that not all file formats have the same tagging system
2: MM doesn't support any 'playcount tags' which means that scripts can't access them either. That means the tags will have to be saved to some non-standard location like a custom field, etc.
MediaMonkey user since 2006
Need help? Got a suggestion? Can't find something?

Please no PMs in reply to a post. Just reply in the thread.
C.D
Posts: 3
Joined: Wed Sep 30, 2009 8:57 am

Re: Writing playcount to tag

Post by C.D »

Thanks for the quick response.

I know the custom tags aren't standard, but I already use a couple of them. My library consists of only flac and mp3 and it works perfectly as it is now.
I plan on using MM for a long while, so future support isn't a big issue yet :)
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Writing playcount to tag

Post by nynaevelan »

If you have a backup of your database, you can use Zvezdand's Restore Playhistory script to restore your playcounts, added dates and playlists to a new database.
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
Guest

Re: Writing playcount to tag

Post by Guest »

nynaevelan wrote:If you have a backup of your database, you can use Zvezdand's Restore Playhistory script to restore your playcounts, added dates and playlists to a new database.
Yes, that is a nifty tool, but doesn't quite cover my need.
Thanks anyway, I'll have a look at it :)
C.D
Posts: 3
Joined: Wed Sep 30, 2009 8:57 am

Re: Writing playcount to tag

Post by C.D »

I've compiled an example of what the script could look like. I have no idea of whether this would work or not.
Please take a look at give me some input.
Thanks!

Code: Select all

Sub init
        Dim list, itm, data i, strSQL, answer
        Set list = SDB.AllVisibleSongList

        If list.count = 0 Then
            MsgBox("FAIL!")
            Exit Sub
        End If

answer=MsgBox("Merge data?", vbYesNo, "Continue")
If answer = vbno Then
	Exit Sub
		Else
  			For i=0 To list.count-1
    		Set itm = list.Item(i)
    		strSQL = "SELECT playcount from local.db WHERE songid = itemID" ----- I have no idea how to query to the MM db
    		If IsNull(strSQL)=True Then
    			If IsNull(itm.Custom3) = True Then
    				Next
    					Else
    						data = data + itm.PlayCounter
    			End If
    					Else
    						data=strSQL
    		End If
    		itm.Custom3 = data
    		itm.UpdateDB
   			Next
End If			



End Sub
Post Reply