Old 26th January 2006, 00:04   #321
DrO
 
Join Date: Sep 2003
Posts: 27,880
i'd assume shane uses the code he posted to get the selected playlist items so yes, it would be broken by the change. as is in the post i made at the start of the thread, it's simple to fix

-daz
DrO is offline   Reply With Quote
Old 26th January 2006, 00:28   #322
Thunder Pussy
Feed me a stray dog
(Major Dude)
 
Join Date: Oct 2004
Posts: 1,122
I read that & it's good to hear that it's simple to fix. I brought it to this thread b/c I noticed Shane hasn't posted in a while & wanted to show how I like activewinamp. Thanks for the info.

Best,
Thunder Pussy is offline   Reply With Quote
Old 26th January 2006, 00:32   #323
DrO
 
Join Date: Sep 2003
Posts: 27,880
Since the activewinamp source is available in cvs then anyone could provide a patched version of the plugin. Yeah, there's been no posting in some time though i've noticed a certain name in the 'users browsing this forum' info...

-daz
DrO is offline   Reply With Quote
Old 26th January 2006, 11:19   #324
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
Yes I still come in and read the posts when I can. Though it takes a lot longer to reply than read, and I unfortuantly don't have time for support anymore. I have around 200 unanswered emails in my inbox, hundreds of things to do, and basically no time anymore to do it. Its quite depressing to think that if I were to try handle all of that, all my free time for the forseeable future would be consumed.

Nonetheless... I will try take a look at this stuff soon. I desperately need to get a new version of AW out, as the one in the CVS fixes a few things, though it too needs a few fixes. The method I used to get the selection seems to still work for now in the beta, but I will add support for the newer method for newer versions of Winamp. With these ATF changes I will need to update a few of my plugins anyway.
shaneh is offline   Reply With Quote
Old 31st January 2006, 14:50   #325
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
I wrote a script that will prompt for a year (inputbox) and change the mp3 tag (using id3co). Although the mp3 gets updated, the winamp ml keeps the previous year data.

I'm using a sendto: "for each track in x" and I've tried track.year=songyear, but I get an error. For the time being I'm running my script then using CTRL-E to update the ml. (I know you can update the mp3 tag with CTRL-E, but it's considerable slower - than even this method).

I have about 3000 songs without the year data in them & it's tedious enough to find the year data. I guess I could remove it from the database & re-add (I keep all my playcount & rating info in the mp3 tag), but again that's a bit tedious.

Is there anyway to update the ml from the file using a script?
MarquisEXB is offline   Reply With Quote
Old 31st January 2006, 14:52   #326
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
Another question:

Is there a way to have a script run after a file has been played? This way I can update my mp3 tag with playcount & rating everytime an mp3 is played.
MarquisEXB is offline   Reply With Quote
Old 1st February 2006, 10:11   #327
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
As I explained in my email, the reason many fields are read only is because :

a. I havent got around to exposing them properly
b. I wasnt sure these fields should be made writeable anyway - ie filesize and time etc shouldnt really be modified. The file itself should be, and then the ml told to re-read the info. As AW doesnt modify file tags, I wasnt sure about the ml and id3 tag getting out of sync.
c. I would prefer to have the cached object modified, then issuing a 'update to ml' type function so that all the info would be updated in one update rather than one for each meta data item modified.

Currently, meta data is updated into the ml as the property is modified, which Im not a massive fan of, but it does simplify programming. I have updated the cvs version to expose year, length and track in this way. I will do bitrate,filetime and filesize etc later. I may possibly use a flag in the media item to switch between on-demand ml updates or not for better performance when needed.


There is a 'track change' event that you can hook for performing actions when a new song is played.
shaneh is offline   Reply With Quote
Old 2nd February 2006, 02:46   #328
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
Script To Download Album Cover Art

Here's something I wrote yesterday. Not sure if it should get its own thread, but since it's a winamp script, I'll include it here.

You need to download AlbumArtAggregator, which you can get free online. I have the script download the file into the folder with the mp3, but have it named by the album cover. I added this to toaster "%dir%\\%album%.jpg;" because that way I can have multiple album covers in one directory.

It should be fairly easy to substitute the location of AAA.exe or the name of the image file downloaded. Save it as sendto_AAA.vbs in your WA scripts folder.

PHP Code:
on error resume next

' This requires AlbumArtAggregator.exe
You can find it at:
' [url]http://team.thenexusnet.com/nexus/AAA/[/url]

' This program will look for album.jpg in 
the same folder the mp3 resides in.
' If the .jpg doesn't exist
' this .vbs will use AlbumArtAggregator.exe
to download a file into album.jpg

AAA 
"C:\Program Files\AlbumArtGen\AlbumArtAggregator.exe"

Dim fso
set fso 
CreateObject("Scripting.FileSystemObject")

vbq chr(34' double quotes for later usage

x = GetSendToItems
if ubound(x,1) > 0 Then

dim AlbCompl ' 
This keeps track of what albums were done (so no repeats)

for 
each track in x
    Set f 
fso.GetFile(track.filename)
    if 
instr(AlbComplf.ParentFolder "\" & track.album & ".jpg") then
        'An attempt was already made on this album
        'msgbox "
Done Before"
    else
        'add target filename to albcompl - so that we're not trying 
        'to get the same album more than once
        AlbCompl=AlbCompl & f.ParentFolder & "
\" & track.album & ".jpg" & vbcrlf

        if fso.FileExists ( f.ParentFolder & "
\" & track.album & ".jpg") then
            'msgbox "
Image exists" & f.ParentFolder & "\" & track.album & ".jpg"
        else
            'msgbox "
Image not found" & f.ParentFolder & "\" & track.album & ".jpg"

            'Run AAA to download the file
            cRun vbq & AAA & vbq & " " & _
            vbq & track.artist & " 
" & track.album & vbq & _
            " " & vbq & f.ParentFolder & "
\" & track.album & ".jpg" & vbq
        end if
        '    msgbox track.filename
    end if
next
end if
msgbox "
Noof jpegs attempted to download" & ubound(split(AlbCompl,vbcrlf)) 
quit

private sub cRun(strcRun) 'subroutines to call AAA
Dim WSHShell 
Set WSHShell = CreateObject("
WScript.Shell") 

WSHShell.Run strcRun, 1, true 
end sub 
MarquisEXB is offline   Reply With Quote
Old 18th February 2006, 18:35   #329
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
This script goes through every song in your playlist** and notes the artist. It then runs through & repopulates the playlist with the first song from each artist. Then it enqueues the second (if any) song from each artist, and so forth.

One application of this is if you want to listen to 10 or 20 different albums, but don't want to hear any song by the same artist twice in a row (until the very end). You may want to enqueue 20 albums from different artists & randomize it, because if not you'll hear every first song on the albums first, then all the second songs on each album, etc.

Another use for this is if you make a playlist with a few random collections, but you don't want to hear the same artist twice in a row.

** (I used x = playlist.getselection(), because I don't know how to get the entire playlist).

playlist_Dupe_Artist_Move

PHP Code:
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Select **ALL** the songs in your playlist
'
This will reorder ittaking any songs
' by duplicate artists & move them to the end.
'
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim x
x = playlist.getselection()
playlist.clear

Set Dict1 = CreateObject("Scripting.dictionary") 
Dict1.CompareMode = BinaryCompare 
i=1 ' 
i is the number of each treack

for each track in x
Dict1
(ucase(track.artist))=Dict1(ucase(track.artist)) & vbcrlf cstr(i)
i=i+1
next

i
=' now i represents the number of times to go through the array

do 
    EndLoop=TRUE
    i=i+1

    for each Songs in Dict1.Items 

    if ubound(split(songs,vbcrlf)) >= (i)  then 
        EndLoop=FALSE
        x(split(songs,vbcrlf)(i)).enqueue
    end if

    next    '
for each Songs in Dict1.Items 

' set sep = LoadItem("X:~~ " & i  & " ~~~~~~~~~~~~~~")
sep.insert(playlist.count)

loop until EndLoop or 100000 ' failsafe


quit 
MarquisEXB is offline   Reply With Quote
Old 18th February 2006, 18:44   #330
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
Oh and if you want a script that will give you X number of albums, without repeating the same artist, use this script.

You'll want to edit this section, it should be relatively self explanatory. The genres are comma seperated, and each one will give you Genre Begins 'XXX'. Year will give me a year between today & 1977.

PHP Code:
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)")) 
playlist_1_Albums_Random.vbs

PHP Code:
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 

    AllAlbums
=AllAlbums&vbcrlfucase(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)+

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

if 
numart>=num then 

do while (tracks<num

safe 

        
do 
                
safe=safe+
            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+
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 zmin 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 
MarquisEXB is offline   Reply With Quote
Old 18th February 2006, 19:35   #331
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
And for those that are too lazy to copy & paste...
Attached Files
File Type: zip 2_scripts.zip (2.2 KB, 1319 views)
MarquisEXB is offline   Reply With Quote
Old 18th February 2006, 23:25   #332
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
Ive added those scripts to : http://www.myplugins.info/activewina.../examples:root

You and everyone else has access to add and edit entries on these pages.

Note, to get every item in your playlist, just use the playlist object. ie. msgbox playlist(1).artist

or

for each song in playlist
msgbox song.artist
next
shaneh is offline   Reply With Quote
Old 19th February 2006, 00:31   #333
Thunder Pussy
Feed me a stray dog
(Major Dude)
 
Join Date: Oct 2004
Posts: 1,122
Neat albums script. Thanks, MarquisEXB

/edit Excellent albums script.

Last edited by Thunder Pussy; 19th February 2006 at 00:55.
Thunder Pussy is offline   Reply With Quote
Old 19th February 2006, 19:33   #334
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
Quote:
Originally posted by shaneh

Note, to get every item in your playlist, just use the playlist object. ie. msgbox playlist(1).artist

or

for each song in playlist
msgbox song.artist
next [/B]
I've modified the wiki site to reflect this.

Thanks for the code.
MarquisEXB is offline   Reply With Quote
Old 19th February 2006, 19:43   #335
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
Question how would you know which is the next song, or the selected song in Winamp?

For example, I can randomize all the songs in the playlist, but I would like to put the currently playing or highlighted song as #1 in the playlist. How would I get this info from AW?
MarquisEXB is offline   Reply With Quote
Old 20th February 2006, 02:21   #336
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
I'll answer my own question:

playlist.position

MarquisEXB is offline   Reply With Quote
Old 26th February 2006, 22:58   #337
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
Added script to wiki: delete duplicately titled songs.

This script will delete any songs with the same title from your playlist. Good if you make a playlist from multiple queries, have lots of compilations/greatest hits, cover songs, or live albums & don't want to hear the same song in different version.

http://www.myplugins.info/activewinamp/doku.php/exampleslaylist:remove_duplicately_titled_songs

Anyway it's on the wiki if the above link doesn't work.

http://www.myplugins.info/activewina.../examples:root
MarquisEXB is offline   Reply With Quote
Old 27th February 2006, 19:23   #338
heinz57g
Junior Member
 
Join Date: Feb 2006
Posts: 31
ACTIVEWINAMP in WA 5.20 not working?

could anybody confirm that the basic ACTIVEWINAMP is not working anymore in 5.20? upgraded this morning, and noticed
a while later that while the scriting menue still appeared, none of the functions (sort/random/whatever) had any effect at all.

i am a rather basic user, having just used the most easy setup to sort by track number and similar, so if there is a workaround or update, could somebody kindly put this in simple words and let me know?

or just confirm it is over with for the time being?

greetings - heinz -
heinz57g is offline   Reply With Quote
Old 27th February 2006, 21:38   #339
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
The swapindex command seems to be broken. Not sure what else.
MarquisEXB is offline   Reply With Quote
Old 27th February 2006, 23:05   #340
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
Hmm this is odd. I can run my playlist randomizer on the entire playlist. However if I run it with just the selected items (the default script that comes with AW) it doesn't work.
MarquisEXB is offline   Reply With Quote
Old 1st March 2006, 03:23   #341
billyvnilly
Forum King, M.D.
 
billyvnilly's Avatar
 
Join Date: Mar 2004
Location: Detroit burbs
Posts: 3,379
Send a message via ICQ to billyvnilly Send a message via AIM to billyvnilly
@heinz
you can try downloading the latest version of AW. save the .dll file in dir\winamp\plugins. it should replace existing copy of gen_activewinamp.dll

CVS

@marquis... hey I've noticed youve been doing some scripts and i wonder if you take requests. Take the ratings from the songs in playlist, and add song x number of times to the playlist. (songs rated 5 will appear a total of 5 times in the playlist) This should help weigh the songs with shuffle on.
billyvnilly is offline   Reply With Quote
Old 1st March 2006, 03:57   #342
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
Quote:
Originally posted by billyvnilly
@marquis... hey I've noticed youve been doing some scripts and i wonder if you take requests. Take the ratings from the songs in playlist, and add song x number of times to the playlist. (songs rated 5 will appear a total of 5 times in the playlist) This should help weigh the songs with shuffle on.
PHP Code:
for each track in playlist
    
if track.rating<>255 then
    
for 1 to track.rating-1
        Tracks2Add
=Tracks2Add track.filename &vbcrlf
    next
    end 
if
next

'msgbox tracks2add

for each FileName in split(Tracks2Add,vbcrlf)
    if len(filename) > 0 then
    LoadItem(filename).enqueue
    end if
next 
MarquisEXB is offline   Reply With Quote
Old 1st March 2006, 04:05   #343
MarquisEXB
Junior Member
 
Join Date: May 2005
Posts: 23
Quote:
Originally posted by billyvnilly
@heinz
you can try downloading the latest version of AW. save the .dll file in dir\winamp\plugins. it should replace existing copy of gen_activewinamp.dll
This is the .dll I've been using. I can't use ShaneH's reverse selection or randomize selection. It appears the track.position is broken. It returns '1236609' each time.

For example, highlight a few items in your playlist (not more than 5, unless you like hitting OK a lot), and run this script.

PHP Code:
for each track in x
 msgbox track
.position
next
quit 
MarquisEXB is offline   Reply With Quote
Old 1st March 2006, 04:27   #344
billyvnilly
Forum King, M.D.
 
billyvnilly's Avatar
 
Join Date: Mar 2004
Location: Detroit burbs
Posts: 3,379
Send a message via ICQ to billyvnilly Send a message via AIM to billyvnilly
yeah, cool thanks a bunch. works as desired in 5.13

Ive confirmed activeWA doesnt work as you described as well in 5.2, and im positive ShaneH already knows its broke
billyvnilly is offline   Reply With Quote
Old 1st March 2006, 09:28   #345
heinz57g
Junior Member
 
Join Date: Feb 2006
Posts: 31
well, tks to all that chimed in, consensus seems to be even latest versions (which i have) dont work, right? at least i dont have to stay up all night scratching my head ...

there might be workarounds, but i am not firm enough to use them (yet). so i will wait for an update.

greetings - heinz -
heinz57g is offline   Reply With Quote
Old 1st March 2006, 10:36   #346
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
Yes, playlist.getselection() is probably broken in 5.2. Even if it isn't there is a better method in Winamp 5.2 which Ive added support for. The CVS has been updated.

Ticket:
https://sourceforge.net/tracker/inde...65&atid=723332
shaneh is offline   Reply With Quote
Old 1st March 2006, 15:45   #347
heinz57g
Junior Member
 
Join Date: Feb 2006
Posts: 31
shaneh, pls bear with people who are not quite as 'fit' as you: what am i supposed to do now? download a new version (from where?) and install it over the old one?

greetings - heinz -
heinz57g is offline   Reply With Quote
Old 1st March 2006, 16:45   #348
Lucky Luke
Junior Member
 
Join Date: Feb 2005
Posts: 5
Hi, very nice plugin, but I have a problem when I try to create a instance of the playlist class in Visual Basic .NET 2005 express edition.

I've this piece of code:

code:

Dim winamp As New ActiveWinamp.Application
Dim playlist As New ActiveWinamp.Playlist ' I get the error on this line



And this is the error:
Retrieving the COM class factory for component with CLSID {5108E2F5-A7E8-4284-9555-9FA8C3994B9C} failed due to the following error: 80040154.

But when I use this:
code:

Dim winamp As New ActiveWinamp.Application

Private Sub LoadPlaylist()
Dim i As Integer
Dim total As Integer = winamp.Playlist.Count
Dim pct As Integer
lstPlaylist.Items.Clear()
For i = 0 To total - 1
lstPlaylist.Items.Add(winamp.Playlist.Item(i).ATFString("[%artist% - ]$if2(%title%,$filepart(%filename%))")) ' on this line I get the error

pct = ((i + 1) / total) * 100
Progressbar.Value = pct
Next

StatusText.Text = "Playlist Refreshed"
Progressbar.Value = 0
End Sub



I get this error:
Object reference not set to an instance of an object.

So i tried this:
code:

Dim winamp As New ActiveWinamp.Application

Private Sub LoadPlaylist()
Dim i As Integer
Dim total As Integer = winamp.Playlist.Count
Dim pct As Integer
lstPlaylist.Items.Clear()
For i = 0 To total - 1
lstPlaylist.Items.Add(New winamp.Playlist.Item(i).ATFString("[%artist% - ]$if2(%title%,$filepart(%filename%))")) ' on this line I get the error

pct = ((i + 1) / total) * 100
Progressbar.Value = pct
Next

StatusText.Text = "Playlist Refreshed"
Progressbar.Value = 0
End Sub



But then I get the error:
Type 'winamp.Playlist.Item' is not defined.

Does anybody know how to fix this?
Lucky Luke is offline   Reply With Quote
Old 1st March 2006, 20:57   #349
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
@heinz57g:
Use the 'latest cvs version download' link on:

http://www.myplugins.info/activewina...p/activewinamp

and just copy it over your old version in your winamp plugins directoy. Note it may break a couple scripts, in particular ones that use the media library queries, as this has changed a little in this version. Generally all it should require is adding a '?' to the start of the query in most cases.

I will make a new interim release of ActiveWinamp pretty soon, seeing as it is broken for 5.2. I wanted to add a bunch more stuff before the next release but I think I will just push it out as a beta seeing as the one on the plugin page wouldnt work for a lot of people.
shaneh is offline   Reply With Quote
Old 2nd March 2006, 10:50   #350
heinz57g
Junior Member
 
Join Date: Feb 2006
Posts: 31
shaney, tks alot. this worked as far as SORT/RAND goes, my main worries. and once i get into those scripts a bit deeper (AFTER your real 5.2 update), i am sure, you'll hear from me. meantime many tks for a great job well done.

greetings - heinz -
heinz57g is offline   Reply With Quote
Old 9th March 2006, 20:54   #351
gerd.gabriel
Junior Member
 
Join Date: Feb 2005
Posts: 5
Informations disappear after updating Media Library with "MediaLibrary.Insert"

Hi scripters,

I'm using a slightly modified version of the script to call Mp3Tag.

All functions well but informations YEAR and BITRATE disappear and PLAYCOUNT is set to the maximum possible unsigned integer value 4294967295 :-) :-(

Gerd

Script follows:

On Error Resume Next

Const ForReading = 1, ForWriting = 2

Dim fso, WshShell, TmpPlaylist, SendTo_Items
Dim TmpPlaylistPath, Mp3TagPath


Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")

'===== Get path where Mp3Tag is installed

Mp3TagPath = RegistryRead( _
"HKCU\Software\Moebius\Install\Mp3tag", "InstDir") & _
"\Mp3tag.exe"

'===== Get filename of temporary playlist

TmpPlaylistPath = GetEnvString("%TEMP%") & _
"\temp_mp3tag_playlist.m3u"

'===== Create tmp. playlist

Set TmpPlaylist = fso.OpenTextFile(TmpPlaylistPath, _
ForWriting, True)

'===== Get selected "Send To" items (either from
'===== MediaLibrary or from playlist)

SendTo_Items = GetSendToItems

'===== Write selection to tmp. playlist

TmpPlaylist.WriteLine ("#EXTM3U")

For Each track In SendTo_Items
TmpPlaylist.WriteLine (track.Filename)
Next

TmpPlaylist.Close

'===== Run Mp3tag and wait until it is finished

WshShell.Run """" & Mp3TagPath & """ ""/m3u:" & _
TmpPlaylistPath & """", 1, True

'===== Update entries in Media Library --> Errors in ML

For Each track In SendTo_Items
set theItem = LoadItem(track.filename)
MediaLibrary.Delete(theItem)
MediaLibrary.Insert(theItem)
next

'=== Have also tried MediaLibrary.RefreshMeta here.
'=== No difference.

Quit
gerd.gabriel is offline   Reply With Quote
Old 10th March 2006, 19:07   #352
gerd.gabriel
Junior Member
 
Join Date: Feb 2005
Posts: 5
Aaaahhhh...

must use MediaLibrary.ADD (instead of INSERT).
gerd.gabriel is offline   Reply With Quote
Old 10th March 2006, 23:55   #353
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
There isn't a MediaLibrary.Add function though??

Unfortuantly Winamp provides no means to just send a filename to the ML and have it read the info itself, you have to actually supply it. Which is what MediaLibrary::Insert attempts to do, but has some bugs.

I can see why playcount might be munged if there is no playcount for an item and you try to insert it. Although bitrate shouldnt have the problem and should just not be set - I will look at fixing it sometime.

When you run mp3tag, does it change the filenames?

For Each track In SendTo_Items
set theItem = LoadItem(track.filename)

If the filename changed the above wont work. Otherwise, it should be ok.

Last edited by shaneh; 11th March 2006 at 00:12.
shaneh is offline   Reply With Quote
Old 11th March 2006, 15:13   #354
gerd.gabriel
Junior Member
 
Join Date: Feb 2005
Posts: 5
Shaneh,

you are right... the "MediaLibrary.Add" is completely ignored by the interpreter (probably because of "ON ERROR RESUME NEXT" ?).

I now simply change the properties of theItem -- that's enough!

I havent't tried yet to INSERT a completely new entry (in case of changing filenames inside Mp3Tag) but will test it soon.

Regards and thanks for this wonderful tool
Gerd
gerd.gabriel is offline   Reply With Quote
Old 22nd March 2006, 15:53   #355
CaboWaboAddict
Forum Sot
(Major Dude)
 
CaboWaboAddict's Avatar
 
Join Date: Mar 2004
Location: Marietta, Ga. U.S.A.
Posts: 3,915
Re: Activewinamp questions

Quote:
Originally posted by clatten
I am using Winamp 5.20 on a Win XP Home SP2 system.

The computer is new and then I installed winamp and activewinámp it won't find my aw scripts. Actually it won't fins any script at all.

Anyone else that encountered teh same problem?
Quote:
Originally posted by shaneh
I will make a new interim release of ActiveWinamp pretty soon, seeing as it is broken for 5.2. I wanted to add a bunch more stuff before the next release but I think I will just push it out as a beta seeing as the one on the plugin page wouldnt work for a lot of people.

Idiot's Advocate
My site (under construction)
CaboWaboAddict is offline   Reply With Quote
Old 25th March 2006, 21:54   #356
Seamore
Junior Member
 
Join Date: Mar 2006
Posts: 1
Can I use ActiveWinamp from Delphi?
Seamore is offline   Reply With Quote
Old 26th March 2006, 15:23   #357
breakhead
Junior Member
 
Join Date: Mar 2006
Posts: 3
nice plugin

just found this plugin, very nice!

whipped this up last night, will find and display nfos for all unique folders in selection, please excuse any bugs or bad code, very rusty on vb!

code:

x = playlist.getselection

for i = 1 to ubound(x)
n = ""
d = split(x(i).filename,"\")
if ubound(d) > 0 Then
for s = 0 to ubound(d)-1
n = n + d(s) + "\"
next
end if
if n <> lastn then
set ofs = createobject("scripting.filesystemobject")
nf = locatefilebyext(n,"nfo")
if len(nf) > 0 then
txt = ofs.opentextfile(nf).readall
set ie = startIE()
ie.document.title = "NFO: " & nf
ie.document.body.style.backgroundColor = "black"
set pre = ie.document.createelement("PRE")
pre.innerText = txt
pre.style.color = "DADADA"
pre.style.fontSize = "10px"
ie.document.body.appendChild(pre)
ie.visible = true
ie.document.body.focus()
end if
lastn = n
end if
set ie = nothing
set nf = nothing
set ofs = nothing
next

function locateFileByExt(sFolder,sExt)
set d = ofs.GetFolder(sFolder)
for each f in d.files
name = f.name
aext = split(name,".")
if ubound(aext) <> -1 then ext = aext(ubound(aext))
if ucase(ext) = ucase(sExt) then locateFileByExt = f.path
next
set d = nothing
end function

function startIE()
set ie = createobject("internetexplorer.application")
ie.addressbar = false
ie.menubar = false
ie.resizable = false
ie.statusbar = false
ie.toolbar = false
ie.width = 535
ie.height = 550
ie.navigate("about:blank")
set startIE = ie
end function



oh and this quick one appends a cue file for the currently playing file at the end of the playlist (if u have a cue handler like ape cue it can then be expanded by playing it)

code:

x = playlist.getselection

for i = 1 to ubound(x)
f = ""
a = split(x(i).filename,".")
if ubound(a) <> -1 then
a(ubound(a)) = "cue"
f = join(a,".")
set ofs = createobject("scripting.filesystemobject")
if ofs.FileExists(f) then loaditem(cstr(f)).enqueue
end if
next



is there a workaround for playlist.position because id like to be able to insert items immediately after the currently selection?

thanks again!


edit: sorry forgot to ask. i know u can create a fake playlist entry with "X:blah", are there any other playlist commands like this?
breakhead is offline   Reply With Quote
Old 26th March 2006, 16:58   #358
Thunder Pussy
Feed me a stray dog
(Major Dude)
 
Join Date: Oct 2004
Posts: 1,122
Re: nice plugin

Quote:
Originally posted by breakhead
is there a workaround for playlist.position because id like to be able to insert items immediately after the currently selection?
I think I can answer one of your questions. For insert after current instead of enqueue, substitute
.insert(x(1).position) for .enqueue
Thunder Pussy is offline   Reply With Quote
Old 26th March 2006, 17:13   #359
breakhead
Junior Member
 
Join Date: Mar 2006
Posts: 3
yeah i tried that but position as a result of getselection() always returns 1236129 - is it just my system or is there a bug in getselection()?
breakhead is offline   Reply With Quote
Old 26th March 2006, 18:13   #360
breakhead
Junior Member
 
Join Date: Mar 2006
Posts: 3
whilst im in the mood, another quick one. displays all images in folders from selected items. little bug that if u have an item from folder1, then an item from folder2, then an item from folder1 again it will display folder1's images twice (as the view nfo script does) - have to shoot now so if u want to use it fix it yourself!

Quote:
x = playlist.getselection

for i = 1 to ubound(x)
n = ""
d = split(x(i).filename,"\")
if ubound(d) > -1 Then
for s = 0 to ubound(d)-1
n = n + d(s) + "\"
next
end if
if n <> lastn then
set ofs = createobject("scripting.filesystemobject")
nf = locatefilesbyext(n,"jpg")
if ubound(nf) > 0 then
set ie = startIE(360,550)
ie.document.title = "IMAGES: " & n
ie.document.body.style.backgroundColor = "white"
ie.document.body.style.margin = 0
ie.document.body.style.textAlign = "center"
for each file in nf
if len(file) <> 0 then
set img = ie.document.createelement("IMG")
img.src = file
img.height = img.height / (img.width / 320)
img.width = 320
img.style.margin = 3
img.style.border = "1px dashed silver"
ie.document.body.appendChild(img)
end if
next
ie.visible = true
ie.document.body.focus()
end if
lastn = n
end if
set ie = nothing
set ofs = nothing
next

function locateFilesByExt(sFolder,sExt)
dim files
set d = ofs.GetFolder(sFolder)
for each f in d.files
name = f.name
aext = split(name,".")
if ubound(aext) <> -1 then ext = aext(ubound(aext))
if ucase(ext) = ucase(sExt) then files = files & f.path & vbCrLf
next
if len(files) <> 0 then
locateFilesByExt = split(left(files,len(files)-1),vbcrlf)
else
locateFilesByExt = array()
end if
set d = nothing
end function

function startIE(width,height)
set ie = createobject("internetexplorer.application")
ie.addressbar = false
ie.menubar = false
ie.resizable = false
ie.statusbar = false
ie.toolbar = false
ie.width = width
ie.height = height
ie.navigate("about:blank")
set startIE = ie
end function
features you might like to add:

filename display
open full size image
set image as folder.jpg
search on web for new art

some thoughts on activewinamp:

do these scripts carry on running to recieve events? how can i exit a script?

could do some real nice stuff with xmlhttprequest
breakhead is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump