need a script for top 50 lists

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: need a script for top 50 lists

by Guest » Wed Apr 05, 2006 3:44 pm

check out this thread for more on this playlist thing.

http://www.mediamonkey.com/forum/viewto ... 2424#42424

rovingcowboy / keith hall.

not logged in

by rovingcowboy » Fri Mar 24, 2006 12:40 am

your right confused it is over my head,

i just can not figure it out, and i don't think

and one else wants to do this, right now since

there are lots of errors still trying to be figured out.

by confused » Wed Mar 22, 2006 1:27 am

so how about it is anyone going to do this since cowboy can't understand it.
and neither can i but it is a good idea for a script? :-?

by rovingcowboy » Fri Mar 17, 2006 3:24 pm

i am only able to adjust or reconfigure somebody elses javascripts to make them work the way i want to i do not know codeing enough to make one from scratch and what i do know takes me 20 times long to do then some one that can do codes.

so what you just said about subs and functions can be sum'ed up with one sound.

wooooosh!!

:o

by Steegy » Fri Mar 17, 2006 8:00 am

The Script Runtime that is used in MediaMonkey can handle VBScript, as wel as JScript (javascript). These two languages are similar so it shouldn't be difficult no "translate" this VBScript into a JScript.
For the same reason, VBScript programs can be easily understood by JScript programmers, and also the other way around.
Once you know one (general) programming language, you mostly can easily understand other languages. The only thing you need to know when you write a new language is the small differences (e.g. VBScript has "subs" and "functions", JScript calls these both "functions", comment mark ' changes to //, ...)

Cheers
Steegy

by rovingcowboy » Fri Mar 17, 2006 12:42 am

could something like this be done in javascript? and added in to monkey?
if so i might be willing to learn how since i am trying to do javascripts on my web page?

:-?

by brianon » Wed Mar 15, 2006 6:49 am

no worries.
I wrote it a while ago and have been using.

Its far from perfect but does the job for me :)

I have just run it once a month to create monthly charts as playlists.

by Guest » Wed Mar 15, 2006 12:06 am

script did not work in this winXp with the latest rc 3 version of monkey.

it told me there was no teplt in the mdb and i did not have access for the mdb or could not access the mdb with out permission? strange.

i took the ini part back out of the file and kept the others there just in case you can figure out what was wrong.?

but i was right you do need to fill in the info all the time and save it to a new playlist every time.

i am lazy that is too much work for me i want it to do it by it's self. :lol: but thanks for the effort. 8)

rovingcowboy / keith hall

just fence leanin' again.

by Guest » Tue Mar 14, 2006 9:30 am

this looks like it requires user input every week.

is it possible to make it do all the date changes automaticly ?

and to replace the playlist it saves them to every week with out asking?

that would be great.

but thanks for this one right now. 8)

roving cowboy / keith hall.

not logged in just reaching over the fence.

by brianon » Tue Mar 14, 2006 7:27 am

Try this.
It'll ask for a start date and end date "dd/mm/yyyy".
And then the number of tracks to include.

I use it to create weekly/monthly/yearly charts.

It creates a playlist for you once complete.

scripts.ini

Code: Select all

[CreateChart]
FileName=CreateChart.vbs
ProcName=CreateCHart
Order=100
DisplayName=&CreateChart
Description=CreateChart
Language=VBScript
ScriptType=0
CreateChart.vbs

Code: Select all

Sub CreateChart
  ' define vars
  Dim strStartDate
  Dim strEndDate
  Dim strUSStartDate
  Dim strUSEndDate
  Dim strPlaylistName
  Dim strTmp
  Dim strSQL
  Dim strOut
  Dim strOut2
  Dim howMany
  Dim strPlaylistId
  Dim x


  '''''''''''''''''''' 
  ' get the start date
  strStartDate = ""
  strStartDate = InputBox("Enter the Start date [eg. '01/10/2005']", "Start Date") 
  
  'If Canceled, exit 
  If strStartDate = "" Then 
     Exit Sub 
  End If 
  
  'Check that the text entered is a valid parameter. Inform user if it isn't. 
  If Not IsDate(strStartDate) Then 
     mb = MsgBox("You did not enter a valid date. Please try again.",0,"Error") 
     Exit Sub
  End If

  ''''''''''''''''''''
  ' get the end date
  strEndDate = ""
  strEndDate = InputBox("Enter the End date [eg. '31/10/2005']", "End Date") 
  
  'If Canceled, exit 
  If strEndDate = "" Then 
     Exit Sub 
  End If 
  
  'Check that the text entered is a valid parameter. Inform user if it isn't. 
  If Not IsDate(strEndDate) Then 
     mb = MsgBox("You did not enter a valid date. Please try again.",0,"Error") 
     Exit Sub
  End If


  ''''''''''''''''''''''''''''''''
  ' make the name of the playlist
  strPlaylistName = "Chart-" & strStartDate & "--to--" & strEndDate

  ''''''''''''''''''''''''''''''''
  ' make sure it doesn't already exist
  strSQL = "select Count(Playlists.IDPlaylist) AS CountOfPlaylists from Playlists where Playlists.PlaylistName = '" & strPlaylistName & "'"
  Set qryStats = SDB.Database.OpenSQL(strSQL)
  strPlaylists = qryStats.StringByName("CountOfPlaylists")

  ' if it does exist see if the user wants to delete it
  If Not strPlaylists = 0 then
    strTmp = InputBox("Already have playlist with this name. Replace ? [y/n]", "Playlist Replace")

    If strTmp = "n" then
      Exit Sub
    else
      ' delete the playlist
      SDB.Database.ExecSQL("delete from Playlists where Playlists.PlaylistName = '" & strPlaylistName & "'")
    end if
  End If 


  ''''''''''''''''''''''''''''''''''''
  ' add the playlist to Playlist table
  SDB.Database.ExecSQL("insert into Playlists (PlaylistName, ParentPlaylist, Comment) values ('" & strPlaylistName & "',0,'Auto Generated Chart Playlist')")


  '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  ' create the list of songs for the playlist

  ' find out the max for the list
  howMany = InputBox("Is this a Top 50 (+ ties) or ... ?", "Top X")
  
 ' now get the ID of the playlist we added earlier
  strSQL = "select Playlists.IDPlaylist AS PlaylistId from Playlists where Playlists.PlaylistName = '" & strPlaylistName & "'"
  Set qryStats = SDB.Database.OpenSQL(strSQL)
  strPlaylistId = qryStats.StringByName("PlaylistId")

  ' if it does exist then we are screwed!
  If strPlaylistId = 0 then
    strTmp = InputBox("Playlist not created!", "Error")
  End If 
  
  ''''''''''''''''''''''''''''''''
  ' change the two dates from dd/mm/yyyy to mm/dd/yyyy for the comparision
  strUSStartDate = Month(strStartDate) & "/" & Day(strStartDate) & "/" & Year(strStartDate)
  strUSEndDate = Month(strEndDate) & "/" & Day(strEndDate) & "/" & Year(strEndDate)
  
  ' create the tmp table
  SDB.Database.ExecSQL ("drop table tmpIds")
  SDB.Database.ExecSQL ("drop table tmpChart")
  SDB.Database.ExecSQL ("create table tmpIds (IdSong int not null)")
  SDB.Database.ExecSQL ("create table tmpChart (IdSong int not null, SongCount int not null)")
  
  ' tmpIds
  strSQL = "select Played.IdSong AS Ids from Played where Played.PlayDate between #" & strUSStartDate & "# and #" & strUSEndDate & "# order by IdSong "  
  Set qryStats = SDB.Database.OpenSQL(strSQL)
  
  '''''''''''''''''
  ' insert into tmp
  While Not qryStats.EOF
    strOut = qryStats.StringByName("Ids")
    SDB.Database.ExecSQL("insert into tmpIds (IdSong) values (" & strOut & ")")
    qryStats.Next
  Wend
  
  ' tmpChart
  strSQL = "select distinct IdSong as topIds, Count(IdSong) as myCount from tmpIds group by IdSong"
  Set qryStats = SDB.Database.OpenSQL(strSQL)
  
  
  ''''''''''''''''''''''''
  ' insert into temp chart
  While Not qryStats.EOF
    strOut = qryStats.StringByName("topIds")
    strOut2 = qryStats.StringByName("myCount")
    SDB.Database.ExecSQL("insert into tmpChart (IdSong, SongCount) values ("&strOut&","&strOut2&")")
    qryStats.Next
  Wend
  

  ' query the temp chart
  strSQL = "select TOP " & howMany & " tmpChart.IdSong as topIds from tmpChart order by SongCount DESC"  
  Set qryStats = SDB.Database.OpenSQL(strSQL)
  
  x = 0
  While Not qryStats.EOF
    strOut = qryStats.StringByName("topIDs")
    SDB.Database.ExecSQL("insert into PlaylistSongs (IDPlaylist, IDSong, SongOrder) values (" & strPlaylistId & "," & strOut & "," & x & ")")
    x = x + 1
    qryStats.Next
  Wend
  
  
End Sub


'strSQL = "select distinct Played.IdSong as topIds, Count(Played.IdSong) as myCount from Played where Played.PlayDate between #" & strStartDate & "# and #" & strEndDate & "# group by IdSong"  

by Guest » Fri Mar 10, 2006 11:23 pm

i thought script was easier?

i have magic nodes from last november or so. i tried to create a node with it but it did not work so i took magic nodes out?

i must be to dumb to know how to use that?
:P

roving cowboy / keith hall.

just a leaning over the fence again.

by Steegy » Thu Mar 09, 2006 7:53 pm

My "code" is just the database data, equal to the auto-playlist that psyxonova suggested you to make. I knew you couldn't create/edit auto-playlists on your free version. That's why I made it, and gave you the code that you can use in your database (in case you can edit it). It's really just a workaround of the disability to add/edit auto-playlists in the standard (free) version. You can't edit the database, so my code doesn't have any value to you then.

Scripts are of course possible, but it should be possible to do this using Magic Nodes, if necessary after fixing a bug in that script.

Maybe ask this in the Magic Nodes forum. If you don't get a fix/answer there, a script can still be written. I (and possibly most other scripters) just don't want to do "useless" work, if the same can be archieved much easier with Magic Nodes.

Cheers
Steegy

by rovingcowboy » Thu Mar 09, 2006 5:29 pm

i don't know i was hoping it was easy to do with scripts but it looks like nobody can do it with scripts i hope they add in steegys code to the database?

8)

by Teknojnky » Wed Mar 08, 2006 6:07 pm

Psyxonova's instructions work only for songs on a rolling 7 day window, not a weekly generated Sunday thru Saturday Top 50.

I don't think its possible via auto-playlists, however I would think thats its possible via script.

I would seem to need to be weekly calendar based and generate static playlists similar to the recently added playlist node.

by rovingcowboy » Wed Mar 08, 2006 5:24 pm

psyxonova wrote:Too much trouble for nothing... kk here it is

Right click the Top 50 - Favorites playlist --> Save as AutoPlaylist.
Select a meaningful name (eg Last Weeks Chart)
Ok, now right click that Playlist --> Edit Auto Playlist
Click Add search criteria, select Property Last Played, Condition < (days ago), value 7 and click OK.

Save the playlist, there you are. This playlist shows all the Top played Track for the past seven days. It is offcourse updated automatically everytime you view/play it.

Thats it. I think that Steegy was too bored to describe that procedure and thats why he suggested adding it manually inside the Playlist tables. :lol: :lol: :lol:




I'll try that but i was wanting to list all the songs played the most in the last week, i notice you typed that the list would show only the most played track.? is that typo and should it be "tracks.".

not steegy's right i can not do that in the free version.

bex

if i can get a list to show only the songs played in the last week. then they will show the play count and i can order them in the list by playcount that will give me the thing i want.

is that possible?

Top