Old 15th April 2006, 14:00   #361
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
hi i need some stupid newbie help. i'm trying to make this script work all the time without any user interaction other thatn playing the "trigger." so i've got it named startup_Party Shuffle.vbs and it's in the Scripts folder and all that, but it only works the first time after Winamp's started.. I assume this is because it IS a "startup" script. I have little-to-no scripting knowledge but i tried doing a do while loop for the whole script.. that just gave me CPU 100%. so what do i need to modify to make it do what i want (work correctly ANY time the trigger is played, not just the first)?

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 15th April 2006, 23:30   #362
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
@breakhead: getselection is broken for the latest versions of Winamp. Be sure to use the .dll from the CVS for the fixes to this and other problems. You can, and should, exit a script with 'Quit'. You can see the running scripts through the preferences window of the plugin.

@osmosis:
Sub Application_ChangedTrack

is an event function, it gets called everytime the track changes. You have the script run at startup, and by having this event function, AW will automatically call your function every time the track changes. Call 'quit' to exit the script.

Alternatively, you can have a 'script:/' entry in your playlist, which will actually call a script file when winamp gets to it in your playlist, which is probably a better solution.
shaneh is offline   Reply With Quote
Old 16th April 2006, 04:55   #363
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
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
Old 16th April 2006, 16:45   #364
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
also i'd like to be able to take the file info from the ML instead of winamp having to load it in itself, because that seems to slow down the enqueuing a fair bit. i know there's a winamp option that makes it take info from the ML whenever possible, but is there a way to hardcode it into the script so that if it's not on it'll still be fast for those that don't enable that option?

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 18th April 2006, 06:51   #365
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
forget about the color, i know it's impossible and was a stupid question. and i figured out how to make sure it was only music; i guess neFAST must have forgot to include a type=0 in the final query that enqueues the files. also forget the above posted problem on meta data. i understand now that AW already uses the ML item data, and though it still seems a bit slow, i guess that's Winamp's fault?

i still need help with being able to stop the script. I'm hoping for a solution that won't cause the script to stop being self-contained. is there a way to place a trigger in the Scripts menu? the trigger could set a value that everything else could hinge on. that way i could make it a startup script; this would probably be ideal. another solution i imagined was if there were an event that could be triggered by clearing the playlist. so when someone didn't want to party shuffle anymore they could simply clear the playlist and the script would quit. it's fairly intuitive and would allow the script to remain a playlist script. it's not an overly common PL editor event so perhaps it could be worked in? another option is stoping it from another script. it seems odd to me to be able to call scripts but not terminate them from another. also i'd like to suggest that the script:// playlist item have an "endscript://" counterpart.

one last thing i'd like to know is if anyone can think of a better way to narrow down a query to only single instances of artists. this would make randomizing based on artist easier. neFAST's method involved only artists with trackno = 1, but naturally, not all artists in a song library will have a track 1.

Request: A little SmartView Query Language love.

Last edited by osmosis; 18th April 2006 at 08:59.
osmosis is offline   Reply With Quote
Old 19th April 2006, 00:05   #366
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
@osmosis:
Yes stopping scripts is a bit of a pain, you can terminate a script from the ActiveWinamp preferences window which lists running scripts. Alternatively, you can hook the end of playback / stop event and quit then. But I do intend to have a sub menu which lists the running scripts so you can terminate them easily, or something like that.

ActiveWinamp should automatically take the info from the ML if it is available, and will load the ML if it isn't loaded.

The reason your script is slow is because you are doing a ML query in a loop. ML queries are very slow. You are better off doing one query, and loading everything you need into a dictionary and index out of that. There are a few examples floating around using the dictionary object. You can then do a query of "" and get all items in your ML, and just load the dictionary object using the artist as an index. Theres a few examples of this on the AW wiki.

The runquery stuff has changed a bit from the version on the plugin page and the version in the CVS. The one in the CVS does a keyword search by default, the one on the plugin page does a query search. To do a query search in the CVS version just prefix '?' to the query.
shaneh is offline   Reply With Quote
Old 19th April 2006, 00:20   #367
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
hmm i believe i'm using the one from the CVS (1.0.0.1?) but when i prefix my queries with ? i get a "Rand out of bounds" error.

is that a no to my playlist event proposal? hehe

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 19th April 2006, 00:37   #368
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
I dont think Winamp has a 'playlist cleared' event notification. You can hook buttons and what not, but thats a pretty crap way to do things. The truth is, Winamps API model is pretty shit.

I didnt want to add too many events and script management stuff, 'cause its not really a good idea to hook events with script. I dont recommend using scripts that run in the background, I dont think its quite robust or efficient enough for that. AW is really just intended to automate simple tasks like fixing up ratings and playcounts in your media library, generating pretty HTML playlist files, exporting/importing data around, enqueing a list of files from a txt file stored on a ftp site, downloading cover art, creating playlists based on stats in the ml, out of process access to Winamp and the ML etc. Just mainly to automate and easily customise things that run through once, instead of having to write lots of little plugins that perform really simple functions.

Some things are difficult to do in Winamp even with a stand alone plugin. Working with events, shuffling, playlist order overriding etc, cannot be done very elegantly in Winamp, with or without AW.
shaneh is offline   Reply With Quote
Old 1st May 2006, 05:10   #369
alexrussell
Junior Member
 
Join Date: May 2006
Location: Birmingham, UK
Posts: 7
Application_ChangedTrack not working any longer?

I recently updated my version of Winamp (it popped up a nice "you should probably update me now" message box upon startup so I went for it) to version 5.21 (x86) (and I use classic mode if that makes a difference).

Previously I had a script that basically submitted my artist and track data to my website for an "I'm listening to..." effect. I had the script in a file called startup_listento.vbs and AWA tells me it's loaded. However since this update (around the 8th of April) my script's Application_ChangedTrack event no longer fires.

So this post is just to ask whether this is just me or whether it's the new version of Winamp.


My script is basically this:

Dim artist, title
const url = "[my website]"
const blogname = "[my blogname]"
const password = "[my password]"

Sub Application_ChangedTrack
Dim mi
Set mi = playlist(playlist.position)
artist = deSpecial(mi.ATFString("%artist%"))
title = deSpecial(mi.ATFString("%title%"))

SendStats(url + "?blogname=" + blogname + "&password=" + password + "&artist=" + artist + "&title=" + title)
End Sub

Sub SendStats(url)
On Error Resume Next

Dim oXH
Set oXH = CreateObject("MSXML2.XMLHTTP")
oXH.Open "GET", url, True
oXH.Send
Set oXH = Nothing
End Sub

Function deSpecial(text)
deSpecial = text

deSpecial = replace(deSpecial, "?", "%3F")
deSpecial = replace(deSpecial, "=", "%3D")
deSpecial = replace(deSpecial, " ", "%20")
deSpecial = replace(deSpecial, "(", "%28")
deSpecial = replace(deSpecial, ")", "%29")
deSpecial = replace(deSpecial, "&", "%26")
deSpecial = replace(deSpecial, "@", "%40")
End Function


Thanks for any info you can give me.
alexrussell is offline   Reply With Quote
Old 10th May 2006, 21:51   #370
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
alexrussell: get the newest CVS revision of gen_activewa.dll from the sourceforge page and see if that fixes your problem. I've had no trouble with the ChangedTrack event.

anyone: since i have pretty much no knowledge of scripting and i just scrapped/hacked this together out of a couple other scripts with some minor ingenuity of my own, i was hoping that someone could look at my script and see if everything makes sense. please and thank you in advance to anyone who's willing.

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

Changes1Can be triggered via the Script menu
'          2) Start with base # of current items (builds the backlog as it goes, as per iTunes). 
'          
3On track changemaintains PL item total if any have been removedskippedetc
'             (note: iTunes updated automatically on remove but AW has no support for PL events). 
'          
4Randomization now includes all artists
'          5) Playlist now definitely contains only audio items. 
'          
6Dialog on launch to choose whether to clear the playlist
'          7) Script quits when playback is completely stopped. 
'          
8Switched to a Scripting Dictionary for faster querying and randomized loading

' Todo: 1) Weighted shuffling (in 3.0). 

May 102006 

Dim mlq
,i,j,Dict1,keys,startup,idxs,pos,pchg 

Set Dict1 
CreateObject("Scripting.dictionary"
Dict1.CompareMode BinaryCompare 

' This is the first launch 
startup=MsgBox("Start new Party Shuffle playlist?",_ 
        vbYesNoCancel+vbDefaultButton2+vbQuestion,"Winamp Party Shuffle") 

if startup=2 then 
   ' 
abort if requested 
   quit 
end 
if 

' clear PL if desired 
if startup=6 then 
   playlist.clear 
end if 

more inclusive
mlq MediaLibrary.RunQueryArray("type=0"


For each track in mlq 
   Dict1
(track.artist)=Dict1(track.artist) + ":" CStr(i
   

next 

Randomize 
itms 
Dict1.Items 

' fill the PL if needed (up to 10, any others will be added on track change) 
Do while (playlist.count<=9) 
   Rand = Int(Dict1.Count*Rnd+1) 
   idxs = Split(itms(Rand), ":", -1, 1) 
   Rand2 = CInt(idxs(Int(ubound(idxs)+1 * Rnd))) 
   mlq(Rand2).enqueue 
Loop 

if startup=6 then 
   ' 
Now let's play 
   play 
end if 

Sub Application_ChangedTrack 

if playlist.position>6 then 
   ' 
We delete however many the PL position has changed by 
   pos
=playlist.position-
   pchg
=
   
Do while (pos>pchg
      
playlist.deleteindex(1
      
pchg=pchg+
   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(Dict1.Count*Rnd+1
      
idxs Split(itms(Rand), ":", -11
      
Rand2 CInt(idxs(Int(ubound(idxs)+Rnd))) 
      
mlq(Rand2).enqueue 
   Loop 
   
end 
if 

End Sub 

Sub Application_ChangedStatus 

if PlayState=0 then 
   
' exit if state has changed to stopped 
   quit 
end if 

End Sub 
osmosis is offline   Reply With Quote
Old 11th May 2006, 15:58   #371
alexrussell
Junior Member
 
Join Date: May 2006
Location: Birmingham, UK
Posts: 7
I forgot to mention that I tried getting the latest CVS version. Well hopefully Winamp will have a new version out soon that I can download, and it'll fix the problem.

Thanks for your help anyway.



A little addendum, though, is that you shouldn't try to analyse my script. Just a simple script with a single 'MsgBox "Hi!"' statement doesn't work if in Application_ChangedTrack.

That is to say, if I have a script called blah.vbs [Edit: I mean playlist_blah.vbs] that contains exactly one line:

MsgBox "Hi!"

I can run that from the right-click menu perfectly. If I change it to:

Sub Application_ChangedTrack
MsgBox "Hi!"
End Sub

and name it startup_blah.vbs, it no longer works.

Last edited by alexrussell; 11th May 2006 at 17:12.
alexrussell is offline   Reply With Quote
Old 11th May 2006, 16:37   #372
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
hmm it might be the CVS, when i was testing out neFAST's old party shuffle it worked the first time i gave the trigger to it (which was an ChangedTrack event).. but it would only work the first time it saw it, even if i stopped it and tried to trigger it again. and didn't work until i restarted winamp (if i recall correctly). so maybe there is a problem with changedtrack and startup scripts. if the functionality of your script depends on a newer AW, then get the newest, if not, try downgrading, i thought the only thing that was broken in the upgrade to 5.2 was playlist.getselection.

here's the newest CVS that i've been able to get, SF's web CVS browsing seems whacked lately.
Attached Files
File Type: rar gen_activewa.rar (91.4 KB, 762 views)
osmosis is offline   Reply With Quote
Old 11th May 2006, 17:04   #373
alexrussell
Junior Member
 
Join Date: May 2006
Location: Birmingham, UK
Posts: 7
No, that version (which seems to be the same version I had if the 'file version' tag is anything to go by) didn't do it either. And it started going wrong with the latest stable (version 1.0) after I upgraded. THEN I upgraded AW to 1.0.0.1 (CVS) and it still didn't work.

Having said that, it actually kinda works every now and again with random intervals. And it's not specific songs (like I thought) as I play that song again and it doesn't work.

I upgraded Winamp on 8th April and that's when it stopped working. However since then it's logged three songs. Two were very close (25 mins apart) on 29th April, and one just a few minutes ago. These two instances (and three songs) were probably logged with the CVS 1.0.0.1 version, rather than the old 1.0 version, although I'm starting to think that makes no difference.

I'm very confused. Obviously the event is firing every now and again, but literally DAYS apart, and I play many songs a day.

It's got me very stumped. I wonder if I can downgrade Winamp without it doing any damage...


Edit: also just in case you were wondering (and I may have mentioned it in my first post but I don't remember) the script IS showing up in the "currently running scripts" section if run as a startup script. So the script IS being executed, just not very often.
alexrussell is offline   Reply With Quote
Old 11th May 2006, 17:08   #374
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
if you changed it to a playlist script and just left it resident, it would probably work. you could have a startup script that triggers it as a playlist script so it's further automated.

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 11th May 2006, 17:12   #375
alexrussell
Junior Member
 
Join Date: May 2006
Location: Birmingham, UK
Posts: 7
Sorry, I don't quite understand. How do I got about doing that?
alexrussell is offline   Reply With Quote
Old 11th May 2006, 17:14   #376
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
rename the script to playlist_listento.vbs

then restart winamp and you can run it from the Scripts menu in the playlist.

you could also make a startup_ltstart.vbs that called the playlist_listento.vbs. i don't recall what the function is to call another script but it should be on the wiki. that would automate it again so you wouldn't have to run anything.

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 11th May 2006, 17:23   #377
alexrussell
Junior Member
 
Join Date: May 2006
Location: Birmingham, UK
Posts: 7
Renaming it to playlist_listento.vbs and running it manually does nothing. It doesn't add it to the "currently running scripts" box. Is there something else I have to do?
alexrussell is offline   Reply With Quote
Old 11th May 2006, 17:30   #378
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
yeah, that means it's loaded. it has to be loaded before it'll work. so it doesn't work on track change when it's running as a playlist? that's all i had for ideas since i haven't run into any trouble with changedtrack in a playlist script, only in startup scripts. sorry.

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 11th May 2006, 17:44   #379
alexrussell
Junior Member
 
Join Date: May 2006
Location: Birmingham, UK
Posts: 7
Not being added to the "currently running scripts" box means it's loaded? Did you just read my reply incorrectly or am I not getting something?

Sorry I'm being a bit of pain with this, and thanks for all your help.

Go through again how to make it a playlist thingy?


Here's what I did:

1) Rename to playlist_listento.vbs
2) Reload Winamp
3) Yay! It's on the scripts menu
4) Click it
5) Nothing happens. Songs aren't logged, nothing appears in the "currently running scripts" box in the AW UI. Nothing at all.

Remedy?
alexrussell is offline   Reply With Quote
Old 11th May 2006, 17:59   #380
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
ohhh, sorry, i did read it incorrectly. i thought you said it WAS loaded. okay. sounds like your script is quitting itself for some reason i can't figure out from looking at it. that's my best guess at the problem.. no idea what the remedy is.

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 12th May 2006, 14:53   #381
alexrussell
Junior Member
 
Join Date: May 2006
Location: Birmingham, UK
Posts: 7
Well thanks for trying I suppose I'll have to just mess around with it. In a way I'm glad it's only my version (i.e. that AW isn't broken) but in a way I'm not. If AW was broken, it's more likely to be fixed (because it looks doubtful I can fix it myself).

Oh well. These things happen.
alexrussell is offline   Reply With Quote
Old 13th May 2006, 11:35   #382
mikkokh
Junior Member
 
mikkokh's Avatar
 
Join Date: Dec 2004
Location: Finland
Posts: 43
How to delay in boot?

Hi.

Seems that Winamp does not get my commands from Boot Script on boot time...
Script (VBS) is tested manualy from ActiveWinamp on Winamp running manualy and it works then, but i think that Winamp has not ready to get any commands so early boot time.

So, how i delay script on boot so log that Winamp is fully ready to complete actions?

Thanks.
mikkokh is offline   Reply With Quote
Old 13th May 2006, 16:16   #383
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
there are timers with which you can delay. not sure if there's an example on the wiki, but there's definitely mention of it in the out-of-date reference guide.

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 17th May 2006, 22:52   #384
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
we need some sort of bat signal for knowledgable coders.. citizens are in need!

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 18th May 2006, 18:20   #385
neFAST
Member
 
Join Date: Sep 2004
Location: Montreal
Posts: 56
Send a message via ICQ to neFAST
Hi folks. Funny to see that the party shuffle is still an issue at stake.
BTW I found the old "Rnd-bug" in the last version.
Here is a clean one with also a "weightening" attempt :P

PHP Code:
' +--------------------------------------------+ 
|    Party Shuffle 2.0 (15 track version)    | 
' +--------------------------------------------+ 
Automatically enqueues a new random song each time another is played
' An ActiveWinamp script brought to you by osmosis and neFAST. 

Changes1Can be triggered via the Script menu
'          2) Start with base # of current items (builds the backlog as it goes, as per iTunes). 
'          
3On track changemaintains PL item total if any have been removedskippedetc
'             (note: iTunes updated automatically on remove but AW has no support for PL events). 
'          
4Randomization now includes all artists
'          5) Playlist now definitely contains only audio items. 
'          
6Dialog on launch to choose whether to clear the playlist
'          7) Script quits when playback is completely stopped. 
'          
8Switched to a Scripting Dictionary for faster querying and randomized loading

' Todo: 1) Weighted shuffling (in 3.0). 

May 102006 

Dim mlq
,i,j,Dict1,keys,startup,idxs,pos,pchg 

Set Dict1 
CreateObject("Scripting.dictionary"
Dict1.CompareMode BinaryCompare 

' This is the first launch 
startup=MsgBox("Start new Party Shuffle playlist?",_ 
        vbYesNoCancel+vbDefaultButton2+vbQuestion,"Winamp Party Shuffle") 

if startup=2 then 
   ' 
abort if requested 
   quit 
end 
if 

' clear PL if desired 
if startup=6 then 
   playlist.clear 
end if 

more inclusive
mlq MediaLibrary.RunQueryArray("type=0"


For each track in mlq
   
' rating weight (you may want to change the 3 coeff)
   weight = 0
   Do while (weight<=track.rating*3)
      Dict1(track.artist)=Dict1(track.artist) + ":" + CStr(i) 
      weight = weight + 1
   Loop 
   i = i + 1
next 

Randomize 
itms = Dict1.Items 

fill the PL if needed (up to 10any others will be added on track change
Do while (
playlist.count<=9
   
Rand Int(Dict1.Count*Rnd+1
   
idxs Split(itms(Rand), ":", -11
   
Rand2 CInt(idxs(Int(ubound(idxs)*Rnd+1))) 
   
mlq(Rand2).enqueue 
Loop 

if startup=6 then 
   
' Now let's play 
   play 
end 
if 

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+8) then 
   ' 
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(Dict1.Count*Rnd+1) 
      idxs = Split(itms(Rand), ":", -1, 1) 
      Rand2 = CInt(idxs(Int(ubound(idxs)+1 * Rnd))) 
      mlq(Rand2).enqueue 
   Loop 
    
end if 

End Sub 

Sub Application_ChangedStatus 

if PlayState=0 then 
   ' 
exit if state has changed to stopped 
   quit 
end 
if 

End Sub 
neFAST is offline   Reply With Quote
Old 19th May 2006, 20:02   #386
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
ahh.. so it IS Rnd+1 and not +1 * Rnd. i'm assuming it should be so for both of them (you only fixed the initial playlist one). not sure it's quite ready for weighting since the randomization may not be random enough yet (i'll see if your +1 edit fixes it), but i'll let you know how it goes when i get around to testing it. also, thank you so much for coming around and checking the script through.

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 19th May 2006, 20:10   #387
neFAST
Member
 
Join Date: Sep 2004
Location: Montreal
Posts: 56
Send a message via ICQ to neFAST
Quote:
Originally posted by osmosis
i'm assuming it should be so for both of them (you only fixed the initial playlist one).
Oops. My mistake
What's your problem with randomisation ?
neFAST is offline   Reply With Quote
Old 19th May 2006, 20:13   #388
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
in a 9000+ song library, i shouldn't hear repeats. there is still a fair bit of random content thrown in but i am getting a lot of the same songs over again it seems. someone i know who's good with this stuff suggested that a good way to fix it would be to supply an argument to Randomize to make it better.. something involving date + time turned into a number because the same date and time never occurs twice was his suggestion, haven't tried it out yet. i'll see if the +1 movement helps it.

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 19th May 2006, 20:33   #389
neFAST
Member
 
Join Date: Sep 2004
Location: Montreal
Posts: 56
Send a message via ICQ to neFAST
You think that VB's random is so shitty ?
neFAST is offline   Reply With Quote
Old 19th May 2006, 20:42   #390
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
it's not really about think, i have no preconceived notions about VB. i'm just basing this off what i've seen - or heard, rather - and i'm hearing a lot of the same songs when i shouldn't be. Randomize should be random, if it isn't random enough then it'll have to be improved.

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 19th May 2006, 20:47   #391
neFAST
Member
 
Join Date: Sep 2004
Location: Montreal
Posts: 56
Send a message via ICQ to neFAST
I suggest we should test it with the 2 fixes we found.
neFAST is offline   Reply With Quote
Old 19th May 2006, 20:48   #392
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
yup, that's what i was proposing as well.

Request: A little SmartView Query Language love.
osmosis is offline   Reply With Quote
Old 21st May 2006, 00:16   #393
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
alright. after testing for the last few hours, the randomization seems a lot better given the fixes.. however, there is still a slight tendency toward certain songs. i think we should try the randomization when supplied with a unique number (date & time) for an argument and see if it helps it. just means we have to make the Randomize trigger every time files are added to the playlist (instead of just the once at the beginning), and figure out how to format the date as only numbers.


.. unless the argument supplied is evaluated every time Rnd is used.. then it could just be an identifier/variable.. and in that case you'd still only have to trigger Randomize once.. not sure how it works in VB.

Request: A little SmartView Query Language love.

Last edited by osmosis; 21st May 2006 at 00:41.
osmosis is offline   Reply With Quote
Old 21st May 2006, 05:24   #394
neFAST
Member
 
Join Date: Sep 2004
Location: Montreal
Posts: 56
Send a message via ICQ to neFAST
after one day of testing, the random seems pretty good with my library (20000+ songs) but the rating weight is invisible...
I don't think a date-based random would change anything cause you'll never get truly random values.
neFAST is offline   Reply With Quote
Old 21st May 2006, 05:37   #395
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
hmm. well, a date-based randomize would make it truely random since the same date and time never occur twice..

as for the testing, i don't know why with 20000 it would function any differently than it does with 9000 (maybe it has something to do with a central tendancy, and with a larger library the centre is a lot broader) but with 9000 i'm getting the same song(s) several times within an hour.

to recreate what i'm seeing, all you have to do is press the next button for awhile, watch the songs as they go by.. by doing this i see the same songs coming up occasionally.. so, i don't know what to tell you.

if you heard even the same song more than once in your day of testing, then the random isn't very good, since 20000 songs translates to about 60+ days of music. meaning idealy you wouldn't hear a song again until 60(ish) days after it is played.

Request: A little SmartView Query Language love.

Last edited by osmosis; 21st May 2006 at 05:55.
osmosis is offline   Reply With Quote
Old 25th May 2006, 04:35   #396
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
If you want to make sure you don't hear the same songs over & over - you can try 1 of 2 things. The first is to add a lastplay < [3 weeks ago] in your query.

The second is to track the songs you enqueue. For example:

PHP Code:
Do while (playlist.count<=9)
    
Safety=0
    
Do 
    
Safety=Safety+1
    Rand 
Int(Dict1.Count*Rnd+1)
    
idxs Split(itms(Rand), ":", -11)
    
Rand2 CInt(idxs(Int(ubound(idxs)*Rnd+1)))
    
loop until (instr(EnqHistory,Rand2 ":")=0) OR Safety 10000
    mlq
(Rand2).enqueue
    EnqHistory 
EnqHistory Rand2 ":"
Loop 
MarquisEXB is offline   Reply With Quote
Old 27th May 2006, 01:38   #397
neFAST
Member
 
Join Date: Sep 2004
Location: Montreal
Posts: 56
Send a message via ICQ to neFAST
Just a word to say that I reverted back to my "tracknumber=1" code, it's 10 times faster and Winamp jump form 33Mb to 40Mb instead of 100Mb of RAM ...
I have only complete and tagged cds in my library so it's working exactly as the "full random script" for me. Maybe there's another trick for people with dirty libraries
neFAST is offline   Reply With Quote
Old 27th May 2006, 02:49   #398
osmosis
Major Dude
 
osmosis's Avatar
 
Join Date: Jan 2006
Location: Cananada
Posts: 835
i resent you calling my library dirty
a full random by rights would weight towards artists with more tracks, where yours would only weigh towards artists with more track 1's.. but yeah, that'd work for you. i, on the other hand, only keep songs i like, though i usually start out with proper full CDs. unfortunately some artists never make a good first song on an album hehe

as far as memory usage, mine only balloons to 37mb of RAM and 62 VM, so it's not such an issue with me. obviously, library size must be an important factor. i've been trying to figure out another way to make it fast, but nothing occurred to me. the scripting dictionary made the track to track operation A LOT smoother and speedy, but the hangtime on load does leave a bit to be desired. at least that hang doesn't happen every time you skip ahead by more than 4 tracks like it used to.. AND the memory ballooning only occurs on start-up and not every time the track changes.

neFAST have you tried anything Marquis mentioned above about avoiding repeats, or made any more progress with your rate weighting scheme? i haven't had the time to play around with any of it yet.

edit: also, i'm happy to report that after playing for 30 minutes or so, the 37mb RAM dropped to like 6mb RAM, and the 62 has only increased to around 65 so maybe it's not so bad since it yields it back up later.

Request: A little SmartView Query Language love.

Last edited by osmosis; 27th May 2006 at 03:06.
osmosis is offline   Reply With Quote
Old 28th May 2006, 22:50   #399
gonemad
Member
 
Join Date: May 2006
Posts: 52
seems like 5.22 broke a few of the things in activewinamp (and toaster).. i noticed rating and playcount show up as nothing for both plugins.. im assuming this is due to the fact that the ML was broken up until multiple dlls... can anyone else verify this?
gonemad is offline   Reply With Quote
Old 28th May 2006, 23:21   #400
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
Yes Ive noticed that too. I will take a look into it.
shaneh is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump