I actually had a script that did just that, but Ive since deleted it.
You dont need to loop continuously, I have supplied a 'change song' event that you can respond to. AW will only invoke your method when the song changes.
It would look similar to:
---startup_playcount fix.vbs-----
Dim pos, timerid
timerid = -1
pos = -1
Sub Application_ChangedTrack
if (timerid <> -1) Then
CancelTimer timerid
End if
pos = playlist.position
set mi = playlist(pos)
mi.playcount = mi.playcount - 1
timerid = SetTimeout (10000, GetRef("IncCount"))
End Sub
Sub IncCount
if (playlist.position = pos) Then
set mi = playlist(pos)
mi.playcount = mi.playcount + 1
end if
tiemrid = -1
End Sub
-----------------
Be aware that this will fuck up with songs less than 10 seconds long etc. And probably a few other cases like when the song is not in the ml, has a zero playcount, http streams, you move the song in the playlist during play etc etc. I will probably release a proper plugin that does this a bit more robustly, does calculations based on song length etc if you can wait.
A better script would probably store the filename of the currently playing song then check that after 10 secs rather than the current playlist pos. Or cache the "mi" and check the filename of that vs the currently playing filename on the timer event. Left as an exercise...
You dont need to loop continuously, I have supplied a 'change song' event that you can respond to. AW will only invoke your method when the song changes.
It would look similar to:
---startup_playcount fix.vbs-----
Dim pos, timerid
timerid = -1
pos = -1
Sub Application_ChangedTrack
if (timerid <> -1) Then
CancelTimer timerid
End if
pos = playlist.position
set mi = playlist(pos)
mi.playcount = mi.playcount - 1
timerid = SetTimeout (10000, GetRef("IncCount"))
End Sub
Sub IncCount
if (playlist.position = pos) Then
set mi = playlist(pos)
mi.playcount = mi.playcount + 1
end if
tiemrid = -1
End Sub
-----------------
Be aware that this will fuck up with songs less than 10 seconds long etc. And probably a few other cases like when the song is not in the ml, has a zero playcount, http streams, you move the song in the playlist during play etc etc. I will probably release a proper plugin that does this a bit more robustly, does calculations based on song length etc if you can wait.
A better script would probably store the filename of the currently playing song then check that after 10 secs rather than the current playlist pos. Or cache the "mi" and check the filename of that vs the currently playing filename on the timer event. Left as an exercise...
Comment