View Single Post
Old 20th May 2005, 01:23   #267
neFAST
Member
 
Join Date: Sep 2004
Location: Montreal
Posts: 56
Send a message via ICQ to neFAST
Here's is a "iTunes party suffle"-like i wrote.
Use it in combination with a playlist containing
PHP Code:
#EXTM3U
#EXTINF:-1,X:\¯¯¯¯¯¯Party Shuffle______________________
X:\¯¯¯¯¯¯Party Shuffle______________________.
I plan to check the number of tracks in playlist to maintain its size to 25
PHP Code:
' +----------------------+
|     Party Shuffle    |
' +----------------------+
Automatically enqueues a new song each time a song is played.
' Brought to you by neF4ST

Dim mlq,mlq2,artist,tracks
Randomize

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

Sub Application_ChangedTrack 

if playlist(1).filename="X:\¯¯¯¯¯¯Party Shuffle______________________.x" then

if playlist.position=1 then
    
' This is the first launch
    ' 
we add 20-1 songs
    
do while (tracks<=19)
       
Rand Int(ubound(mlq)*Rnd+1)
       
mlq2 medialibrary.runqueryarray("artist = """ mlq(Rand).artist """")
       
Rand2 Int(ubound(mlq2)*Rnd+1)
       
mlq2(Rand2).enqueue
       tracks
=tracks+1
    Loop
    
'now let's play
    play
end 
if

if 
playlist.position>5 then
    
' We add a new song
    Rand = Int(ubound(mlq)*Rnd+1)
    mlq2 = medialibrary.runqueryarray("artist = """ + mlq(Rand).artist + """")
    Rand2 = Int(ubound(mlq2)*Rnd+1)
    mlq2(Rand2).enqueue

    ' 
We remove the first song of the playlist
    playlist
.deleteindex(2)
end if

end if

End Sub 
neFAST is offline   Reply With Quote