View Single Post
Old 16th April 2006, 04:55   #363
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 839
Thanks for the help shaneh! now i'm hoping for some more hehe. This has all inspired me to try and make the Party Shuffle script closer in it's functionality to that of iTunes. I believe i've done so but i've got some questions/roadblocks.

playlist_Party Shuffle.vbs
PHP Code:
' +--------------------------------------------+ 
|    Party Shuffle 2.0 (15 track version)    |
' +--------------------------------------------+ 
Automatically enqueues a new song each time a song is played.
' Brought to you by neFAST and osmosis.

Changes1Starts with correct # tracks (builds the backlog as it goes, as per iTunes).
'          2) Maintains total # on track change (deleting and/or skipping one or more tracks).

Todo1Make the ML query music only.
'       2) Weighted shuffling.
'       
3Change color of backlogged tracks.

Dim mlq,mlq2,artist,pos,pchg 
Randomize 

' "smart" random slightly faster with big libraries 
mlq = medialibrary.runqueryarray("type = 0 and trackno = 1") 

This is the first launch
' We clear the PL and add 10 songs
playlist.clear
do while (playlist.count<=9) 
   Rand = Int(ubound(mlq)*Rnd+1) 
   mlq2 = medialibrary.runqueryarray("artist = """ + mlq(Rand).artist + """") 
   Rand2 = Int(ubound(mlq2)*Rnd+1) 
   mlq2(Rand2).enqueue 
Loop 

Now let's play 
play 

Sub Application_ChangedTrack

if playlist.position>6 then 
   ' 
We delete however many the PL position has changed by
   pos
=playlist.position-6
   pchg
=0
   
do while (pos>pchg)
      
playlist.deleteindex(1
      
pchg=pchg+1
   Loop 

end 
if

if 
playlist.count<=(playlist.position+8then
   
' We add songs until there's a backlog of 5 (startup)
   
' or until we've reached 15 again
   
do while (playlist.count<=(playlist.position+8))
      
Rand Int(ubound(mlq)*Rnd+1
      
mlq2 medialibrary.runqueryarray("artist = """ mlq(Rand).artist """"
      
Rand2 Int(ubound(mlq2)*Rnd+1
      
mlq2(Rand2).enqueue 
   Loop 
   
end 
if

End Sub 
First, about my todo list, I read your post on weighted shuffling earlier in the thread, so skip #2, but I was wondering if you could help me with #1 and was wondering if #3 was possible (i'd like to do it, if so, but if not, i don't care since it's only for asthetics).

Second, the big problem. I like being able to trigger Party Shuffling from the Script menu, this loads the script and the script needs to stay loaded for the ChangedTrack event to trigger. But that's a problem because that means there's nothing to quit the script and turn off Party Shuffle. any ideas?

thanks so much for the plugin and i'm greatful for any help you can provide.
osmosis is offline   Reply With Quote