Page 3 of 4

Posted: Fri Apr 28, 2006 4:15 pm
by Teknojnky
Pseudocode

on track changes (or other applicable event).

- Check if today sunday (or whichever week you wish to start on)

-- list songs played since last start_day

--- count number of plays per track within selected time_period

---- output to playlist and/or html export.

Posted: Fri Apr 28, 2006 4:23 pm
by rovingcowboy
Teknojnky wrote:Why can't a script simply calculate the top 40 songs played within the last week without reseting play counts?

becase i don't know how to script at all, i just found the parts of the script i could that would do what i want with some modifing but i could not do the modifing.

you could more then likely make one script figure out all the top of the charts songs for the week and post an autoplaylist that is played when programmed to play with the task scheduler scripts made by peke.

but i don't know how? all i know to do is get the play counter set to zero so the songs would be shown on the playlist as never been played then on the day of the week the auto playlist for the top of the charts is played
it would see only the songs that were played the most doing that week.

and play them. then on sunday change the counters back to zero for the next week.. other wise all you get in two weeks would be the same songs that were played the first week and played over the second week, then the third week, and so on and so on.

some songs would never be taken off the list because the count would get over the hunderds.

so simple idea was to reset the counter automaticly on sunday ever week.
thus getting afresh clean playcounter slate for that week.

the only playcounter being changed is the one that don't matter for ratings the history playcounter is the one that should be used for ratings. so your ratings never get erased once they are set unless you erase them.

so in the top of the charts list you could have a song played 5 times but have a rating of 1 stars because it was just put in the system that week and does not have a larger enough play count history for a larger rating.

does that help ? 8)

Posted: Fri Apr 28, 2006 4:31 pm
by rovingcowboy
Teknojnky wrote:Pseudocode

on track changes (or other applicable event).

- Check if today sunday (or whichever week you wish to start on)

-- list songs played since last start_day

--- count number of plays per track within selected time_period

---- output to playlist and/or html export.


you ever notice how when you get something figured out or close to being figured out there is always some one that says. 8)

well why did'nt you just do it this way? :o


my answer to them is simple.

if it was that easy for you then why in the :x did you make me suffer through figuring it out when i couldn't do it as well as you had already known how??

:roll: :P :lol: :D 8)

Posted: Fri Apr 28, 2006 4:35 pm
by Teknojnky
Ok, well does that mean my pseudocode appears to be what you want?

I may not necessarily be able to code it, but at least that will help make it clearer what the goal is and help find a more simple solution than brute force/complicated mismatches of various segments of script.

Posted: Fri Apr 28, 2006 4:52 pm
by rovingcowboy
well let me correct what you have so you can see what i wanted and needed better yet.?

Teknojnky wrote:

Pseudocode


on track changes (or other applicable event).

should be reset count on all songs nomatter if played in last week or not.




- Check if today sunday (or whichever weekday you wish to start on)

should be start on weekday you want to count as first day of week and run on that day one time then stop for that day wait until next week to run again.




-- list songs played since last start_day

should be list songs played last 7 days only keep to 59 minutes shown in auto playlist.





--- count number of plays per track within selected time_period

should be. list songs in order of playcount highest on top




[/b]

Posted: Fri Apr 28, 2006 5:02 pm
by Teknojnky
I don't understand why you are stuck on resetting playcounts if its possible to do what you want without resetting them.

That would just drive me crazy (losing playcounts).

Myself I would like to see something like you want, but no way in hell do I want my playcounts reset ever.

Posted: Fri Apr 28, 2006 5:13 pm
by rovingcowboy
i dont know how to figure the most played in a week with out changing the playcounter on the list.

those playcounts don't matter for anything anyway i been resetting them all the time to check the ratings script out.

they don't change the history playcount they are used only for showing how many times the song was played in a time line. you can reset them and it is just like reseting the time line.

you don't reset the main playcount which is stored in a different table in the database then the playcount shown on the playlists?

your not losing counts. only for that time line that you use, i want to set the time line to a week. others might want a month or a year or five years? but the longer time lines are really over kill since the long time line count is the played history playcounts.

the only thing i can think of is the playcounts with which i am changing might be in the tags of the songs? which is not really needed unless you move only your song to a new computer.

but even then your changing time lines from one computer to the other new one. so the play count should change in the tags.

but if your moving your database there also, then it will still have the history play counts in it.

which means your still not losing playcounts.
8)

Posted: Fri Apr 28, 2006 8:07 pm
by rovingcowboy
trixmoto wrote:I just forgot to declare it. Try this:

Code: Select all

  'code Author's 1. Pablo, 2. Roylayer 3. Popper 4. Anubis 5. Trixmoto
  ' 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
  Dim SDB
  Set SDB = CreateObject("SongsDB.SDBApplication")

    Dim s,itm
    Set s = SDB.Database.QuerySongs("")
    Do While Not s.EOF
      SDB.ProcessMessages
      Set itm = s.Item
 
      '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() & "')")
     
      s.Next
    Loop

Trixmoto there is an error when i use this in windows 98.

it is the loop thing that is messing it up in 98

when i run the script either by double clicking or starting with task schdeulder then tell it to stop by task scheduler the error shows up.

what it does is work it resets them all to one less playcount or to 0 when i put the = typo in i mentioned. takes a long time with 3 hard drives full of songs.?

but when i close monkey the vbsruntime error shows up saying the com's client was disconnected.
that sounds like the script is not ending.

and when i tried with the task scheduler it did the same thing it keep on running when the scheduler told it to stop.

so i closed monkey and got the same run time error.

it worked on the winXp no error at all. but on the 98 i got the error.

so i tried to put an
end if

or

on error exit

and a

SDB = nothing

lines one at a time in the code but i don't know what i am doing so it did not work?

thanks for fixing that for me as i don't know how to do that.

Posted: Fri Apr 28, 2006 8:08 pm
by DiddeLeeDoo
I got rid of that PlayCounter to Zero script.

Seems like this goes into another direction, of getting 'smarter playlists' instead of modifying data...

Since I do not do playlists, I'll leave it there for now...

Posted: Fri Apr 28, 2006 8:25 pm
by rovingcowboy
i don't really need to have the last playdate changed it is just in the script there was a report in the orginal thread for the script that the last date played part did not change the date anyway? so it just might be code junk sitting there.

all i want is to get the play count changed in the playlists so i can get an correct play count for the time line i want which is a week.

8)

Posted: Fri Apr 28, 2006 11:24 pm
by DiddeLeeDoo
Here's a supa-dupa simple 'Reset Songs PlayCounter to 0' for all the songs in the database, with F5 'refresh' included. (And tested on a virtual Win98 machine, non-gold version of MM)

Hopefully this script can be avoided by playlist configurations instead!
Had a look at Playlists today.. currently do not quite understand the value of them, since the AutoPlaylists are available, but then again I have a lot to learn about the 'Monkey Jungle'

BTW, an extra line is needed if you want last time played manipulated too

Code: Select all

' Roving Cowboy's Sunday Morning Script :) 
' By DiddeLeeDoo on 28 April 2006 
Option Explicit 
Dim SDB
Set SDB = CreateObject("SongsDB.SDBApplication") 
SDB.Database.ExecSQL("UPDATE Songs SET PlayCounter=0")
SDB.MainTracksWindow.Refresh

Posted: Sat Apr 29, 2006 6:39 am
by rovingcowboy
well that one looks a lot smaller too 8)

that code just seems to be getting slimmer all the time wish i could lose weight that fast ?
:roll:

Posted: Sat Apr 29, 2006 6:54 am
by DiddeLeeDoo
I'm sure we can do a script for that too... a weight loss script.. well, let's see, what if we first make sure all the songs with BPM > 180 is played when at nap time... Volume Level 100% and.... and Party Mode active, with hidden password, and not controls to user.... :lol:

If played for 10 minutes, then play Dance Music... for 3 hours... hehe

Posted: Sat Apr 29, 2006 7:09 am
by rovingcowboy
:o oh no that is fine i like my weight after all. :P :roll:

at nap time i play soft slow mellow meditation music,

that puts me out like a light if i listen to it. then right after that i play big band and popular music, if sing sing sing comes on it is fairly easy to wake up but if them slow waltz's come on i wake up after a 2 hour nap instead of a 1 hour nap.

i play all the fast rock at 5 am to wake me up in the morning mostly the beatles mixed with elvis the monkees and other good music i really dont like todays rock music it must have falling in a swamp before they play it.

because todays rock music stinks. and rap? don't even think that is music.

mostly country western bluegrass ( big band also inculdes the niteclub singers like nat king cole and dino ) classical with old classic rock

on sundays i play gospel music.

but i don't think i would like that script for weight loss that you suggested.

too much work. :roll:

Posted: Sat Apr 29, 2006 7:39 am
by agentsmart
okay stop the jokes thats my department to be a smart... :roll:
as you are starting with jokes does this mean that you are able to do what you want now cowboy? because i been wanting that playlist also. so please up date us on what is needed for which computers in order to do this.

thanks. 8)