Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Macros, Scripts, and Formulas Repository
 PowerHome Messageboard : PowerHome Macros, Scripts, and Formulas Repository
Subject Topic: Winamp Info & Album Art Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: December 20 2006 at 20:02 | IP Logged Quote TonyNo

This is a macro for getting Winamp info and album art.

Create four Global Variables that will be updated when the macro runs: WINAMP SONG, WINAMP ARTIST, WINAMP ALBUM, and WINAMP NEXT.

My music is organized by Artist/Album folders and my art files follow the Windows Media Player standard of either folder.jpg (large image) or albumartsmall.jpg (smaller image). The macro will find the path to the current song, copy both art files to the PH web folder, and find the name of the next song.

I was not able to use a regex alternation pattern for wma/mp3 files ("wma|mp3"), so I used what was there ("[wm][mp][a3]").

Code:
insert into macroheader values ('WINAMP GET INFO','GET WINAMP INFO',0,0,1);
insert into macrodetail values ('WINAMP GET INFO',1,38,'',0,'if( ph_ismacrowaiting( "WINAMP GET INFO")=0, 0, ph_killmacrowait("WINAMP GET INFO"))',0,'');
insert into macrodetail values ('WINAMP GET INFO',2,15,'[LOCAL1]',NULL,'ph_winampinfo("listpos", 0, 0)',0,'');
insert into macrodetail values ('WINAMP GET INFO',3,37,'',NULL,'Don''t get info if same',0,'');
insert into macrodetail values ('WINAMP GET INFO',4,27,'',NULL,'if( ph_winampinfo( "listtitle", [LOCAL1], 0) = "{WINAMP SONG}", "Out", "X")',0,'');
insert into macrodetail values ('WINAMP GET INFO',5,10,'WINAMP SONG',NULL,'ph_winampinfo( "listtitle",[LOCAL1], 0)',0,'');
insert into macrodetail values ('WINAMP GET INFO',6,10,'WINAMP ARTIST',NULL,'ph_winampinfo( "listartist", [LOCAL1], 0)',0,'');
insert into macrodetail values ('WINAMP GET INFO',7,10,'WINAMP ALBUM',NULL,'ph_winampinfo( "listalbum", [LOCAL1], 0)',0,'');
insert into macrodetail values ('WINAMP GET INFO',8,10,'WINAMP NEXT',NULL,'ph_winampinfo( "listtitlename", [LOCAL1] + 1, 0)',0,'');
insert into macrodetail values ('WINAMP GET INFO',9,37,'',NULL,'Get Song Path',0,'');
insert into macrodetail values ('WINAMP GET INFO',10,15,'[LOCAL2]',NULL,'ph_regexdiff( "^","[^\\]*\.[wm][mp][a3]$", ph_winampinfo( "listfilename", [LOCAL1], 0) ,1,0)',0,'');
insert into macrodetail values ('WINAMP GET INFO',11,36,'',NULL,'"Path: [LOCAL2]"',0,'');
insert into macrodetail values ('WINAMP GET INFO',12,37,'',NULL,'Clear potential Read Only attribs',0,'');
insert into macrodetail values ('WINAMP GET INFO',13,15,'[LOCAL3]',NULL,'ph_setfileattrib( ph_getphwebdir() + "\folder.jpg" , 0 ) + ph_setfileattrib( ph_getphwebdir() + "\albumartsmall.jpg", 0 )',0,'');
insert into macrodetail values ('WINAMP GET INFO',14,36,'',NULL,'"Attrib Result: " + [LOCAL3]',0,'');
insert into macrodetail values ('WINAMP GET INFO',15,37,'',NULL,'Copy art file to PH web folder',0,'');
insert into macrodetail values ('WINAMP GET INFO',16,15,'[LOCAL3]',NULL,'ph_copyfile( "[LOCAL2]" + "folder.jpg", ph_getphwebdir() + "\folder.jpg", 1) + ph_copyfile( "[LOCAL2]" + "albumartsmall.jpg", ph_getphwebdir() + "\albumartsmall.jpg", 1)',0,'');
insert into macrodetail values ('WINAMP GET INFO',17,36,'',NULL,'"Copy Result: " + [LOCAL3]',0,'');
insert into macrodetail values ('WINAMP GET INFO',18,37,'',NULL,'If error, copy backup art file',0,'');
insert into macrodetail values ('WINAMP GET INFO',19,16,'',NULL,'if( [LOCAL3] = 0, 2, 1)',0,'');
insert into macrodetail values ('WINAMP GET INFO',20,15,'[LOCAL3]',NULL,'ph_copyfile( ph_getphwebdir() + "\folder.jpg.bak", ph_getphwebdir() + "\folder.jpg", 1) + ph_copyfile( ph_getphwebdir() + "\albumartsmall.jpg.bak", ph_getphwebdir() + "\albumartsmall.jpg", 1)',0,'');
insert into macrodetail values ('WINAMP GET INFO',21,26,'',NULL,'Out',0,'');
insert into macrodetail values ('WINAMP GET INFO',22,31,'',NULL,'int(number( ph_winampinfo("tracklen",0, 0)) - ( number( ph_winampinfo("trackpos",0, 0)) / 1000) + 1)',0,'');
insert into macrodetail values ('WINAMP GET INFO',23,1,'WINAMP GET INFO',1,'',0,'');
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum