Announcement

Collapse
No announcement yet.

Winamp Scripting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • You need to put id3com.dll wherever you like, then run

    regsvr32 id3com.dll

    and you will be able to use it. However, it is a bit tricky to use. As I said, you may be better off with some kind of mass tagger.
    Music Plugins

    Comment


    • i tried explaining that to him before. i suggested that he use mp3tag (a mass tagger). You can create a playlist in winamp. save it. open the playlist in mp3tag and mass tag their genres. and it saves it to id3v1 and id3v2.

      Comment


      • I have Tag&Rename which works fine, but I want it to be able to do it on the fly without using another program. I think I follow what you did in your script examples, we'll see if I can figure it out

        Comment


        • shaneh, where can I find the id3com you used in the script examples?

          Comment


          • I realize this plugin (thanks shaneh) is geared toward the do-it-yourself users, but it would be cool if users would post their scripts so those who aren't so adept at writing scripts could make use of the added features, and learn from others' work as well. So far I've dabbled a little (successfully) with simple modifications to existing scripts but when it comes to writing a script whole-cloth I have to admit the included help-file is a little over my head. Earlier in this thread there was quite a bit of posting of scripts, I kinda wish there was more of that.

            Regards,

            Comment




            • Has a version, not sure how recent though. ID3Com hasnt had an update in a while, its now part of id3lib or something. Not too sure.

              An issue with it is it only takes a number for the genre, rather than a string and then converting it. So you will need to do that yourself, unless you can find some other library that uses a string.



              Seems to take a string, but it didnt seem to work for me if the genre field doesnt exist to begin with. The author of that is putting the code towards id3com so Im not sure which is more recent.

              x = GetSendToItems

              if ubound(x,1) > 0 Then

              set id3co = CreateObject("ID3Com.ID3COMTag")
              newgenre = CStr(InputBox("New Genre"))

              for each track in x
              id3co.link track.filename
              if id3co.HasV2Tag then
              'set id3 tag (only takes a number)
              id3co.Genre = 0
              'set media library data
              track.genre = newgenre
              id3co.SaveV2Tag
              end if
              id3co.Clear
              next
              end if
              quit

              Will work, but note the fact it just sets the genre to '0' (Blues). You will have to work out a way to decide what genre number to use (0-255).

              If you can find a command line id3 tagger which takes a filename and a argument, such as:

              id3tag "song.mp3" -genre Dance

              or whatever, you can use wscript.shell.run to run the command on every item rather than using id3com. There should be an example in this thread by saivert on running an external program.

              @¿¢?: Sure I encourage that, I intend to setup a site which will have a repository of scripts, similar to the winamp plugin database. Will take a little while, but in the meantime is there any particular script you are after?
              Music Plugins

              Comment


              • Originally posted by shaneh
                @¿¢?: Sure I encourage that, I intend to setup a site which will have a repository of scripts, similar to the winamp plugin database. Will take a little while, but in the meantime is there any particular script you are after?
                The one I tried & wasn't successful at was to enqueue the current ml selection after current with a hotkey.

                A site for the scripts is a great idea. Maybe I'll catch up by then & can add some to the database. :-)

                Comment


                • You cant do that actually. The current ml selection is known when the item is selected on the 'send to' menu. Unfortuantly this is a limitation of winamp, there is no documented way to get the selection in the media library other than by selecting an item on the 'send to' menu.

                  Thus, the command is 'getsendtoitems' as it is the items 'collected' by the Send To menu. And getselected() is a method of the playlist, thus gets selected items in the playlist.

                  I will take a look and see if there is a practical way to get the selected items in the media library, but it wont appear in activewinamp until the next revision if so.
                  Music Plugins

                  Comment


                  • shaneh, for id3v1 the genre is stored as a number, but for id3v2, the genre is whatever you name it. That's why I just want to change id3v2, it looks like you are saving the v2 tag, but that's odd that it still stores it as a number

                    Comment


                    • multi instance with activeWA

                      Hi out there!

                      I've running two instances of winamp classed as 'Instance1' and 'Instance2'. Using only the library of one instance I have to send items through the 'sendto', right?

                      I tried something like this:
                      code:

                      'sendto_Instance1.vbs
                      Dim x, WshShell

                      Set WshShell=CreateObject("WScript.Shell")
                      x = GetSendToItems

                      if ubound(x,1) > 0 then

                      for each track in x
                      WshShell.Run "c:\\programs\\winamp\\winamp.exe /CLASS""Instance1"" /ADD """ & track.filename & """"
                      next

                      end if
                      quit

                      (just the same with 'sendto_Instance2')

                      Seems not to work correctly but I can't figure out the reason.
                      Right way to do this, or is there a (better) internal way?
                      Or is it better to have two diffrent winamp installation folders?

                      regs
                      No, I'm not Lion King - neither related by marriage!
                      bookmarks: Joonas | DrO | shane.h
                      discussion bookmarks: DL | AL | JTFE | TRAP | Toaster | AWA | SUI | MlTree

                      Comment


                      • Hello, I'm doing some more experimenting and have a question: How do we randomize the results of an insert script? What I've done so far is modify the insert all from album script to make it insert all from genre.

                        x = playlist.getselection()

                        if ubound(x,1) > 0 then
                        mlq = medialibrary.runqueryarray("genre HAS """ + x(1).genre + """")

                        for each track in mlq
                        if strcomp(track.filename, x(1).filename) <> 0 then
                        track.insert(x(1).position)
                        end if
                        next
                        end if

                        quit


                        Thank you for your help and patience with me, shaneh. I am just beginning to learn this language. Best regards,

                        /edit Firefox crashed when I tried to post the formatted text so I had to post it as plain text.

                        Comment


                        • What you are trying to do is a pretty common CS problem- randomizing an array. There are various ways to do it, but a simple way with just a small array is to loop through the array swapping each item with a random other item.

                          Randomize
                          x = playlist.getselection()
                          if ubound(x,1) > 0 then
                          mlq = medialibrary.runqueryarray("genre HAS """ + x(1).genre + """")

                          i = 0
                          for each track in mlq
                          i = i + 1
                          swapitems mlq(i), mlq(Int((ubound(mlq,1)) * Rnd + 1))
                          next

                          for each track in mlq
                          if strcomp(track.filename, x(1).filename) <> 0 then
                          track.insert(x(1).position)
                          end if
                          next
                          end if
                          quit

                          sub swapitems(ByRef val1, ByRef val2)
                          set temp = val2
                          set val2 = val1
                          set val1 = temp
                          End Sub


                          There are a few ways to make this more efficient, for example, there is no real need to loop through the array twice, you can modifiy it to just do it once.

                          I should have added support for jscript for scripting as well, but didnt have time. Hopefully I will add jscript and maybe perl support in a later release. Adding other language support for the internal scripting is not too difficult fortuantly. VBScript is not too difficult to learn though, and made more sense to use as the default language for now.
                          Music Plugins

                          Comment


                          • @Lion12: ActiveWinamp was not really designed with multiple instances in mind. If you popup a msgbox with the track names instead of running winamp.exe does it display the right names? Does the /ADD command work when not using from a script?
                            Music Plugins

                            Comment


                            • Jeah, multiple instances with winamp seems to be a really damn thing but many people would like to have two instances running for different reasons...
                              Back to main topic:
                              1.) the names appear correctly
                              2.) yes, there seems to be a problem:
                              the tracks are added to the instance last having focus. So I can't use /CLASS and /ADD at once?
                              Some weird shell thing:
                              I start Winwamp with $...\winamp.exe /CLASS"one" and winamp starts.
                              I type again $...\winamp.exe /CLASS"one" and another winamp opens.
                              (of coures only if 'allow multiple instances' is checked)
                              Searched the forums and the old sdk but it makes me even more .

                              This seems not to be related to your plugin so I will only ask you if it's planed to consider multiple instances or some kind of workaround within your scriptring plugin?
                              Something like GETWND/TOWND?? !? Donno that's possible.

                              Thanx for your attention!

                              EDIT:
                              btw: it's no problem to send files to another mediaplayer this way. This helps a little bit by now
                              Last edited by Lion12; 17 November 2004, 15:36.
                              No, I'm not Lion King - neither related by marriage!
                              bookmarks: Joonas | DrO | shane.h
                              discussion bookmarks: DL | AL | JTFE | TRAP | Toaster | AWA | SUI | MlTree

                              Comment


                              • ActiveWinamp script for Nero Cover Designer

                                Hi Y'all.

                                I've created an ActiveWinamp script that sends the current track selection to Nero 6 Cover Designer. This is a first pass and could use some error trapping etc, but it works as is. I'm sure the general population would appreciate this so I'd like to find a home for it. Suggestions? Feedback?

                                BTW Shane, ActiveWinamp rocks!!

                                code:

                                ' ActiveWinamp Script: "sendto_Nero Cover Designer.vbs"
                                ' Desc: Nero Cover Designer SendTo Script

                                '########################
                                ' CODE
                                '########################
                                Const ForReading = 1, ForWriting = 2, ForAppending = 8

                                Set wsh = CreateObject("WScript.Shell")
                                Set fso = CreateObject("Scripting.FileSystemObject")
                                cdcFile = wsh.ExpandEnvironmentStrings("%TEMP%") & "\watemp.cdc"
                                Set fcdc = fso.OpenTextFile(cdcFile, ForWriting, True)

                                sel = GetSendToItems
                                If ubound(sel) = 0 Then
                                MsgBox "No tracks selected", vbOKOnly+vbQuestion, "SendTo Nero Cover Designer"
                                Quit
                                End If

                                ' Get total selection time
                                plTime = 0
                                for each track in sel
                                plTime= plTime + track.Length
                                next

                                ' Write collection info
                                fcdc.WriteLine("[Parameters]")
                                fcdc.WriteLine("Language=English")
                                fcdc.WriteLine("[CDINFO]")
                                fcdc.WriteLine("Type=Audio-CD")
                                fcdc.WriteLine("Title=Winamp")
                                fcdc.WriteLine("Artist=Winamp")
                                fcdc.WriteLine("Tracks=" & ubound(sel))
                                fcdc.WriteLine("Playtime=" & ConvertSeconds(plTime))

                                ' Write track info
                                i=1
                                for each track in sel
                                fcdc.WriteLine("[Track" & i & "]")
                                fcdc.WriteLine("Type=Audio")
                                fcdc.WriteLine("Artist=" & track.Artist)
                                fcdc.WriteLine("Title=" & track.Title)
                                fcdc.WriteLine("Playtime=" & ConvertSeconds(track.Length))
                                i=i+1
                                next

                                fcdc.Close

                                ' Launch Nero Cover Designer
                                ncdPath = wsh.RegRead("HKLM\SOFTWARE\Classes\Nero Cover Designer.Document\shell\open\command\\")
                                ncdPath = Left(ncdPath, InStr(ncdPath, " /dde"))
                                wsh.Exec(ncdPath & " " & cdcFile)

                                Quit


                                '########################
                                ' FUNCTIONS
                                '########################

                                Function ConvertSeconds(lSeconds)
                                Dim lTmpMinutes
                                Dim lTmpSeconds
                                Dim lTmpHours

                                If lSeconds > 59 Then
                                'Get's *just* the amount of seconds that will be returned
                                lTmpSeconds = lSeconds Mod 60
                                'Do we have more than an hour's worth of seconds?
                                If lSeconds > 3599 Then
                                'How many hours are we talking about
                                lTmpHours = Fix(lSeconds / 3600)

                                'Take the original seconds and figure out
                                'how many minutes we have. Then remove from that
                                'anything that says "60" for the minutes. So we
                                'don't have "2:60:05"
                                lTmpMinutes = lSeconds / 60 - (60 * lTmpHours)

                                'Finally return the value all nicely formatted up
                                ConvertSeconds = lTmpHours & ":" & _
                                FormatTime(lTmpMinutes) & ":" & _
                                FormatTime(lTmpSeconds)
                                Else
                                'Ok. We've got something less than an hour.
                                'How many minutes do we have?
                                lTmpMinutes = Fix(lSeconds / 60)

                                'Seconds were already figured above (lSeconds Mod
                                '60) so we just return the value and we be done.
                                ConvertSeconds = lTmpMinutes & ":" & _
                                FormatTime(lTmpSeconds)
                                End If
                                Else
                                'This is for the lazy that sends us less than even a
                                '*minutes* worth of seconds. Just dress it up and send
                                'it back.
                                ConvertSeconds = "0:" & FormatTime(lSeconds)
                                End If
                                End Function


                                Function FormatTime(tval)
                                If tval < 10 Then
                                FormatTime = "0" & tval
                                Else
                                FormatTime = CStr(tval)
                                End If
                                End Function

                                Last edited by maynardkrebs; 22 November 2004, 02:05.

                                Comment

                                Working...
                                X