Page 1 of 1
Playlists?
Posted: Tue Mar 02, 2021 9:45 am
by collectordave
I am rewriting my media player but have no idea what a 'standard' playlist is or what file extension or the contents are.
I have several playlists in my media player, in my format, but I am thinking if I can download an existing playlist and import into the player it could make things easier when defining them.
Tried looking on the internet but get no joy, it seems most are specific to individual players or I cannot download the playlist as a file.
Can anyone enlighten me as to what to look for?
CD
Re: Playlists?
Posted: Tue Mar 02, 2021 9:50 am
by BarryG
collectordave wrote:Can anyone enlighten me as to what to look for?
M3U (file extension) is the most popular playlist type, used by Winamp, iTunes, VLC, and most other media players.
The file format is plain text (yay!) and described here ->
https://en.wikipedia.org/wiki/M3U
In its most basic form, it's just a list of filenames with one file per line. Yep, that simple, and it's what my M3U playlist on my PC looks like.
Re: Playlists?
Posted: Tue Mar 02, 2021 10:25 am
by collectordave
Thanks BarryG
Just looked at the example and it seems the M3U file is placed in the folder where the music is and the list is just a list of relative paths to the actual song files.
There seems to be an extended version as well which seems to have length of track artist and song title as a separate entry.
I will stick to the simple one first as that matches what I store for my playlist.
regards
CD
Re: Playlists?
Posted: Tue Mar 02, 2021 12:06 pm
by Joris
Tip : take the "relative format" as when you move the music to another place... a lot of simple work to do all over.
See Example 3 on the wiki page.
Re: Playlists?
Posted: Tue Mar 02, 2021 2:05 pm
by BarryG
collectordave wrote:it seems the M3U file is placed in the folder where the music is
Not always - I use Winamp but my music folder is elsewhere.
My folder structure:
Code: Select all
D:\Apps\Winamp\Winamp.exe
D:\Apps\Winamp\Playlist.m3u
D:\Music\Song1.mp3
D:\Music\Song2.mp3
My M3U playlist file (in Winamp's folder as shown above):
So the playlist file is using the root drive of where it's located (D:) and going down from there (\Music\).
Re: Playlists?
Posted: Thu Mar 04, 2021 3:47 am
by kenmo
It sounds like you're interested in reading playlists more than creating them.
For what it's worth, I knew I had a M3U writer IncludeFile. I checked it out today and it's just 3 procedures
Code: Select all
Procedure.i CreateM3U(File.i, FileName.s)
Protected Result.i = CreateFile(File, FileName)
If (Result)
If (File = #PB_Any)
File = Result
EndIf
WriteStringN(File, "#EXTM3U")
EndIf
ProcedureReturn (Result)
EndProcedure
Procedure AddM3UEntry(File.i, URL.s, Title.s = "", Seconds.i = 0)
WriteStringN(File, "#EXTINFO:" + Str(Seconds) + "," + Title)
WriteStringN(File, URL)
EndProcedure
Procedure.i CloseM3U(File.i)
CloseFile(File)
ProcedureReturn (#Null)
EndProcedure