Announcement

Collapse
No announcement yet.

Winamp Scripting

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

  • Originally Posted by osmosis View Post
    As long as you mean enqueue as in the next files in the playlist and not the JumpToFile plugin function, it's a pretty simple task.
    Ah.. I didn't know that there is a difference.
    I need exactly JumpToFile plugin queue.

    Comment


    • JumpToFile is a seperate plugin. You cannot access it.
      Request: A little SmartView Query Language love.

      Comment


      • Just so people are aware, there may be a bizarre incompatibility with ActiveWinamp (especially Party Shuffle) and DrO's Playlist Undo plugin at the moment which can result in deletion of files previously played, without notification (and not to the Recycle Bin, fully deleted).

        I can't say for sure, but it seems likely that the problem is caused by the FileSystemObject added in Party Shuffle v3.4 (which simply checks if a file exists) and some issue with the way it interacts with Playlist Undo's playlist backups/undo queue; so other ActiveWinamp scripts with FileSystemObjects may similarly cause this issue.

        Disabling Playlist Undo (rename from .dll to .dll.off, etc.) will avoid/fix this issue. Or if you prefer, you may revert to Party Shuffle 3.3.

        Be careful, however, once these bad entries are added to the undo queue, they will continue to remain in the queue and possibly delete files until they have exited the queue (even between seperate Winamp instances if you have Playlist Undo set to preserve the queue) or until the queue is cleared (which I've found also appears to delete files).

        I apologize for this unforseen issue, I only just noticed it this week and have myself probably lost ~100 random songs over the last month until I discovered it. DrO has been informed and it will be looked into when he can find the time to see whether the fault lies with ActiveWinamp or Playlist Undo and hopefully come up with some kind of solution.

        Thanks.
        Request: A little SmartView Query Language love.

        Comment


        • When I try to run this script Winamp crashes. I am using Win 7 64 bit. Anyone else have this issue?

          Comment


          • That usually happens when you haven't registered the AW plugin dll with Windows:
            Elevated command prompt. Go to your plugin dir. "regsvr32 gen_activewa.dll" (without the quotes).
            Request: A little SmartView Query Language love.

            Comment


            • Thanks! Working great now!

              Comment


              • sendto_Set Playcount.vbs
                x = GetSendToItems

                if ubound(x,1) > 0 then
                for each track in x
                s = inputbox(track.title+vbCrLf+vbCrLf+"Currently: "+cStr(track.playcount),"Set Playcount",cStr(track.playcount))
                if s <> empty then track.playcount = cInt(s)
                next
                end if

                quit
                This will run from the ML via SendTo, but not from the PL for some reason.. and for some reason the ML SendTo seems to trigger things twice, regardless of what is actually in the script.. so double dialog boxes. Anyone got any ideas?
                Request: A little SmartView Query Language love.

                Comment


                • What is Winamp? Why is Winamp? How is Winamp? All these burning questions and issues discussed within.

                  Help? There are cases where this would be very helpful. For ex. duplicate songs, one of better quality, one of lesser, where you'd want the better quality one; OR songs that are meant to play one after the other.

                  Comment


                  • Originally Posted by osmosis View Post
                    That usually happens when you haven't registered the AW plugin dll with Windows:
                    Elevated command prompt. Go to your plugin dir. "regsvr32 gen_activewa.dll" (without the quotes).
                    No seriously, what Osmosis said here.

                    I ran a shoutcast station for over 5 years with activewinamp interfacing with winamp to do a host of things. I haven't had it running since upgrading to windows 7 for a while now, and this was just one step of many, but you need to regsvr32 on the activewa dll in order to add it to your references in your c# project.

                    Comment


                    • Hi everybody,

                      I have a favor to ask you. Can you make me a scipt like “enqueue_random_albums” (Author: MarquisEXB ) but a modified script that displays only one song per album (or few mixed songs per album but not the full album) and without separators.

                      I would like a script that displays random files from media library to playlist but with the possibility to choose the genre, the years and the playcount like in this script.


                      on error resume next
                      Randomize

                      'dim i,j,Dict1,tracks,num,idxs

                      TheQuery=getMLQquery("type=0 &! (album ISEMPTY)")
                      msgbox TheQuery

                      mlq = medialibrary.runqueryarray(TheQuery)

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

                      i = 0
                      AllAlbums="" ' string that contains all album names

                      for each track in mlq
                      if instr(AllAlbums,ucase(track.album)) = 0 then
                      i = i + 1
                      AllAlbums=AllAlbums&vbcrlf& ucase(track.album)
                      Dict1(ucase(track.artist))=Dict1(ucase(track.artist)) & vbcrlf & _
                      CStr(i) & asc(178) & ucase(track.album)
                      end if
                      next

                      itms = Dict1.Items
                      numArt=ubound(itms)+1

                      num = CInt(InputBox("Albums: " & i & vbcrlf & _
                      "Artists: " & numArt & vbcrlf & _
                      "Choose the # of albums","#","3"))

                      if numart>=num then

                      do while (tracks<num)

                      safe = 0

                      do
                      safe=safe+1
                      Randomize
                      RandArtist = Int(numArt*Rnd) ' This is the artist
                      loop until (safe > 10000) or (instr(AllArtists,RandArtist & ";")=0)

                      AllArtists=AllArtists & RandArtist & ";"
                      'msgbox AllArtists & vbcrlf & "-" & itms(rand)

                      arrSong = Split(itms(RandArtist ), vbcrlf)
                      Randomize
                      TheAlbum = split(arrSong(int(ubound(arrSong)*RND +1)),asc(178) )(1)

                      InsertAlbum theAlbum

                      tracks=tracks+1
                      Loop
                      else
                      msgbox "Too many songs"
                      end if

                      quit

                      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                      ''''''''''''''''''''''''''''' FUNCTIONS
                      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

                      function InsertAlbum(thealbum)

                      mlq2 = medialibrary.runqueryarray("album = """ + thealbum + """")
                      Set Dict2 = CreateObject("Scripting.dictionary")
                      Dict2.CompareMode = BinaryCompare

                      i = 0
                      min=1000000
                      max=0

                      ' This section is to sort by track number.

                      for each song in mlq2
                      i=i+1
                      theTrack=song.track
                      Dict1(theTrack)=i
                      if theTrack<min then
                      min=theTrack
                      end if
                      if theTrack>Max then
                      max=theTrack
                      end if
                      next

                      for z= min to max
                      if len(dict1(z)) > 0 then
                      mlq2(dict1(z)).enqueue
                      end if
                      next 'z

                      set sep = LoadItem("X:-- " & thealbum & " (" & ubound(mlq2) & ") --------------------------")
                      sep.insert(playlist.count)

                      mlq2=""
                      end function

                      private function getMLQquery(strInitial)
                      ' This asks the user some questions so that
                      ' you can choose music as you see fit.

                      dim genres,years,ratings,extra

                      genres=cSTR(InputBox("Genre(s) BEGINS with... ?","GENRES","alt,new,punk,lo,hip-r,ska"))
                      Randomize
                      ranYear = int(rnd()*datediff("yyyy", #01-01-1977#, now())) + 1977
                      years=cSTR(INputBox("Year? [ex: > 2000) -- or > 1995 AND Year < 2000]","YEAR","year >= " & ranYear))
                      ratings = cSTR(InputBox("Ratings?","Rating","rating > 1 "))
                      Extra=cSTR(INputBox("Extra? [ex: & (lastplay < [3 weeks ago] OR playcount < 1)","EXTRA","(lastplay < [3 weeks ago] OR playcount < 1)"))

                      if len(extra) > 0 then
                      extra = " & (" & extra & ") "
                      end if

                      if len(ratings) > 0 then
                      ratings = " & (" & ratings & ") "
                      end if

                      if len(years) > 0 then
                      years = " & (" & years & ") "
                      end if

                      if len(genres) > 0 then

                      genre=split(genres,",")

                      if ubound(genre) >0 then
                      genreline="& ("
                      for each onegenre in genre
                      genreline=genreline & " genre begins """ & onegenre & """ OR "
                      next
                      genreline = genreline & " Genre begins "" QQQ "") "
                      else
                      genreline="& GENRE BEGINS """ + genre(0) +""""

                      end if
                      else
                      genreline=""
                      end if

                      GetMLQquery= strInitial &ratings & genreline & years &extra
                      end function

                      Thank you in advance and sorry for my English.

                      - Aurel -

                      Comment


                      • one song per album, without separators, choose the genre, the years and the playcount
                        Aurel: you can do all of that with Party Shuffle.
                        Request: A little SmartView Query Language love.

                        Comment


                        • thanks Osmosis but with Party Shuffle I can't to choose genre, years and playcount

                          Comment


                          • Yes you can, check the RATE CONFIG CODE at the end of the script. Your files don't actually need to be rated, this is how the script works. It adjusts the likelihood the song will be played based on your criteria; this includes genre, year and playcount.

                            If you want a pulldown then you could always add that in too like in Marquis' excellent script.
                            Request: A little SmartView Query Language love.

                            Comment


                            • I would like this function:

                              private function getMLQquery(strInitial)
                              ' This asks the user some questions so that
                              ' you can choose music as you see fit.

                              dim genres,years,ratings,extra

                              genres=cSTR(InputBox("Genre(s) BEGINS with... ?","GENRES","alt,new,punk,lo,hip-r,ska"))
                              Randomize
                              ranYear = int(rnd()*datediff("yyyy", #01-01-1977#, now())) + 1977
                              years=cSTR(INputBox("Year? [ex: > 2000) -- or > 1995 AND Year < 2000]","YEAR","year >= " & ranYear))
                              ratings = cSTR(InputBox("Ratings?","Rating","rating > 1 "))
                              Extra=cSTR(INputBox("Extra? [ex: & (lastplay < [3 weeks ago] OR playcount < 1)","EXTRA","(lastplay < [3 weeks ago] OR playcount < 1)"))

                              Comment


                              • I might be the only one who still uses this, but....

                                As mentioned in the announcement thread, I forked the project today to get it working for what I needed:



                                Source->Release to get the latest dll.

                                Changes:
                                Accepts .js and .ps1 (PowerShell) files
                                Upgraded to full Unicode support
                                Unicode support also fixed the rating, playcount, lastplay, etc bugs.

                                To use PowerShell at all, you have to open an admin command prompt and run:
                                code:
                                %windir%\syswow64\windowspowershell\v1.0\powershell Set-ExecutionPolicy RemoteSigned
                                Otherwise PS scripts can't run outside of the PS sandbox. Scripts are named and located the same as before, only with a .ps1 ext.

                                I'm going to upload some sample scripts, but to use it in a PS script, start with:
                                code:
                                $aw = New-Object -ComObject ActiveWinamp.Application
                                at the top; from there, you can access $aw.playlist, $aw.medialibrary, etc, as you would in VBS. The plugin automatically executes the x86 PS, since Winamp will never be x64. You can call them from the command line, like:
                                code:
                                powershell -file "AnyScript.ps1"
                                If you do, I really recommend adding an x64 guard at the top, like so:
                                code:
                                if ($env:Processor_Architecture -ne "x86") {
                                write-warning 'Switching to x86 mode...'
                                &"$env:windir\syswow64\windowspowershell\v1.0\powershell.exe" -noninteractive -noprofile -file $myinvocation.Mycommand.path -executionpolicy bypass
                                exit
                                }

                                I'm going to be adding all of the library fields that aren't available yet next.

                                Comment

                                Working...
                                X