Page 4 of 6
Posted: Sat Jul 16, 2005 8:11 am
by Anubis
Anonymous wrote:
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?

What version of MM are you using?
Try 2.4.2, I'm pretty sure the code tables bug is corrected in 2.4.2.
Posted: Sat Jul 16, 2005 3:37 pm
by Guest
241.862 is the version i have did not relize i did not get the updated one ? will check with that maybe it will fix the trouble with my other script not starting in the auto folder thread also.

Posted: Sun Jul 17, 2005 8:22 am
by Guest
okay got the new one and it did not fix the trouble with my script in the other thread.
but not sure on this playcounter script as i got them all changed before?
i guess i could change them just to test it?
okay it changes more then 300 now.

Posted: Fri Aug 12, 2005 6:48 pm
by mjs93
I was afraid to try all these scripts because I'm pretty scripts-stupid, but I finally had to to keep my stats balanced. This is great! I used PlayCounter.vbs (the second one posted) and IncrPlayCntr.vbs. Just wanted to say thanks.

Btw, is this still a problem?
Pablo wrote: You're right! My Set Counter and Set Counter (advanced) scripts DO NOT update the database. Maybe the playCounter field was somehow implemented as read-only...
...because they seem to update fine for me?
ETA: Just found a couple of things, when you click "Restore Play Counter," your playcounter reverts to MM count only and loses the iPod song counts you synced to it. That was when I was only using PlayCounter.vbs. Then after installing IncrPlayCntr.vbs, Restore Play Counter won't work at all. Hmm.
Well, still many thanks for these scripts!
Glitchy weirdness
Posted: Thu Aug 25, 2005 8:51 pm
by Guest
Hallo All-
I'm running 2.4.2.874, and when I try the IncrPlayCounter script, either it seems not to work (even after tapping F5),
or returns an error indicating that "...a related record is required in the table 'Songs'"
Then I get another, more specific, pointing to Line 29, Column 4 of IncrPlayCntr.
All this is being attempted on a playlist actually located on my Archos. Is that an issue?
I get the same result on the whole list, three files, of just one.
I've perused the Forum topic wher I found the scripts, and I don't think this was mentioned
The Change Play Counter script seems to work fine. Anything I'm missing/got botched?
Thanks mooch,
-G
Modifying play count for tracks on a Mass Storage device
Posted: Thu Nov 24, 2005 11:01 pm
by jwc905
I installed this script in the hopes that I could manually update the play statistics for my iAudio X5 (a mass storage device) whenever I synced it up. Unfortunately I ran into a little snag.
The process I planned to use was to take whatever playlist I had been listening to, select upto whatever track I was on, and then run this script. Then I would be able to generate a new playlist which reflected these changes.
Unfortunately the playlists I'm using are auto playlists so the version on MM doesn't reflect the one on my X5. If I run this script using the playlist on my X5 then I get a lot DB errors.
The only solutions I can see are:
1) save a copy of the autoplay lists when I sync so that I can refer to them on the next sync
2) Somehow map the tracks on the iAudio back to the MM library. Which should be possible they were generated by MM in the first place.
Does anyone have any tips on how I might go about modifying this script or using a set of scripts to accomplish the above?
Thanks in advance,
Jeff
Posted: Fri Dec 16, 2005 8:20 pm
by rovingcowboy
I am now having trouble with this script in beta version 4.
it is not changing the playcount to any other number then zero.
i think i am using the last script in the thread.
i am not sure whom wrote it. as there were so many updating it.
but i use to beable to change the code from +1 to +500 and change the count to 500 or make it -5000 and change the count down 5000 from what it was?
but now it only changes to 0 not a big problem unless you want to make certian songs show up in the top 50 list at different times of the year. like now it is christmas time so i was trying to up all the christmas songs to be the only ones in the top 50 list but it zero'ed them all so now i have to keep making all the other songs zero so the christmas songs add to their count and the rest do not?

Posted: Fri Apr 14, 2006 9:22 am
by Guest
Pablo.
is there any way you can make this script of yours run automatily and only run at a set day and time like once a week and make all the songs get auto selected and then reset back to zero?
if that can be done then this script combined with the auto rating script will be a great way to keep a weekly top of the charts play list.
thanks
roving cowboy / keith hall.
not logged in this moring
Posted: Mon Apr 17, 2006 11:02 pm
by MeMeMe
When using the advanced script I get the following error:
There was a problem querying the database:
42000:[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
I'm using MM 2.5.2.951
Here's the code I used
Code: Select all
Sub SetPlayCounter
' Define variables
Dim list, itm, i, newPlayCounter, mb, progress
'Get a new value for the Play Counter from the user
newPlayCounter = InputBox("Enter the new value for the Played field", "Set Play Counter")
'If Canceled, exit
If newPlayCounter = "" Then
Exit Sub
End If
'Check that the text entered is a valid parameter. Inform user if it isn't.
If Not IsNumeric(newPlayCounter) Then
mb = MsgBox("You did not enter a number. Please try again.",0,"Error")
Exit Sub
ElseIf newPlayCounter < 0 Then
mb = MsgBox("Only positive numbers or 0 are allowed. Please try again.",0,"Error")
Exit Sub
End If
' Get list of selected tracks from MediaMonkey
Set list = SDB.SelectedSongList
If list.count=0 Then
Set list = SDB.AllVisibleSongList
End If
'No songs selected?
If list.count = 0 Then
mb = MsgBox("No songs were selected. Please select some songs and try again",0,"Error")
Exit Sub
End If
'Set up progress
Set Progress = SDB.Progress
Progress.Text = "Writing New Play Counters..."
Progress.MaxValue = list.count
'Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)
'Set the Play Counter
itm.PlayCounter = newPlayCounter
itm.UpdateDB
Progress.value = i+1
If Progress.terminate Then
Exit For
End if
Next
Set Progress = nothing
End Sub
Sub ResetPlayCounter
'This is drastic, so require confirmation from user
Dim yesimsure
yesimsure = InputBox("Are you sure you want to reset the play counter for all tracks in the Library? Write YES to proceed. Note: You will have to refresh the view (F5) in order to see the changes.", "Reset Play Counter")
If yesimsure <> "YES" Then
Exit Sub
End If
'Reset the counter...
SDB.Database.ExecSQL("UPDATE SONGS SET PLAYCOUNTER = 0 WHERE TRUE=TRUE")
End Sub
Sub RestorePlayCounter
'This is drastic, so require confirmation from user
Dim yesimsure
yesimsure = InputBox("Are you sure you want to restore the play counter to the number of times each track was played in MediaMonkey? Write YES to proceed. Note: You will have to refresh the view (F5) in order to see the changes.", "Restore Play Counter")
If yesimsure <> "YES" Then
Exit Sub
End If
Dim Str1, Str2, Str3, Str4, Str5
'Create a temporary table which stores song IDs and the number of times each song was played
Str1 = "SELECT Songs.ID, timesPlayed INTO updateCounter "
Str2 = "FROM Songs, [SELECT Played.idSong as SID, Count(Played.idSong) AS timesPlayed FROM Played GROUP BY Played.idSong]. AS subq "
Str3 = "WHERE Songs.Id =subq.SID"
SDB.Database.ExecSQL(Str1 & Str2 & Str3)
'Use the table just created to update the playCounter field in the songs table
Str4 = "UPDATE Songs, updateCounter SET songs.playcounter = updateCounter.timesPlayed "
Str5= "WHERE songs.id=updateCounter.id"
SDB.Database.ExecSQL(Str4 & Str5)
'Delete temporary table
SDB.Database.ExecSQL("DROP TABLE updateCounter")
End Sub
Function Min(x, y)
If x<y Then
Min = x
Else
Min = y
End If
End Function
Function Max(x, y)
If x>y Then
Max = x
Else
Max = y
End If
End Function
Sub SetPlayCounterAdvanced
' Define variables
Dim list, itm, i, userInput, newC , mb, progress, C
'Get a new value for the Play Counter from the user
userInput = InputBox("Enter a formula for the new play counter. Use C to refer to the current value. Examples: 0, C+1, Max(1,C).", "Set Play Counter (Advanced)")
'If Canceled, exit
If userInput = "" Then
Exit Sub
End If
' Get list of selected tracks from MediaMonkey
Set list = SDB.SelectedSongList
If list.count=0 Then
Set list = SDB.AllVisibleSongList
End If
'No songs selected?
If list.count = 0 Then
mb = MsgBox("No songs were selected. Please select some songs and try again",0,"Error")
Exit Sub
End If
'Set up progress
Set Progress = SDB.Progress
Progress.Text = "Writing New Play Counters..."
Progress.MaxValue = list.count
'Process all selected tracks
For i=0 To list.count-1
Set itm = list.Item(i)
C = itm.playCounter
'Evaluate user input
newC = Eval(userInput)
'Set the Play Counter
itm.PlayCounter = SDB.database.execSQL("UPDATE Songs SET PlayCounter=" & newValue & " WHERE Id=" & itm.songID)
itm.playCounter = itm.playCounter + 1
itm.updateDB
Progress.value = i+1
If Progress.terminate Then
Exit For
End if
Next
Set Progress = nothing
End Sub
Posted: Wed Apr 26, 2006 2:32 pm
by agentsmart
i just re read this whole thread and it looks like you got pablos first or second script. check page 3 and get that last one there.
see if that works for you.

Posted: Thu Apr 27, 2006 4:31 am
by MeMeMe
Are you referring to the second one by Anubis on that page?
Posted: Thu Apr 27, 2006 7:49 am
by rovingcowboy
i looked at that page and i think he is meaning the same code i reposted in the new thread here of "auto weekly top of the charts thread."
as i got the same code from that page and that is the one that works

Posted: Thu Apr 27, 2006 7:59 am
by MeMeMe
Okay, thanks.
Posted: Tue Jan 01, 2008 2:35 pm
by clubsoda
Hi all,
I'm using the script Anubis posted on page 3 of this thread - MM 3 (3.0.1.1127) does something weird with the date when I try to increment the play counter:
The "last played" field changes to 31.12.1899, 00:14. It seems that the new year has something to do with it, but I'm totally clueless about scripting. Does anyone have an idea?
Thx
Posted: Tue Jan 01, 2008 4:08 pm
by rovingcowboy
its old code i even took it off my win98 it does mess up things.
and it was not wrote with mm 3 even in mind. it was done for mm 2.0 or 2.1 way back.