Author: MarquisEXB

Link: http://forums.winamp.com/showthread.php?postid=1868998#post1868998

You’ll want to edit this section, it should be relatively self explanatory. The genres are comma seperated, and each one will give you Genre Begins ‘XXX’. Year will give me a year between today & 1977.

genres=cSTR(InputBox("Genre(s) BEGINS with... ?","GENRES","alt,new,punk,lo,hip-r,ska")) 
Randomize 
ranYear = int(rnd()*datediff("yyyy", #01-01-1977#, now())) + 1977 
years=cSTR(INputBox("Year? [ex: > 2000) -- or > 1995 AND Year < 2000]","YEAR","year >= " & ranYear)) 
ratings = cSTR(InputBox("Ratings?","Rating","rating > 1 ")) 
Extra=cSTR(INputBox("Extra? [ex: & (lastplay < [3 weeks ago] OR playcount < 1)","EXTRA","(lastplay < [3 weeks ago] OR playcount < 1)"))

playlist_1_Albums_Random.vbs

 
on error resume next 
Randomize 
 
'dim i,j,Dict1,tracks,num,idxs 
 
TheQuery=getMLQquery("type=0 &! (album ISEMPTY)") 
msgbox TheQuery 
 
mlq = medialibrary.runqueryarray(TheQuery) 
 
Set Dict1 = CreateObject("Scripting.dictionary") 
Dict1.CompareMode = BinaryCompare 
 
i = 0 
AllAlbums="" ' string that contains all album names 
 
for each track in mlq 
if instr(AllAlbums,ucase(track.album)) = 0 then 
    i = i + 1 
    AllAlbums=AllAlbums&vbcrlf& ucase(track.album) 
    Dict1(ucase(track.artist))=Dict1(ucase(track.artist)) & vbcrlf & _ 
         CStr(i) & asc(178) & ucase(track.album) 
end if 
next 
 
itms = Dict1.Items 
numArt=ubound(itms)+1 
 
num = CInt(InputBox("Albums: " & i & vbcrlf & _ 
        "Artists: " & numArt & vbcrlf & _ 
         "Choose the # of albums","#","3")) 
 
if numart>=num then 
 
do while (tracks<num) 
 
safe = 0 
 
        do 
                safe=safe+1 
            Randomize 
                RandArtist = Int(numArt*Rnd) ' This is the artist 
        loop until (safe > 10000) or (instr(AllArtists,RandArtist & ";")=0) 
 
        AllArtists=AllArtists & RandArtist & ";" 
        'msgbox AllArtists & vbcrlf & "-" & itms(rand) 
 
        arrSong = Split(itms(RandArtist ), vbcrlf) 
        Randomize 
        TheAlbum = split(arrSong(int(ubound(arrSong)*RND +1)),asc(178) )(1) 
             
        InsertAlbum theAlbum 
 
        tracks=tracks+1 
Loop 
else 
msgbox "Too many songs" 
end if 
 
quit 
 
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
''''''''''''''''''''''''''''' FUNCTIONS 
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
 
function InsertAlbum(thealbum) 
 
mlq2 = medialibrary.runqueryarray("album = """ + thealbum + """") 
Set Dict2 = CreateObject("Scripting.dictionary") 
Dict2.CompareMode = BinaryCompare 
 
i = 0 
min=1000000 
max=0 
 
' This section is to sort by track number. 
 
for each song in mlq2 
    i=i+1 
    theTrack=song.track 
    Dict1(theTrack)=i 
    if theTrack<min then 
        min=theTrack 
    end if 
    if theTrack>Max then 
        max=theTrack 
    end if 
next 
 
for z= min to max 
    if len(dict1(z)) > 0 then 
        mlq2(dict1(z)).enqueue 
    end if 
next 'z 
 
set sep = LoadItem("X:-- " & thealbum  & " (" & ubound(mlq2) & ") --------------------------") 
sep.insert(playlist.count) 
 
mlq2="" 
end function 
 
private function getMLQquery(strInitial) 
' This asks the user some questions so that 
' you can choose music as you see fit. 
 
dim genres,years,ratings,extra 
 
genres=cSTR(InputBox("Genre(s) BEGINS with... ?","GENRES","alt,new,punk,lo,hip-r,ska")) 
Randomize 
ranYear = int(rnd()*datediff("yyyy", #01-01-1977#, now())) + 1977 
years=cSTR(INputBox("Year? [ex: > 2000) -- or > 1995 AND Year < 2000]","YEAR","year >= " & ranYear)) 
ratings = cSTR(InputBox("Ratings?","Rating","rating > 1 ")) 
Extra=cSTR(INputBox("Extra? [ex: & (lastplay < [3 weeks ago] OR playcount < 1)","EXTRA","(lastplay < [3 weeks ago] OR playcount < 1)")) 
 
if len(extra) > 0 then 
    extra = " & (" & extra & ") " 
end if 
 
if len(ratings) > 0 then 
    ratings = " & (" & ratings & ") " 
end if 
 
if len(years) > 0 then 
    years = " & (" & years & ") " 
end if 
 
if len(genres) > 0 then 
 
genre=split(genres,",") 
 
if ubound(genre) >0 then 
genreline="&  (" 
    for each onegenre in genre 
        genreline=genreline & " genre begins """ & onegenre & """ OR " 
    next 
genreline = genreline & " Genre begins "" QQQ "") " 
else 
genreline="& GENRE BEGINS """ + genre(0) +"""" 
 
end if 
else 
genreline="" 
end if 
 
GetMLQquery= strInitial &ratings & genreline & years &extra 
end function
 
examples/playlist/enqueue_random_albums.txt · Last modified: 2006/11/06 15:44
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Music Plugins