Work in progress - Modify Play Counter via script
Last Played not updated
Nice script, the played counter increases by 1 as it is supposed to, but the field Last Time Played does not show any changes.
I'm using latest official MM Gold.
Any ideas?
I'm using latest official MM Gold.
Any ideas?
I decided to try out the IncrPlayCntr script and I am also finding that the LastPlayField is not getting updated in the Songs table. The date/time field in the Played table is being updated.
Here is the code segment in question...
Here is the code segment in question...
Code: Select all
For i=0 To list.count-1
Set itm = list.Item(i)
'must use sql because itm.UpdateDB does not update the PlayCounter property
SDB.database.execSQL("UPDATE Songs SET PlayCounter=" & (itm.PlayCounter + 1) & " WHERE Id=" & itm.songID)
SDB.database.execSQL("UPDATE Songs SET 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() & "')")
'refreshes screen
itm.playcounter = itm.playcounter + 1
itm.UpdateDB
Next
anyone any ideas?
Unfortunately I don't know anything about scripting. I checked in my database and the playcounter does increase with the script. But the lastplayed date does not get updated.
The script looks ok to me, but again... I have no clue what I am looking at.
The script looks ok to me, but again... I have no clue what I am looking at.
Yeah. I know a little about programming, but nothing specific about VBScripting. It looks fine to me too.
The only thing I can think of is it is some sort of date format (USA vs Australian vs European?) problem, but I tried different formats and it still didn't work. I also tried using #'s around the date and putting a hard coded date in. <very strange>
I am actually wondering whether it could be a BUG with MM 2.4.
Hopefully the MM developers will have a look and set us straight.
The only thing I can think of is it is some sort of date format (USA vs Australian vs European?) problem, but I tried different formats and it still didn't work. I also tried using #'s around the date and putting a hard coded date in. <very strange>
I am actually wondering whether it could be a BUG with MM 2.4.
Hopefully the MM developers will have a look and set us straight.
OK, here is what works for me...
Couple of comments.
- I was wrong, you can update scripts (or at least this one) and run it without stopping and starting MM.
- The problem as I see it, was that it was using execlSQL and UpdateDB. It seems only one or the other can be used against the data.
- This script does not refresh the screen, you need to do a manual REFRESH (F5). I couldn't see a way of forcing a refresh (I didn't look too hard either).
This works for me, hope it does for you.
Couple of comments.
- I was wrong, you can update scripts (or at least this one) and run it without stopping and starting MM.
- The problem as I see it, was that it was using execlSQL and UpdateDB. It seems only one or the other can be used against the data.
- This script does not refresh the screen, you need to do a manual REFRESH (F5). I couldn't see a way of forcing a refresh (I didn't look too hard either).
This works for me, hope it does for you.
Code: Select all
' 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
Good to hear it works for you too.
I use it to record the stats of what CD's I listen to in the car. I listen to music more in the car then anywhere else, and I have not liked that the "car stats" were not being collected.
One day I'll get an iPOD (and a car system that can handle an iPOD) and than MM will get the stats automatically.
I use it to record the stats of what CD's I listen to in the car. I listen to music more in the car then anywhere else, and I have not liked that the "car stats" were not being collected.
One day I'll get an iPOD (and a car system that can handle an iPOD) and than MM will get the stats automatically.
You must modify your scripts.ini file as well. It's described in the very first post in this thread. Then you'll find the script in Tools->ScriptsAnonymous wrote:i copied this last code you said works and saved it so now where do i put it and how do i use it to change the played count in the media monkey list's
thanks
Put this in your script.iniAnonymous wrote:so i got to go back and get all the other scripts? starting with the first one?
or do i just subitute this last script for the first script , and then copy the first script ini change in the first post?
Code: Select all
[IncrementPlayCounter]
FileName=IncrPlayCntr.vbs
ProcName=IncrPlayCntr
Order=20
DisplayName=Increment Play Counter
Description=Increment the play counter by 1
Language=VBScript
ScriptType=0
That should do it...
as a suggestion !!!
anyone copying the above ini code.
in the display name you might want to add " F5 for Results"
i had read some where in one of the posts? to stop and start media monkey so i was doing that until i thought to try refreshing the playlist..
also you can change that number one in the vbs script code to anything you want i even changed it to subtract the numbers and zero them back out.
only i have trouble with media monkey not beeing able to open code tables past the amount of 300?
makes it a little tiresome when you have 10,000 you want to change?
anyone copying the above ini code.
in the display name you might want to add " F5 for Results"
i had read some where in one of the posts? to stop and start media monkey so i was doing that until i thought to try refreshing the playlist..
also you can change that number one in the vbs script code to anything you want i even changed it to subtract the numbers and zero them back out.
only i have trouble with media monkey not beeing able to open code tables past the amount of 300?
makes it a little tiresome when you have 10,000 you want to change?