PDA

View Full Version : Winamp playlist OSD menu



MMcM
October 13th, 2002, 03:55 PM
If you'd rather have a trivial UI for navigating the Winamp playlist with your remote, here's one way to do it in Girder using SendMessage and OSDMenu (but not DVDSpy :cry: ).

Write a MultiGroup to build and display the OSD menu.

Use SendMessage to send Winamp a WM_WA_IPC message with IPC_WRITEPLAYLIST.
Send WM_WA_IPC with IPC_GETLISTPOS and put the result in a variable.
Convert the winamp.m3u file into a .ini file for OSDMenu. This can be done inside Girder with the new GVMS, which ought to have file I/O and looping. But for now, run the VBScript below to do it.
Start OSDMenu with the resultant .ini file.




' Convert Winamp playlist (M3U) file to OSDMenu definition (INI) file.
Option Explicit

' Command line arguments: "c:\Program Files\Winamp\winamp.m3u" "c:\Program Files\girder32\plugins\osdmenu\winampmenu.ini" [curpos]
Dim args, fso, istr, ostr, pos
Const ForReading = 1, ForWriting = 2
Set args = Wscript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
Set istr = fso.OpenTextFile(args(0), ForReading)
Set ostr = fso.OpenTextFile(args(1), ForWriting, True)

istr.ReadLine 'Skip header line

' Header info
ostr.WriteLine "[visual]"
ostr.WriteLine "wnd_size=fit2text"
ostr.WriteLine "startpos=" & args(2)
ostr.WriteLine ""
ostr.WriteLine "[main]"

' One item line per playlist entry
pos = 0
Do
Dim line
line = Null
On Error Resume Next
line = istr.ReadLine()
istr.ReadLine 'Skip filename
On Error Goto 0
If IsNull(line) Then Exit Do
If Left(line, 8) = "#EXTINF:" Then
line = Mid(line, InStr(line, ",") + 1)
End If
ostr.WriteLine line & "=#18#waplay#" & pos
pos = pos + 1
Loop
istr.Close
ostr.Close


Set up a second MultiGroup to respond to OSDMenu's event, waplay.

Send WM_WA_IPC IPC_SETPLAYLISTPOS with the payload to change the playlist position.
Send WM_COMMAND WINAMP_BUTTON2 to push the Play button.

MMcM
October 13th, 2002, 03:55 PM
It is probably easier to just show it. Look at the .GML file inside the .ZIP file I attached. WM_WA_IPC etc. are constants. The numeric values are in the SendMessage commands in the example file.


Extract the contents of the .ZIP file under c:\Program Files\Girder32 (where Girder was installed).
Launch Winamp if it is not already running.
Launch Girder and load WinampMenu.GML.
Adjust filenames for Winamp playlist and VBS script as necessary.
Select the "Menu" command.
Commands>Test Command (F5) to run it manually.
List of titles should appear.
Use arrow keys to navigate.
Use Enter key to select.
Selected title should play immediately.


As I said, you can look at the settings for each command to see how it's doing it precisely.

After you have it basically checked out, you will want to merge the commands into your normal Girder file. Probably you will want to launch the menu via some button on your remote.

MMcM
October 13th, 2002, 03:55 PM
May I suggest that you first get the Winamp specific parts to work using the keyboard and then move on to the remote, if you have not already done so. I'll assume that you have something you like using the arrow keys on the keyboard.

I'll further assume that you have your remote working with Girder. If not, get it to do something trivial, like Simple OSD of "Hello, SD!" first.

Then the remaining tricky part is how to get the arrow keys on the remote to navigate OSDMenu. The OSDMenu.GML sample, which is in the same .ZIP file as the OSDMenu plug-in, shows how to do this. The idea is that when the menu comes up it runs a command that enables a group of commands that simulate the arrow keyboard keys typing at the special OSD menu window. And when it comes down a similar command disables the group. That way the remote's arrow keys are available for other useful stuff when the menu isn't displayed.

So,

Paste together the two groups in OSDMenu.GML and the two commands in WinampMenu.GML. (Which is pretty straightforward: open the file, select the root, Edit Copy, open the other file, Edit Paste. Drag children up a level if you don't like nested groups.)
Set Command on Menu start and Command on Menu end for Menu (under Winamp OSD Menu) to be like Start OSDMenu (under OSDMenu).
Learn an IR command for each of Up, Down, and Enter (under Menu Keys). These will navigate.
Learn an IR command for Menu (under Winamp OSD Menu). This will launch it.
Try it.

mattwire
October 13th, 2002, 03:55 PM
Wow! That sounds pretty cool.

MpegErnie
October 13th, 2002, 03:55 PM
great script!

but I've got a small problem with big playlists. The OSD Menu doesn't seem to like very long ini files. Is this a limitation of the plugin?

I check on the precise number of lines and characters:
The OSDMenu won't display more than 555 lines (which is 576 lines (24333 characters) in the INI file)

this is a bit anoying. anybody an idea?

SouthyPar
October 13th, 2002, 03:55 PM
SpeedRacer:

I believe your problem should go away if you add the following the line of text to the m3u2osdmenu.vbs file, right below the line that reads "ostr.WriteLine "[visual]""



ostr.WriteLine "itemsperscreen=X"
(where X is the amount of lines you can see on the screen at one time).

This way, once you go past the borders, the list will scroll down and your selection will remain visible.

MMcM:

I found it necessary to change:


ostr.WriteLine "startpos=" & args(2)

to:


ostr.WriteLine "startpos=" & (args(2) + 1)

so as to compensate for the 0-based-indexing.

Thanks a lot! I used to do this proccess via batch scripting (I didn't know you can use Visual Basic script outside of Microsoft Office and Internet scripts :oops: )

SouthyPar
October 13th, 2002, 03:55 PM
Wow, this solution just became even more attractive to me now with the advent of OSDMenu 1.6, which has support for Menu Titles. If you usually use the classic "Artist - Title" format display, and you usually have one album in your playlist at a time, you can now cut out the Artist Name from each Menu Item, and instead put the Artist Name in the Menu Title, thus saving space and making for an even nicer-looking straight-forward interface for selecting your song.

All you have to do is edit the .vbs a little bit. If anyone wants me to post a more thorough explanation of how to do this, let me know.

Speed Demon
October 13th, 2002, 03:55 PM
Can you spell that out even further for this newbie. I don't get how to use SendMessage to send Winamp a WM_WA_IPC message with IPC_WRITEPLAYLIST, etc. It sounds pretty neat to have Winamp's playlist as an OSD, but this coding stuff is hurting my head. Is there any step by step guide you could whip up? Much appreciated.

SD

Speed Demon
October 13th, 2002, 03:55 PM
I am having trouble using the arrow keys to get to other parts of my playlist. The list is stationary at whatever spot it is and the cursor moves off the screen in either direction. Also, I am not sure where to put the events based on the gml file you left there, like how do I get arrow keys on my remote to work with the OSD playlist? Thanks.

SD

Speed Demon
October 13th, 2002, 03:55 PM
I appreciate the prompt responses but I guess my main concern was the fact that I could only see one part of my list and I guess that concern still remains unresolved. If you can help further, I would appreciate it. Thanks again.

The Speediest Demon of them ALL

Speed Demon
October 13th, 2002, 03:55 PM
For whatever reason after making the changes to the vbs file, now all I see are two of the many songs on my playlist. Before, I saw many more, but still not all of them. Oh, why am I such a newbie?!

josjojo
October 13th, 2002, 03:55 PM
I converted the VBScript sourcecode to Delphi. Here's the result:


(************************************************* *********
Convert Winamp playlist (M3U) file to OSDMenu definition (INI) file.

Command line arguments:
"c:\Program Files\Winamp\winamp.m3u" "c:\Program Files\girder32\plugins\osdmenu\winampmenu.ini" [curpos]
************************************************** *********)

program WaPlay2OSDmenu;
{$APPTYPE CONSOLE}
uses
SysUtils;

var
linepos: integer;
istr, ostr: TextFile;
line: String;

begin
try
AssignFile(istr, ParamStr(1));
Reset(istr);
Readln(istr); // Skip header line
AssignFile(ostr, ParamStr(2));
Rewrite(ostr);

// Header info
Writeln(ostr, '[visual]');
Writeln(ostr, 'wnd_size=fit2text');
Writeln(ostr, 'startpos=' + ParamStr(3));
Writeln(ostr, 'itemsperscreen=15');
Writeln(ostr, '');
Writeln(ostr, '[main]');

// One item line per playlist entry
linepos := 0;
line := '';
while not Eof(istr) do
begin
Readln(istr, line);
Readln(istr); // Skip filename
if Copy(line, 0, 8) = '#EXTINF:' then
line := Copy(line, Pos(',', line)+1, Length(line)-1);
Writeln(ostr, line + '=#18#waplay#' + IntToStr(linepos));
Inc(linepos);
end;
finally
CloseFile(istr);
CloseFile(ostr);
end;
end.

Mikhail
May 21st, 2003, 05:08 AM
2 MMcM

Hello!
I didn't understand how can I get variable with track number?

nulleman
May 22nd, 2003, 07:25 AM
Its so fucking gooooood
I love it


First when I read this thread I couldnt fing the zip MMcM was talkning about. Then I remembered that attachments were disabled, but these uploads exists anyway, so here is the link to the zip for those who cant find the zip
http://www.girder.nl/filesbb/files/162_1025460760.zip

Mikhail
May 26th, 2003, 04:07 AM
2 nulleman

Thanks man!

naggiman
May 31st, 2003, 06:21 AM
Well, i have got the OSD menu and everything working fine.

However, what part of winamp3 should i be targetting for the play menu stuff?

Ta

N.[/quote]

wctkdman
July 18th, 2003, 05:29 PM
Hey thanks for the great files, I have one question though. Is it possible to use this same kind of structure but instead have the contents of a directory be read, then execute a chosen file? That would be a great way to select playlists from a directory for Winamp. I guess a vbs script that could be used to scan a directory then output it to a text file, then have OSD menu open the text file and execute the selected file. I would do it myself, but I don't know anything about vbs or programming.

Monkeys Cry
August 9th, 2003, 03:31 AM
the command to scroll the screen: itemsperscreen {} Set this value to enable scrolling. If itemsperscreen is smaller than the number of items in the menu it will create a scrolling menu.

-laureus-
September 10th, 2003, 07:02 AM
hi,

i downloaded the zip-file with the plugin and followed the instructions to get it started.
i also change the paths of the programs.
by testing the command i get an error message:
i'll try to translate it, 'cause i'm german.



Script: D:\Girder 3.2\plugins\osdmenu\m3u2osdmenu.vbs
Line: 17
Sign(?): 1
Error: Index out of valid area (/range)
Code: 800A0009
Source: Runtime error in Mircosoft VBScript



what does that mean?

Luke M.
September 20th, 2003, 10:27 PM
I'm getting the same message as laureus. It seems to be having a problem with the line:

ostr.WriteLine "wnd_size=fit2text"

Although with VB it could mean there was a problem earlier. I don't know enough about what's going on to troubleshoot... Any advice?

d3hon3st
November 18th, 2003, 10:57 AM
PLEASE SEND ME JUSTIFIED SCRIPT OR ALL GROUP (OSD PLAYLIST). THANK YOU. MAIL IS: bush@pobox.sk

d3hon3st
November 22nd, 2003, 02:11 AM
PLEASE SEND ME JUSTIFIED SCRIPT OR ALL GROUP (OSD PLAYLIST). THANK YOU. MAIL IS: bush@pobox.sk

Santa
December 17th, 2003, 01:00 PM
the command to scroll the screen: itemsperscreen {} Set this value to enable scrolling. If itemsperscreen is smaller than the number of items in the menu it will create a scrolling menu.

Thanks for the tip man :)

Before I got the same error as -laureus- :wink:

Great script btw, I'm finally able to use this OSD after winamp 5 were released, now I just need to find a way to make WA5 play the next playlist in The ML :cry:

wctkdman
December 18th, 2003, 03:01 PM
where do I put the itemsperscreen {xx} line in the VBscript? Thanks.

EDIT: nevermind I got it, it goes into the visual area as:

ostr.WriteLine "itemsperscreen=25"

for anyone who is wondering.

Cadish
December 20th, 2003, 06:18 AM
Does this work with winamp5?

Santa
December 25th, 2003, 07:15 AM
Does this work with winamp5?

It works fine with Winamp 5 for me :)

SilencedScream
December 30th, 2003, 08:07 PM
I hated the way the OSD would change sizes depending on the length of the longest title in the playlist while scrolling. So to fix that and set it to fullscreen mode all the time open up the vbs file and change the following line.


ostr.WriteLine "wnd_size=fit2text"

to


ostr.WriteLine "wnd_size=fullscreen"


Voila, now the screen is taken up by the OSD until you make your selection.

thracx
January 4th, 2004, 02:02 PM
Wonderful! Thanks guys, (after a few system-specific changes) it works great!

*gets to work on visual customization*

Mikefield
February 14th, 2004, 07:42 PM
I have make the right file settings, the right OSD Menu pops up, after i press F5 for test,
but after i select a title, the Open file(s) menu is comming.
In winamp 2.80 and in 5.02 the same. Can anyone please help me?

Logging:
02:49:11 Sunday, February 15, 2004 EVENT: Dev: 211 Girder.exe
02:49:18 Sunday, February 15, 2004 EVENT: Dev: 211 Girder.exe
02:49:24 Sunday, February 15, 2004 EVENT: Dev: 128 VirMenuUpdate
02:49:24 Sunday, February 15, 2004 EVENT: Dev: 18 waplay Pld1: 6
Now I close the "Open file(s) Menu:
02:49:41 Sunday, February 15, 2004 EVENT: Dev: 128 VirMenuUpdate
02:49:41 Sunday, February 15, 2004 EVENT: Dev: 128 VirMenuUpdate
02:49:41 Sunday, February 15, 2004 EVENT: Dev: 211 Girder.exe
02:49:41 Sunday, February 15, 2004 EVENT: Dev: 211 winamp.exe
02:49:41 Sunday, February 15, 2004 EVENT: Dev: 211 winamp.exe

mf

thracx
February 15th, 2004, 01:17 AM
I don't really understand your question. Could you try to rephrase?

Mikefield
February 15th, 2004, 02:55 AM
OK, sorry, i hope this will help:
I like to use this OSD Menu. I have imported the gml file from mmcm (postet by nulleman) and set it up to my filepaths.
Now I will test the menu in girder with F5.
The OSD is correct showing, but when i select an entry, the title is not playing,
it comes an system window "Open file(s)" where i can select files.

Is a plugin for winamp missing?

mf

!!!STOP!!! I've found my mistake! The playlist must loaded in winamp.

thracx
February 15th, 2004, 12:18 PM
!!!STOP!!! I've found my mistake! The playlist must loaded in winamp.

I assume this means that you've fixed it - good work!

Apx
March 12th, 2004, 09:00 AM
soz,wrong thread O_o
just delete this post ...