![]() |
#81 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
A simple example in MFC/Cpp which uses the component. Be careful about writing anything significant at this point in time, as functions and library names etc are expected to change.
|
![]() |
![]() |
![]() |
#82 |
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
How do you get the so called "script helper" loaded as a Media Library plugin? gen_script1.dll does not export winampGetMediaLibraryPlugin.
|
![]() |
![]() |
![]() |
#83 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
There are IPCs to add and remove media library plugins. An ML helper plugin was necessary in order to get the 'send to' items.
|
![]() |
![]() |
![]() |
#84 |
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
You mean through this:
code: And then using the standard ML_IPC_* like: code: |
![]() |
![]() |
![]() |
#85 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Yep
|
![]() |
![]() |
![]() |
#86 |
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
That's very assuring!! Now I can finally get on the train home (I'm sitting at school). Bye, will be back tomorrow...
|
![]() |
![]() |
![]() |
#87 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
awww....
what a waste of time :P
It reminds me of a plugin I intended to write a while back but never did. One of these days I will... Should be pretty good if it works out. Will see how I go for time. --------- Const ForReading = 1 Set fso = CreateObject("Scripting.FileSystemObject") Set MyFile = fso.OpenTextFile("C:\art.txt", ForReading, True) Do While MyFile.AtEndOfStream = False artline = MyFile.ReadLine if artline = "" then artline = " " end if set sep = LoadItem("x:" + artline + ".x") sep.Enqueue Loop MyFile.Close quit |
![]() |
![]() |
![]() |
#88 |
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
Oh what a cute little teddy...
Maybe you could write a quote of the day script too, that will randomly drop lines from a quote file and scatter it around in the playlist. Would be very similar to the teddy script. |
![]() |
![]() |
![]() |
#89 |
Major Dude
Join Date: Mar 2004
Posts: 991
|
in the atfe thread, i thought it would be cool if you could save atf strings, and change them whenever you want(from the playlist window) would that be possible through scripts(and if it is, would it be possible to update all the files once you change atf strings)
There is no reset button on life... but the graphics kick ass |
![]() |
![]() |
![]() |
#90 |
Junior Member
Join Date: Sep 2004
Posts: 2
|
shaneh - excellent work - I was casting about for a way for controlling winamp on my server - didn't like any of the existing stuff out there, so started writing my own using .net remoting - this has saved me a *ton* of effort, thanks!
One request, or maybe I'm just missing it - can you add a "current playback status" property (i.e., Stopped, Paused, Playing)? Thanks again, FarmerDave |
![]() |
![]() |
![]() |
#91 |
Member
|
I'm still a little off-topic but I just want to say that the rand Items plugin always insert the 2nd song of an album !
I don't really understand the last line of the code (CInt(idxs(Int(ubound(idxs)+1 * Rnd)))): code: But I think the problem is here. any idea ? [edit] me and my beloved brain have found the answer : I juste changed the brackets and +1 in the random code: Last edited by neFAST; 22nd September 2004 at 23:08. |
![]() |
![]() |
![]() |
#92 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Plenty of changes. The library is now named ActiveWinamp instead of gen_script1Lib.
+ Many of the methods now return strong types rather than variants. Changed types used internally and externally quite a bit, should work better. + Fixed a serious problem with closing scripts. Application: +SendMsg() - does a sendmessage to the main hwnd +PostMsg() - does a postmessage to the main hwnd +UpdateTitle() +RunScript(BSTR) +Property PlayState +Property Hwnd +Property Panning -Events: +ChangedVolume() +ChangedStatus() +PlaybackEOF() Playlist: +SendMsg() +PostMsg() +Property Hwnd MediaLibrary: +SendMsg() +PostMsg() +Property Hwnd You can use the sendmsg and postmsg methods to do many of the other actions not available natively to the plugin. |
![]() |
![]() |
![]() |
#93 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Much more interesting sample in MFC, demonstrates how to do ml queries and work with the arrays. The previous example wont work anymore due to the changes in gen_script1.
|
![]() |
![]() |
![]() |
#94 |
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
I'm now also using a "helper ML plugin" in my plugin NxS Balloon Tip. And I also get the data from the Media Library instead of using IPC_GET_EXTENDED_FILE_INFO.
ON-TOPIC I'm writing documentation for your plugin, that means all the methods functions described and a couple of guidelines. Hope you'll like it... |
![]() |
![]() |
![]() |
#95 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Sounds good saivert. I will eventually get around to writing up the .idl file properly, so that when using it within VB or othewise using the type library, there will be some better help contexts for the methods/properties.
If you want you can fill in this idl file, or just use it as a reference. |
![]() |
![]() |
![]() |
#96 |
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
Docs
I actually didn't need the .idl file as I can use OLEView (bundled with VC++) to de-compile the .tlb file into a .idl file again. I will not fill in the idl file however becuase I am writing documentation for use by anyone, and not just people who can read idl file like it was a novel.
It will be more structured and have a tree-like form with examples along the way. Here is the first draft: |
![]() |
![]() |
![]() |
#97 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Ok looks good saivert.
Although there is still heaps to do with this plugin, its nearing a point where I am happy to release it and the names and dispids etc will all remain fixed. I need to add plenty of stuff for dynamically adding hotkeys/ menu /items /arguments to scripts etc. But that is mostly for script hosting stuff and can be added over time without affecting the rest of the functionality. Ive been holding off doing any docos etc until I set the interfaces in stone. But it currently provides most of the typical stuff you would use from an external program through COM, so I may release it. The reason for editing the .idl file is not for people to read that, but it is used to compile the type library. The help strings are part of this library, in this way the object is self documenting. When using it in VB or any other environment, the help strings that are put in this .idl file appear in the object browser. A good IDE will also provide little tool tip texts with these help strings when using a method from the type library. (the position property in the playlist is both set/get). |
![]() |
![]() |
![]() |
#98 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Fixed a leak problem with arrays (runqueryarray/getselected/getsendtoitems).
Fixed issue with getting meta data from items not in the ml. Fixed sample client app |
![]() |
![]() |
![]() |
#99 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
sample app
The mfc sample app. Works much better.
|
![]() |
![]() |
![]() |
#100 |
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
ActiveWinamp Scripting Reference Rev. 1
All done!
I hope it will be included in future releases of ActiveWinamp. Note: The ZIP also contains two scripts i have written, check em' out ![]() Here it is: |
![]() |
![]() |
![]() |
#101 |
Junior Member
Join Date: Sep 2004
Posts: 7
|
Randomize list?
Can a script be used to randomize a playlist?
|
![]() |
![]() |
![]() |
#102 |
Major Dude
Join Date: Mar 2004
Posts: 991
|
theres already one for randomize selection included, and if you want to randomize the entire thing in winmap click misc->sort->randomize list
but if you really wanted to make the script, you could just edit randomize selection There is no reset button on life... but the graphics kick ass |
![]() |
![]() |
![]() |
#103 |
Junior Member
Join Date: Sep 2004
Posts: 7
|
I'd like to automate it so that it can be scheduled to load a playlist and randomize it. Currently, I am simply scheduling it as a task. If I could run a script instead of a playlist that would randomize after load that would be ideal.
|
![]() |
![]() |
![]() |
#104 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
Scripts now run in a separate thread. This allows you to to lengthy operations such as connect to remote web sites or databases etc without locking up winamp. Note that lengthy operations within the Application object itself (basically all exposed methods) will still lockup winamp due to the way it is implemented. (in particular ml queries which take a long time). But when the script isn't 'inside' an exposed method winamp will still be responsive. (ie when calling methods on other objects or other execution which doesnt spend time in calls to the exposed methods).
Also fixes some mem leak issues with ml queries. The quit method now quits when you call quit rather than just signalling that it should quit when the script is finished. Note there may be some occasions where it doesnt quit immediately and may continue executing for a couple more lines, so structure your code accordingly until its fixed. Theres likely to be a few bugs but it seems to run ok so far. @John Baker: That would probably require an event which fires on opening of new items. No such event exists yet. You can however use this script: SendMsg 273, 40029, 0 playlist.postmsg 273, 40212, 0 quit And assign it a hotkey or something. Then use this to open playlists. It sends the 'open file dialog' command to winamp, then the 'randomize playlist' to the playlist after the dialog is closed. |
![]() |
![]() |
![]() |
#105 |
Junior Member
Join Date: Sep 2004
Posts: 2
|
shaneh - thanks again for this plugin, my remote is working great. I've still got a bunch of stuff to do - software is never truly "done", eh?
Anyway, I turned a friend onto your plugin, and he's asking if there's a way to get to the album art (even just a filename) using this OM. I didn't see one, so I'm passing the question along. If not, do you have any plans to expose such a property/method? Thanks, FarmerDave |
![]() |
![]() |
![]() |
#106 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
@Farmerdave: You can just use
mi = playlist(1) fn = mi.ATFString("%dir%") + "\Folder.jpg" Or various other combinations. I personnaly use a script like: x = playlist.getselection() if ubound(x,1) > 0 then set wso = CreateObject("Wscript.Shell") pos = InStr(8, x(1).filename, "\", 1) mpath = Left(x(1).filename, pos) mpath = Mid(mpath, 8) wso.run "C:\Mp3\downart """ & mpath & """" end if quit In order to download mmissing albumart using a tool which connects to the web and downloads cover images. downart is a batch file which changes directories and calls mp3albumartdownloader etc. If you are talking about getting the cover art out of the id3 tag, I think id3lib comes as a COM library as well. You would need to do something like: id3o = CreateObject("ID3Lib.Application") id3o.loadtag mi.filename pic = id3o.getcover or whatever. I may put id3 support in this plugin, but I think external support may be a better option. edit: see http://forums.winamp.com/showthread....68#post1485468 for an example of using id3com to access id3 tags. Last edited by shaneh; 1st October 2004 at 03:52. |
![]() |
![]() |
![]() |
#107 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
example script
To demonstrate a lengthy web service type script and the multi-threading support, heres a neat little script. It will query Audioscrobbler for the top songs by a song selected in your playlist and attempt to enqueue them.
Prob got a few bugs, but you get the idea. -------playlist_enqueue artists top songs as.vbs--------- dim xmlhttp, art, dict1, mlq x = playlist.getselection if ubound(x) > 0 then Set Dict1 = CreateObject("Scripting.dictionary") Dict1.CompareMode = 1 art = x(1).artist mlq = medialibrary.runqueryarray("artist = """ & art & """") i = 1 for each song in mlq dict1(song.title) = i i = i + 1 next set xmlhttp = CreateObject("Msxml2.XMLHTTP.4.0") set xmlDoc = CreateObject("Msxml2.DOMDocument.4.0") xmlhttp.Open "GET", "http://www.audioscrobbler.com/music/" + art, false xmlhttp.Send res = xmlhttp.responsetext xmldoc.validateonparse = false xmldoc.resolveexternals = false ns = "xmlns:asx='http://www.w3.org/1999/xhtml'" xmldoc.setProperty "SelectionNamespaces", ns xmldoc.loadxml replace(res, "&", " ") If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox(myerr.reason + " " + myErr.srctext) quit end if set nl = xmldoc.documentelement.selectSingleNode("asx:body/asx:div[@id='main']/asx:div[@class='content']/asx:table[@class='topn']") set tl = nl.selectNodes("asx:tr") for each song in tl idx = dict1(song.selectSingleNode("asx:td/asx:a").text) if (idx > 0) then mlq(idx).enqueue end if next end if quit |
![]() |
![]() |
![]() |
#108 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
+ Hopefully fixed a couple problems introduced by threading
+ Scripts with certain types of errors quit properly now + The Quit function should work ok without race problems + Added a 'position' property to get the current track position + A couple example scripts |
![]() |
![]() |
![]() |
#109 |
Major Dude
Join Date: Mar 2004
Posts: 991
|
so.. is it possible to make a script that changes your atf string?
There is no reset button on life... but the graphics kick ass |
![]() |
![]() |
![]() |
#110 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
I guess you could write a script which reads in winamp.ini and modifies the ATF setting in there, winamp supports no other means of changing this setting. You may need to restart winamp to get this setting to stick, Im not sure. Then you would need to re-read in all the titles for the new setting to reflect in the playlist, this can be done by a 'select all, read extended info' button emulation bit of script, but it would be slow for a lot of items.
Its not something that you can just quickly switch between different settings. Frankly I dont think its too practical. |
![]() |
![]() |
![]() |
#111 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
update
Added Arguments and Description(rw) properties to SiteManager.
Description allows you to set/get the text used in the running scripts dialog. Arguments allows you to obtain the arguments passed by 'RunScript', which now takes an 'arguments' paramater. The running scripts dialog lets you pass arguments to opened scripts. Allows you to run scripts from the playlist through 'script:\' items. You can also pass arguments, check out the pause and closewinamp examples to see what I mean. (scripts run in this manner will get a "-pos=x" argument indicating the position in the playlist it was run from. You should use this instead of playlist.position because it is threaded and may have changed by the time you read it in). Un-done some thread fixes which werent needed. Fixed 'Quit' a bit more, plus some problems with scripts with errors not quitting properly. A few more example scripts. |
![]() |
![]() |
![]() |
#112 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
+Fixed a problem with getting events from the object in web pages. The net effect is you can now receive events properly in HTML pages. This is demonstrated in a simple notify.hta application. (note that this plugin is not marked safe for scripting, so you cannot just run this from random internet web pages for security reasons).
+Fixed a crash problem with getting meta data from files which arent in the media library. |
![]() |
![]() |
![]() |
#113 |
Junior Member
Join Date: Aug 2003
Location: Croatia
Posts: 32
|
Help needed
(sorry about my english)
Shaneh, the "gen_script1.*" and other files are in my winamp5 dir. Scripts ar there too. How do I start a script. When I Dbl_Click a script it return me an error. See the picture. It happens on each script. How do I start it???? ![]() |
![]() |
![]() |
![]() |
#114 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
I suspect you do not have the media library installed and loaded? Make sure you do, and configure it to load at winamp start.
If you do not wish to use this, the other scripts which dont use the media library may work, but Im not sure. Its best just to enable the library, Hope it works out ok. EDIT: oh, you are trying to run the scripts through windows... run them from winamp via the 'scripts' right click menu item in the playlist. You can write scripts that run externally, but most of the scripts included were not written like this. Just adding : set wa = CreateObject("ActiveWinamp.Application") and "wa" in front of all the method calls and properties, and remove the 'quit' call and the scripts should work ok externally. |
![]() |
![]() |
![]() |
#115 |
Junior Member
Join Date: Aug 2003
Location: Croatia
Posts: 32
|
Winamp 5.04 with media l. is loaded I Dbl click any of scripts, the error is still there.
|
![]() |
![]() |
![]() |
#116 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
As stated above, those scripts are not designed to be run externally, although it is possible.
If you are planning on using this to extract the selected files from an external app, I would advise importing 'ActiveWinamp.Application' and calling methods on it directly, namely playlist.getselected(), which returns an array of mediaitems. There is a cpp example in this thread, but it can be adapted to VB easy enough. |
![]() |
![]() |
![]() |
#117 |
Junior Member
Join Date: Apr 2004
Location: NL
Posts: 23
|
Is there a way to work with a rating-system that support more levels than the standard-ID3V2 5-star system? (Preferably, ratings between 1 and 100).
I'd like it to be possible to set these ratings in Winamp - not some external program - and, if possible, also save this info in the ID3 tag. I've tried some things, but it seems that Winamp deletes custom ID3V2 tags when you change e.g. the title of a song - which is obviously annoying. Anyone? |
![]() |
![]() |
![]() |
#118 |
Major Dude
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
|
The standard id3v2 system is actually 0-255. Winamp uses a 5 star system in its ML. I dont believe I set a limit in this plugin, so you should be able to set the rating to whatever you like. Dont expect it to be displayed in the ML of course, it uses ***** and theres nothing you can do about that.
If you take a look at the ID3 rating export/import script I wrote, you could modify it to write whatever rating number you like to the field. I currently just take the rating and multiply/divide it by 51 in that script which is what WMP does. But again, the ML will ignore whatever you write to this tag, the ML does not read in rating data from id3 tags by default. |
![]() |
![]() |
![]() |
#119 |
Junior Member
Join Date: Apr 2004
Location: NL
Posts: 23
|
Thanks for the answer. Another question:
Is it possible to turn some kind of function on/off? I want a script that executes some actions each time a song is played, but only when I am in "perform this on each song-mode". When I'm not in that mode, it should do nothing. How can I do that? |
![]() |
![]() |
![]() |
#120 |
Junior Member
Join Date: Apr 2004
Location: NL
Posts: 23
|
Is it also possible to have some script to be executed every X minutes? (Just like the media library is re-read every Y minutes)
|
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|