Originally posted by DrO
i'm not afraid since i've got other projects in the works anyway
i'm not afraid since i've got other projects in the works anyway


Id like to addcode:
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile("C:\Program Files\Easyphp\www\songs_temp.txt", ForWriting, True)
mlq = medialibrary.runqueryarray("type = 0")
for each track in mlq
if track.ATFString("%year%") < 0 Then
MyFile.WriteLine(track.artist + ";" + track.album + track.ATFString(";%tracknumber% ") + track.title + track.ATFString(";%bitrate%;%lengthf%;;%genre%"))
Else
MyFile.WriteLine(track.artist + ";" + track.album + track.ATFString(";%tracknumber% ") + track.title + track.ATFString(";%bitrate%;%lengthf%;%year%;%genre%"))
End if
next
MyFile.Close()
set cmd1 = CreateObject("Wscript.Shell")
cmd1.Run "sort C:\Progra~1\Easyphp\www\songs_~1.txt /o C:\Progra~1\Easyphp\www\songs.txt"
quit
orcode:
set cmd2 = CreateObject("Wscript.Shell")
cmd2.Run "del C:\Progra~1\Easyphp\www\songs_~1.txt"
but both don't workcode:
cmd1.Run "del C:\Progra~1\Easyphp\www\songs_~1.txt"
It was a bit slow so I added "trackno = 1") in the first query so that each album is called one time. The drawback is that this will totally mess up the random if you don't have your tags correctly filled !code:
dim i,j,Dict1,keys,tracks
i = 0
x = playlist.getselection()
Set Dict1 = CreateObject("Scripting.dictionary")
Dict1.CompareMode = BinaryCompare
mlq = medialibrary.runqueryarray("type = 0 AND trackno = 1")
for each track in mlq
Dict1(track.artist)=i
i=i+1
next
Randomize
keys = Dict1.keys
do while (tracks<=10)
Rand = Int((Dict1.Count + 1) * Rnd)
mlq2 = medialibrary.runqueryarray("artist HAS """ + keys(Rand) + """")
j=0
for each track in mlq2
j=j+1
next
Rand2 = Int((j + 1) * Rnd)
mlq2(Rand2).insert(x(1).position)
tracks=tracks+1
Loop
quit
Comment