473,414 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

String Parsing question. (winamp.pls)

I want to pars a playlist file for three different varibles, so I can save
them as mp3 files. I am using:

strTEMPURL = GetUrlSource(Text1.Text)

to put the entire .pls file into a strTEMPURL varible.
I want to grab .pls files from shoutcast and break them into varibles.

----------------Begin winamp.pls file-------------------
[playlist]
numberofentries=1
File1=http://152.2.63.108:8000
Title1=(#1 - 25/58) WUNC FM 91.5 Chapel Hill, NC
Length1=-1
Version=2
----------------Begin winamp.pls file-------------------
Private function ParsePLSPlayList(strTEMPURL as string, streamIP as string,
streamPort as string, streamTitle as string)
strTEMPURL = GetUrlSource(Text1.Text)

'Text1.Text has the url for the http://www.somesite.com/winamp.pls
'this is what I want as the end result
'Can someone point me in the right direction to parse the above file to
get the following?

streamIP = 152.2.63.108
streamPort = 8000
streamTitle = (#1 - 25/58) WUNC FM 91.5 Chapel Hill, NC

End Function

Thanks in advance for any assistance.



Jul 17 '05 #1
2 3886

"Michael Hogan" <mi**********@tampabay.rr.com> wrote in message
news:Sf********************@twister.tampabay.rr.co m...
I want to pars a playlist file for three different varibles, so I can save them as mp3 files. I am using:

strTEMPURL = GetUrlSource(Text1.Text)

to put the entire .pls file into a strTEMPURL varible.
I want to grab .pls files from shoutcast and break them into varibles.

----------------Begin winamp.pls file-------------------
[playlist]
numberofentries=1
File1=http://152.2.63.108:8000
Title1=(#1 - 25/58) WUNC FM 91.5 Chapel Hill, NC
Length1=-1
Version=2
----------------Begin winamp.pls file-------------------
Private function ParsePLSPlayList(strTEMPURL as string, streamIP as string, streamPort as string, streamTitle as string)
strTEMPURL = GetUrlSource(Text1.Text)

'Text1.Text has the url for the http://www.somesite.com/winamp.pls
'this is what I want as the end result
'Can someone point me in the right direction to parse the above file to get the following?

streamIP = 152.2.63.108
streamPort = 8000
streamTitle = (#1 - 25/58) WUNC FM 91.5 Chapel Hill, NC

End Function

Thanks in advance for any assistance.


I don't know beans about winamp, etc. but it looks like typical string
parsing to me.

First, you can split strTEMPURL into an array of lines, using something
like:
dim strLines() as String
....
strLines = Split(strTEMPURL, vbCrLf)

You might have to check whether the text has vbLf instead of vbCrLf as
the line break.

Then you can loop through the lines, using something like:
For n = 0 to UBound(strLines)
...

You could then loop until you find a line that reads "[playlist]", and
if you plan to read multiple titles, find one that starts with
"numberofentries".

You can parse each of the lines that contain a parameter/value pair with
something like:
nPos = InStr(1, strLines(n), "=")
if nPos > 0 then
strParm = Left(strLines(n), nPos - 1)
strValue = Right(strLines(n), Len(strLines(n)) - nPos)
end if

Hope that gets you started.
Steve

Jul 17 '05 #2
Steve,

That will definatly get me started.
Thanks.

Michael

"Steve Gerrard" <no*************@comcast.net> wrote in message
news:-o********************@comcast.com...

"Michael Hogan" <mi**********@tampabay.rr.com> wrote in message
news:Sf********************@twister.tampabay.rr.co m...
I want to pars a playlist file for three different varibles, so I can

save
them as mp3 files. I am using:

strTEMPURL = GetUrlSource(Text1.Text)

to put the entire .pls file into a strTEMPURL varible.
I want to grab .pls files from shoutcast and break them into varibles.

----------------Begin winamp.pls file-------------------
[playlist]
numberofentries=1
File1=http://152.2.63.108:8000
Title1=(#1 - 25/58) WUNC FM 91.5 Chapel Hill, NC
Length1=-1
Version=2
----------------Begin winamp.pls file-------------------
Private function ParsePLSPlayList(strTEMPURL as string, streamIP as

string,
streamPort as string, streamTitle as string)
strTEMPURL = GetUrlSource(Text1.Text)

'Text1.Text has the url for the http://www.somesite.com/winamp.pls
'this is what I want as the end result
'Can someone point me in the right direction to parse the above

file to
get the following?

streamIP = 152.2.63.108
streamPort = 8000
streamTitle = (#1 - 25/58) WUNC FM 91.5 Chapel Hill, NC

End Function

Thanks in advance for any assistance.


I don't know beans about winamp, etc. but it looks like typical string
parsing to me.

First, you can split strTEMPURL into an array of lines, using something
like:
dim strLines() as String
....
strLines = Split(strTEMPURL, vbCrLf)

You might have to check whether the text has vbLf instead of vbCrLf as
the line break.

Then you can loop through the lines, using something like:
For n = 0 to UBound(strLines)
...

You could then loop until you find a line that reads "[playlist]", and
if you plan to read multiple titles, find one that starts with
"numberofentries".

You can parse each of the lines that contain a parameter/value pair with
something like:
nPos = InStr(1, strLines(n), "=")
if nPos > 0 then
strParm = Left(strLines(n), nPos - 1)
strValue = Right(strLines(n), Len(strLines(n)) - nPos)
end if

Hope that gets you started.
Steve


Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Emil | last post by:
This is my problem: I'm writing a script that... 1. creates a customized pls/m3u playlist 2. sends the pls or a m3u playlist to the webbrowser. The browser should open Winamp/Windows Media...
1
by: BadOmen | last post by:
I am using this to send am command to WinAmp and it works, The Open File(s) is opening but my program halts until I presses the Open or Cancel button. I think my program is waiting for a returned...
0
by: Jorr.it | last post by:
Who can give me an example how to write a general plugin for Winamp 5 in Visual Basic 6? Only things I want to do is Play, Stop, Pause, Load Playlist and Randomize Playlist. For Winamp 3 there were...
3
by: The Collector | last post by:
Hi, I've been looking for almost two full days now to get full control of WinAMP using python. Simple play/stop functions are no problem. It's the WM_COPYDATA that's used by IPC_PLAYFILE (=add a...
0
by: Andy | last post by:
I am trying to talk to Winamp2 from Perl on Win32 system. According to winamp docs I need to send a windows message with the following structure: (To add a file to the playlist) COPYDATASTRUCT...
1
by: Lasse Edsvik | last post by:
Hello I was wondering if you guys could help me. My goal is to make a program that just show's what my winamp on same comp with a button-click or something. Now I was wondering if you guys...
5
by: XML newbie: Urgent pls help! | last post by:
function to convert string to 1 dimensional array of long in VB.Net
4
by: Terry Olsen | last post by:
Here's another odd request. I want to embed the winamp window in my app. I have a panel that I want Winamp to be locked to. Using a couple of API calls, I can set the panel as the parent of the...
7
by: cephal0n | last post by:
Hi there! I've been racking my brains out for 4 days and still not getting why is msaccess stubborn about string parsing, first I have a table named tblItems, this table has columns: ProductItem,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.