Playlists?

Everything else that doesn't fall into one of the other PB categories.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Playlists?

Post 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
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Playlists?

Post 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.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Playlists?

Post 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
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Re: Playlists?

Post 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.
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Playlists?

Post 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):

Code: Select all

\Music\Song1.mp3
\Music\Song2.mp3
So the playlist file is using the root drive of where it's located (D:) and going down from there (\Music\).
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: Playlists?

Post 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 :lol:

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
Post Reply