![]() |
#41 |
Member
|
i've a 2.8Ghz so it's a bit strange.
Here's my code. code: in fact I wont use it regularly but something like 2 times in a week. I have a basic knowledge in C++ (and zero experience in plugin writing) so I think you'll tell me that's it's impossible for me to rewrite it in C ![]() |
![]() |
![]() |
![]() |
#42 |
Member
|
i reverted to "%artist%;%album%;%tracknumber%;%title%;%bitrate%;%lengthf%;%year%;%genre%"
you track.Artist gives me a lots of tag reading failure or something like that AND a chaotic sorting ! |
![]() |
![]() |
![]() |
#43 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
That line should actually look like this
MyFile.WriteLine(track.artist + ";" + track.album + track.ATFString(";%tracknumber%;") + track.title + track.ATFString(";%bitrate%;%lengthf%;%year%;%genre%")) But I see where the problem is, its actually something Ive been meaning to fix. The ATFString call should try the media library first and then try winamp itself. The reason being that winamp will attempt to read the actual .mp3 file, especially for the 'lengthf' and 'bitrate' etc tags. I will cache more info from a media library query, and speed up the 'ATFString' call, and hopefully that will improve things. If you remove the ATFString calls, and just use track.title, track.filename etc, you will notice that it doesnt take too long at all. ATFString() calls to stuff only in the media library (playcount, rating, tracknumber etc should be ok) [edit] the reason for the tag reading failure etc is because you are putting track.artist inside the call to ATFString. look at my example above for how it should be. |
![]() |
![]() |
![]() |
#44 |
Member
|
ok i'll try this tomorrow, it's near 4am here
![]() |
![]() |
![]() |
![]() |
#45 |
Major Dude
Join Date: Mar 2004
Posts: 991
|
id like to make a script that enqueues all of an album.. or inserts an album... i know nothing about computers(well.. i dont know much)
i just edited the included scripts.. but when i try, it doesnt include the song i picked(so it enqueus/inserts the album only without the original track clicked... i guess the ideal script for me would insert one of dros separator things(or just a normal separator thats just ------------- or whatever) and then the album INCLUDING the song i clicked, and then another separator... would this be somehow possible is it possible to make a script based on other plugins(jtfe queue album) or to make it somehow 'enqueue/insert and play album?' though at the moment.. my biggest problem, is it doesnt include the song i used the script on when it inserts/enqueues album/artist There is no reset button on life... but the graphics kick ass |
![]() |
![]() |
![]() |
#46 |
Member
Join Date: Aug 2004
Location: AC
Posts: 73
|
Think the first one is on purpose.
Try this: playlist_Enqueue album.vbs code: Edit: The scripting is a great idea - brings a lot of fun ![]() Keep on with this shaneh though DrO is afraid he'll get out of work Last edited by AnodA; 10th September 2004 at 23:59. |
![]() |
![]() |
![]() |
#47 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
I guess you could use something like:
pos = x(1).position myitem = LoadItem("separator://") myitem.insert(pos) to insert a separator at the position. The reason it doesn't include the selected track is because it is already in your playlist. Just remove the if strcomp(track.filename, x(1).filename) <> 0 then which checks if the track about to be inserted is not the same as the first one selected. |
![]() |
![]() |
![]() |
#48 |
Member
Join Date: Aug 2004
Location: AC
Posts: 73
|
Is it odd that i cant get the script shortcuts to work on an old Win98 machine? Other shortcuts are working - scripts working with rightclick. All things are working on my XP machine.
(AMD-K6 200, Win98 SE, WinScript 5.6, Winamp 5.05 (clean install+script)) Any ideas about that? |
![]() |
![]() |
![]() |
#49 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
I assume you are talking about global hotkeys? Do other global hot keys work? Try removing the shortcuts, re-adding the key combination then restart winamp. Otherwise I am not sure, the scripts are invoked in an identical way as from the playlist menu. So if they work, there could be a problem with the registration of the global hotkey.
Also, many of the scripts make use of the selection rather than the current position etc, so it could be that they are running but just not getting the selection correctly. Try making a script with just a msgbox and see if its running ok. |
![]() |
![]() |
![]() |
#50 |
Major Dude
Join Date: Mar 2004
Posts: 991
|
okay... so if i wanted it to insert the separator at the beggining of the inserted album, and then again at the end(as if to seperate it from the rest of the playlist) how would i do that... also... how would i get the script to play(like a 'insert and play') command...
so if i wanted to hit the script... and it would insert the entire album in order(including the song i rightclicked) then start playing it, all the while separating it from the playlist... im probably asking for too much, but that would be totally awesome... There is no reset button on life... but the graphics kick ass |
![]() |
![]() |
![]() |
#51 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
You make use of playlist.position and playlist.count. If you enqueue something, it gets put at the end, so basically just set:
playlist.positon = playlist.count Then enqueue everything then "play" Otherwise if you are inserting stuff, then just set playlist.position to wherever you are inserting, then "play". To insert a separator at the beginning and end, just insert one before inserting everything, and after. I'll include a script which does this with the next update. For now I am fixing ATFString which is horribly broken at the moment, when Im done it will actually work and should be quite fast too. |
![]() |
![]() |
![]() |
#52 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
+Many basic methods and properties to the base application object, media items and playlist (skin, shuffle, version, repeat, show notification etc.) Open the .tlb to see them all
+Much improved and fixed ATFString method, plus caches information better. Getting tag information after a media library query or getting the length from a playlist selection will be *much* faster. Added another basic script for inserting all items from an artist, with a separator. Doesnt use an external plugin for the separator, just uses inbuilt support from Winamp (using x:\--------..). I think its better as it means not having another input plugin loaded and you can specify anything you want as the separator at run time. And it doesnt have a length value in the playlist. But you can edit it to use whatever you like. Also another script to add separators before a selection of playlist entries. removed the playlist count fixer script cause its a little buggy when you have a zero playcount. Last edited by shaneh; 11th September 2004 at 12:32. |
![]() |
![]() |
![]() |
#53 |
Member
Join Date: Aug 2004
Location: AC
Posts: 73
|
Er yes, global hotkeys (nstGlobalHotkeys v1.3). Other global hotkeys work. Even the most simple script doesn't work with global hotkey (only msgbox for example). Tried adding removing in all kinds of ways. So it's a problem with the registration, is it?
|
![]() |
![]() |
![]() |
#54 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
I have the same version of global hot keys, and have tried this exact same version and it works fine. I used the exact same method in Toaster, have you tried that plugin? Do the hot keys work for that?
I assume you dont have any other plugins which could be interferring with it. It seems strange, as it the standard method for registering hot keys that all the plugins in winamp would use. The one thing I do have suspicions on is the order in which the plugins are loaded. If the global hotkey plugin isnt loaded before this script plugin is, there could be problems. Try renaming it gen_zscript.dll or gen_ascript.dll and see if it helps. If it does, I am already planning a fix that will help this and other potential problems. EDIT: yes that seems to be the problem, the next versin will fix this. until then just rename the plugin gen_zscript.dll. Although, you shouldnt even be having the items listed in the hotkey config screen if this is the problem you are experiencing, so im not sure. |
![]() |
![]() |
![]() |
#55 | |
Member
|
Quote:
My script now takes 3 seconds to execute instead of 3-4minutes with the old version ! Nice work Shaneh. But I still have a problem with sorting the results, they're unfortunately not in EXACT reverse order ![]() the sort function is recognize wy windows (sort export.txt scroll all the file) but do not results in a sorted file ?! Last edited by neFAST; 11th September 2004 at 15:17. |
|
![]() |
![]() |
![]() |
#56 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
You can just pipe the results to another file. ie
sort songs.txt > songs2.txt You can run this from within your script using set wsh = CreateObject("Wscript.Shell") wsh.Run "sort songs.txt > songs2.txt" or something like that. Otherwise, if you need more defined sorting, or dont want to use another file, you will just need to do the sorting yourself internally. There is an example of the quick sort alogorithm in a couple of the scripts. You will need to make a few modifications to make it sort on the array returned from the querey but it is certainly possible, and wouldnt take too long. I'll include it as an example in my next update for people to look at. |
![]() |
![]() |
![]() |
#57 |
Member
|
I've a little problem, it seems that track.artist track.album and %artist% return the album field while %album% doesn't return anything ???
could you check this please ? |
![]() |
![]() |
![]() |
#58 | |
Member
Join Date: Aug 2004
Location: AC
Posts: 73
|
Some kind of strange. I did another clean install without jumpex and TControl and suddenly its working. Installed the newest version of them and its still working. Tried more of DrOs plugs, because i remebered there was a similar problem with his plugs some time ago. Problem appears again only with his lastest 'skinned prefs' plugin. But it wasn't installed before - I did a clean install, too. I'm confused. But maybe the problem was somehow at his side.
Edit: Quote:
|
|
![]() |
![]() |
![]() |
#59 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
@nefast: yep, oops. Theres probably a few bugs like that, I'll try squash them all over time, let me know if theres anything else strange like that. Theres a lot of different cases that need to be covered, when the media library isnt available, when the item has been created from the media library so the info has been cached, when it hasnt, when accessed through ATF, through a property etc, etc, etc.
To keep it nice and fast stuff is only loaded on demand, and when it is its cached for later, so it gets a little complicated. I think I fixed the album/artist problem in this release. |
![]() |
![]() |
![]() |
#60 | ||
Join Date: Sep 2003
Posts: 27,873
|
Quote:
![]() the order in which plugins loads can affect things if the chain of loading isn't as expected. doing a rename of the plugin or installing it again is often likely to fix the problem so that when winamp searches for the files it will find the newer one later in the process so the existing ones can be found. aren't plugins fun ![]() Quote:
![]() -daz |
||
![]() |
![]() |
![]() |
#61 | |
Member
Join Date: Aug 2004
Location: AC
Posts: 73
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#62 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
"the order in which plugins loads can affect things if the chain of loading isn't as expected."
Yeah, its not too hard for other plugins to affect the operation of others, or a dependence not be satisfied due to the order not being as expected. Although the plugin will enter the 'chain' at the normal time, I'll be changing it so it doesnt initialise or start running scripts until the initial plugin shakedown is complete for all plugins. But there is stil the problem of command ids being used by other plugins. AFAIK the current standard is just use any old random spare id when adding to menus etc. If any two plugins try use the same id for any menu etc, there would be problems. Be good if you could request a range of ids from winamp. |
![]() |
![]() |
![]() |
#63 |
Member
|
thanx for the bug fix
![]() I still hav some dumb question, here's my code : code: Id like to add code: or code: but both don't work ![]() any clue ? And I have a totally OT question, a friend would like a random question that first choose a random artist and then one of his songs. He doesn't want to ear too much an artist when he owns his whole discography, you see ? Do you think I could do this with your plugin ? I think I need to query the ml with a DISTINCT option and the randomize on the artist. Then i just have to re-query with that artist and re-randomize one song. THe problem concerns that "distinct" (like in SQL), I think it's not possible to query the ml like that, is it ? |
![]() |
![]() |
![]() |
#64 |
Major Dude
Join Date: Mar 2004
Posts: 991
|
i think i have the script like i want it, though... i have yet to figure out how to get it to play the first track of the cd.. but thats not that big of a deal
my question is.. how can i add it to the script to sort the album by track number.. because sometimes when i 'insert album' some albums list the album backwards.(from last track to first) thanks There is no reset button on life... but the graphics kick ass |
![]() |
![]() |
![]() |
#65 | ||
Join Date: Sep 2003
Posts: 27,873
|
Quote:
Quote:
-daz |
||
![]() |
![]() |
![]() |
#66 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
@NeFast, I found this example in the msdn docs, it should work ok:
Dim fso, MyFile Set fso = CreateObject("Scripting.FileSystemObject") Set MyFile = fso.CreateTextFile("c:\testfile.txt", True) MyFile.WriteLine("This is a test.") MyFile.Close Set MyFile = fso.GetFile("c:\testfile.txt") MyFile.Delete As far as I know there is no 'distinct' option, but there are many ways to overcome this. Just query for every song, then add each to a 'scripting.dictionary' object, using the artist as the key, and maybe the number of songs by that artist as the value, or anything else it doesnt really matter, it wont allow you to add duplicate keys. Then just choose a random one from 1 to .count. I want to avoid writing scripts for everyone though, and concentrate on the plugin which allows such scripts to be written. Unless I find that the script requires some change to the plugin. @electricmime: You will need to sort the results after you get them. Its not too difficult, I'll post up a script that does it soon. |
![]() |
![]() |
![]() |
#67 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
+Fixed more problems with ATFString when stuff wasnt loaded from the media library.
+Added basic support for sendto_*.vbs items. You can get the items through GetSendToItems(). +It will not start scripts or register hot keys etc until all plugins have finished initing. Fixed some example scripts that wouldnt quit properly if not enough items were selected. Added a send to 'export sorted' example. The basic API is getting pretty close to complete. Theres still a few things here and there, but the most used things are there. I still need to add methods for adding menu items and hot key callbacks etc. Plus some gui stuff as well as loading .js and other script types. |
![]() |
![]() |
![]() |
#68 |
Member
Join Date: Aug 2004
Location: AC
Posts: 73
|
...back to the thread topic - yeah, that's what it's meant to be! Don't want to keep shaneh off form doing his plug. But ideas rise.
@shaneh: 1. That config thing you planed would be great I think. Keep this in mind, please! The scripts that are loaded or displayed should be set in an easy way. Not like it's actually with the Winamp plugins - I can't stand copy or deleate files in a folder somehow getting confused about my lastest setting, what plugs I need to do what I want, which combination of things can cause problems or where (damn) is the plug I tried out some time before (and that's EXACLTY what I need now!!) - I just want to define: Load or display this script or ignore this script till I tell you not to do this. Something special would be to have a couple of presets to choose - but I only want to be inquired if I really want to be. It should be easy to config for people that know not much about computers (should be the main aim ever, everybody knows). Too much? Doesn't mind. I just want to tell you: Take your time, finish the functionality first and think about the best way integrating this into Winamp. It's a promising thing I'm sure about that. Though it might grow to work more than fun ![]() (btw s.o. agree that's nice for the plugin issue... no, sorry, getting of topic again. Perhaps that's something for the discussion forum) 2. Dreamed about OnWinampClosedown issues. Could be great if someone wants to fix things (last playlist, statistics, whatever...). Could be done with some watch things I know but would be better to do this in a clean and simple way. Agree? 3. The example scripts are fine right now. It's the best way to follow what it's intended to do. Please keep on including them. Hope I'm not a pain in your neck - keep quiet now till there's something important. Happy coding... |
![]() |
![]() |
![]() |
#69 |
Member
|
Hello I've done the "clever random" plugin I was talking about.
code: 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 ! I repeat that I'm a total newbie with VB so If you see any way to optimize this plugin, please tell me. And now "dumb question session" ![]() Is it possible to add an item in the playlist when it's empty ? shaneh uses "if ubound(x,1) > 0 then" to avoid adding anything in that case, so I don't kwow .... Then is it possible to put a form in a msgbox to asks the user for the number of files he'd like to add ? neFAST - not that fast ![]() |
![]() |
![]() |
![]() |
#70 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
ubound(x) just checks the number of values in 'x'. x is an array obtained from 'playlist.getselection'. So it effectively checks the number of values selected.
If the playlist is empty, then obviously the selection will be empty too. But you still need a place to insert. Thus you will have to manually choose a location, or you can use playlist.position. You can use playlist.count to get the number of items in the playlist. If you dont care about the position and just want to enqueue it to the end, you can use track.enqueue. Note in your example, you would be better off doing j = ubound(mlq) rather than a loop to find the number of items in the second query. That part wouldnt be too slow though, it would be adding the items to the dict object that would be slow. Im not sure of a faster way though. You could try doing 'ifexists(key)' or whatever and not re-adding a value if it does and see if its faster, i dont think it would be though. The gnu sort utility allows you to list all the unique items using sort -u file.txt So you could try writing all the artists to a file then running that utility over it and see if its any faster. Then using wc to count the number of lines then read a random line etc. I am not sure if it would be ultimately faster though. But the advantage is you can cache the results in the file and not have to re-generate the list everytime. You can do: num = CInt(InputBox("number of items")) to get a value from the user. |
![]() |
![]() |
![]() |
#71 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Adding on this rather than editing:
It seems the slow part is having to do a query for every track you want to add. Queries are qutie slow It may be possible to speed up your script by having the 'value' part of the key/value pair be a list of the available songs. ie, lookup the artist in the dictionary, then modify the value to include the database index of the new item. You can obtain the dbindex from the media item through 'track.dbindex'. Or use the index into the array. So basically your dictionary (key,value) would look like: "Metallica", "10:16:17:20" "Spearhead", "23:34:234:1:235:92" ---------------heres a script that will do it--------- dim i,j,Dict1,tracks,num,idxs Set Dict1 = CreateObject("Scripting.dictionary") Dict1.CompareMode = BinaryCompare mlq = medialibrary.runqueryarray("type = 0") i = 0 for each track in mlq Dict1(track.artist)=Dict1(track.artist) + ":" + CStr(i) i = i + 1 next Randomize itms = Dict1.Items num = CInt(InputBox("Number of items")) do while (tracks<=num) Rand = Int((Dict1.Count + 1) * Rnd) idxs = Split(itms(Rand), ":", -1, 1) Rand2 = CInt(idxs(Int(ubound(idxs)+1 * Rnd))) mlq(Rand2).enqueue tracks=tracks+1 Loop quit Last edited by shaneh; 12th September 2004 at 14:23. |
![]() |
![]() |
![]() |
#72 |
Member
|
Shaneh : you said you wanted to avoid scripting for everyone
![]() now you've made a faster and clearer script in 20min, do do you want to discourage me ? ![]() well, hum, thank you ! [edit] I must tell you that your Export sorted script is not very fast and useful,:-þ maybe an "album list" would be more interesting, using dictionary to list only unique data |
![]() |
![]() |
![]() |
#73 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
It is not useful, but it does show how to use the 'send to' feature, and how to sort an array after a library query, based on a string field. And that is its only aim.
|
![]() |
![]() |
![]() |
#74 |
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
Global Hotkeys solution!
You can't add your hotkey actions to Global Hotkeys plugin in the init() function. I have a solution for this which is attached. It uses a timer...
|
![]() |
![]() |
![]() |
#75 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Timers are unreliable, it is dependant on the speed of the machine. It also means you miss any inital messages if you dont init everything until the timer fires.
It is much easier to just postmessage a custom message to the winamp hwnd. You will not get the message until all the plugins have been init'd. You will get it as soon as the plugins have all been loaded and init'd, and winamp is ready to start doing stuff. alternatively, you can make the hot key registration a postmessage itself. |
![]() |
![]() |
![]() |
#76 |
Junior Member
Join Date: Apr 2004
Location: NL
Posts: 23
|
Wow! great plugin. It helped me answer this problem:
[chronological overview of songs] For those interested, I used this script: Dim x, s, sy, ey, y, wd Set wd = CreateObject("InternetExplorer.Application") wd.Navigate2("about :blank") wd.document.write "<html><head>" wd.document.write "<title>Winamp Chronological Report</title>" wd.document.write "</head>" wd.document.write "<body bgcolor=black text=#CEFFCE>" wd.document.write "<p><table border=1 cellpadding=0 cellspacing=0>" sy = 1949 'start year ey = 2004 'end year mlq = medialibrary.runqueryarray("YEAR > 1 AND YEAR < " & sy) x = 0 For Each track In mlq x = x + 1 Next wd.document.write "<tr><td>before "& sy & "</td><td align=right>" & vbNewLine wd.document.write x & "</td></tr>" & vbNewLine For y = sy To ey mlq = medialibrary.runqueryarray("YEAR = " & y) x = 0 For Each track In mlq x = x + 1 Next wd.document.write "<tr><td>" & y & "</td><td align=right>" & vbNewLine wd.document.write x & "</td></tr>" & vbNewLine Next mlq = medialibrary.runqueryarray("YEAR < 1") x = 0 For Each track In mlq x = x + 1 Next wd.document.write "<tr><td>no year</td><td align=right>" & vbNewLine wd.document.write x & "</td></tr></table>" & vbNewLine wd.document.write "</body></html>" wd.visible = True (I based it on earlier mentioned scripts as you can see) |
![]() |
![]() |
![]() |
#77 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Have made a couple modifications to allow external scripting (ie standalone WSH scripts and VB apps etc).
It will only work if Winamp has already started, otherwise it annoyingly tries to download the component because it thinks it doesnt exist. You can just run winamp.exe to ensure it is loaded before trying to access it. I can fix this by registering it in the registry, but will try work out something different. Its probably a bit buggy, but seems to work for the most part. Have also added a simple volume property and track property to media items, plus a couple other example scripts. Set wo = GetObject("clsid:1C7F39AF-65C0-4C14-A392-6B4714705DC2") wo.play Last edited by shaneh; 18th September 2004 at 16:02. |
![]() |
![]() |
![]() |
#78 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Fixed class registration, also registers in the registry. You can now access it properly from external scripts and apps etc.
--- Set wo = CreateObject("ActiveWinamp.Application") wo.play --- Added a dialog to see running scripts and let you kill them off. Good to see if any scripts havent quit properly. You can also run arbitrary scripts from this dialog. Accessed from the config screen for the plugin under general plugins, preferences. I will enhance this dialog and make it more accessible over time. Other misc fixes. |
![]() |
![]() |
![]() |
#79 |
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
Damn neFAST's wide post :-(
Heres a script that gives you easy access to the scripts folder.
It will work on all systems without modification because it uses the registry to find out where Winamp is kept on your computer. code: Also a script that launches Winamp and makes it play at startup (external). code: Good work ShaneH!!! Last edited by saivert; 21st September 2004 at 08:29. |
![]() |
![]() |
![]() |
#80 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
+Tweaked the registration a bit more, the type library is now registered which means .cpp clients will actually work.
Ive used the wrong type for a lot of stuff (VARIANT), I thought this was best for scripts, but I think it doesnt matter. Making them types like LONG/BSTR/INT etc will make writing CPP clients much easier, especially with later versions of VS. So I will probably convert a lot of stuff, it makes it easier to see what types the functions return and take easier too. |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|