Page 5 of 6

Posted: Mon Jan 14, 2008 6:35 pm
by shoney
I have a version of this script installed but when I upgraded to MM3, it started putting 12/31/1899 as the last played date. Below is the code. Anyone have any ideas how to fix this problem?

' increments play counter and sets last time played to current date and time
' Source: http://www.mediamonkey.com/forum/viewtopic.php?t=1461
' modified to work with a non-English date format and to also update the "Played" table.
' you need to refesh (F5) the screen to see the changes.

Option Explicit

Sub IncrPlayCntr
' Define variables
Dim list, itm, i

' 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 itm = list.Item(i)

'must use sql because there is no itm.LastTimePlayed property
SDB.database.execSQL("UPDATE Songs SET PlayCounter=" & (itm.PlayCounter + 1) & ",LastTimePlayed='" & now() & "' WHERE Id=" & itm.songID)

' there is another DB table that stores when the song was played,
' so in order to stay consistent, we update this, too.
' This table is used for the "50 last played songs" playlist
SDB.database.execSQL("INSERT INTO Played (IdSong, PlayDate) VALUES (" & itm.songId & ", '" & now() & "')")

Next
End Sub

Posted: Tue Jan 15, 2008 1:17 am
by jk2587
You just need to convert the now() to a double by doing CDbl(now()) and it will show up properly.
Hope that works for you.

Posted: Tue Jan 15, 2008 1:51 pm
by shoney
thanks jk2587. So to make sure I have it right, it should read:

SDB.database.execSQL("UPDATE Songs SET PlayCounter=" & (itm.PlayCounter + 1) & ",LastTimePlayed='" & CDbl(now()) & "' WHERE Id=" & itm.songID)

Posted: Tue Jan 15, 2008 5:51 pm
by jk2587
Yep that should do it!

Posted: Thu Jan 17, 2008 4:37 am
by Guest
I tried this today, but now I get 16.1.1900 00:14 (instead of todays's date, 10:29)

Do you have another advice maybe?

Thanks

Posted: Wed Jan 30, 2008 2:44 am
by dgcom
If you look closer, you'll see that there are 2 lines where now() function is used. You need to replace it with CDbl(now()) in both of them.

I just tried - it works!

Posted: Mon Mar 31, 2008 10:44 am
by spacefish
I'm looking for a script that will allow me to decrease playcounts. Will this script do that? I've read that it might be possible but I'm really not following how that could be accomplished. I'm also unclear on what modifications I need to make to the original script, if any.

If there is another, easier method to edit play counts, please point me to it. I understand I could have used Access for MM2. Is there an equivalent application for MM3's type of database that will allow me to see and edit values directly?

Thanks for any help!

Cheers,
Paula

Posted: Mon Mar 31, 2008 11:07 am
by nynaevelan
spacefish wrote:I'm looking for a script that will allow me to decrease playcounts. Will this script do that? I've read that it might be possible but I'm really not following how that could be accomplished. I'm also unclear on what modifications I need to make to the original script, if any.

If there is another, easier method to edit play counts, please point me to it. I understand I could have used Access for MM2. Is there an equivalent application for MM3's type of database that will allow me to see and edit values directly?

Thanks for any help!

Cheers,
Paula
Paula:

You could try the Change Playcounter script, that is what I use when I want to change playcounts.

Nyn

Posted: Mon Mar 31, 2008 12:14 pm
by spacefish
nynaevelan wrote:You could try the Change Playcounter script, that is what I use when I want to change playcounts.
OMG, that's awesome! And it worked out of the box. Thanks, Nyn! :)

Posted: Tue Apr 15, 2008 9:10 am
by martialartsguy
Can anyone tell me what's the newest updated version of this and if/how well it works with MM3.

Thanks!

Posted: Thu May 01, 2008 3:35 pm
by dypsis
There are a few scripts posted in the thread.

Which is the best one?

Also. Why do we need scripts to reset the play counter? Shouldn't this be a built-in feature?

Re: Work in progress - Modify Play Counter via script

Posted: Thu Mar 12, 2009 11:34 am
by rrfpacker
I see the latest post is from the middle of 2008 and noone responded. I hope this thread is still active.

I installed MM about 9 months ago, I only put a few songs into library so I could play and learn. Now that I am going to keep MM, I want to be able to reset my playcounts before I start filling in the library.

I installed the first script in the thread and inserted the corresponding script in the script.ini file. I can't tell if this works or not. The playcount field in track properties, classification tab does not change when I use Reset Play Counter and press F5. It does change if I use the Set Play Counter script.

I suppose I could use the Set Play Counter to set all songs to 0, but then what is the point for Reset?

As a couple others have posted, which one of the many scripts in this thread are the ones to use?

Re: Work in progress - Modify Play Counter via script

Posted: Thu Mar 12, 2009 11:46 am
by nynaevelan
RRF:

I am sure you will get many opinions on which is the "best", however I find Bex's AddRemove PlayStats offers the most flexbility and it is one of the most used scripts in my arsenal. :wink:

Nyn

Re: Work in progress - Modify Play Counter via script

Posted: Thu Mar 12, 2009 11:50 am
by Benn
I second that ^^. :D

Re: Work in progress - Modify Play Counter via script

Posted: Thu Mar 12, 2009 2:10 pm
by rrfpacker
I was actually talking about this particular script as it seems there are a couple versions along with other people's modifications. Looks like only the Set Playcount works for me, not the Reset Playcount. Does that mean that this script and AddRemovePlayStats are redundant?

However, I have played with AddRemovePlayStats quite a bit today, along with others, to reset all of my tracks at once (I've been practicing on just artists today), since I will begin to fill my library soon. Looks like AddRemovePlayStats only has a couple actions that change more than one track at a time. I'll have to deal with that.

One other thing. I noticed that MR does not completely agree with the Playing History & Stats node. A couple counts are off by one (not a biggee) but MR has two artists in the top 10 that I wiped out their playcounts.

Does it make sense to reset remove all plays if I reset the playcount? Is that the issue in MR?

Guess I have more to learn about these relationships.