No announcement yet.

Winamp Scripting

  • Filter
  • Time
  • Show
Clear All
new posts

  • @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) "C:\Mp3\downart """ & mpath & """"
    end if

    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
    for an example of using id3com to access id3 tags.
    Last edited by shaneh; 1 October 2004, 02:52.
    Music Plugins


    • 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

      set xmlhttp = CreateObject("Msxml2.XMLHTTP.4.0")
      set xmlDoc = CreateObject("Msxml2.DOMDocument.4.0")

      xmlhttp.Open "GET", "" + art, false

      res = xmlhttp.responsetext
      xmldoc.validateonparse = false
      xmldoc.resolveexternals = false

      ns = "xmlns:asx=''"
      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)
      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
      end if


      end if
      Music Plugins


      • + 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
        Attached Files
        Music Plugins


        • 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


          • 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.
            Music Plugins


            • 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.
              Attached Files
              Music Plugins


              • +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.
                Attached Files
                Music Plugins


                • Help needed

                  (sorry about my english)

                  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????
                  Attached Files


                  • 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.
                    Music Plugins


                    • Winamp 5.04 with media l. is loaded I Dbl click any of scripts, the error is still there.
                      Attached Files


                      • 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.
                        Music Plugins


                        • 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.


                          • 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.
                            Music Plugins


                            • 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?


                              • 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)