哈飞车友会

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 14022|回复: 7

三种常见的歌曲列表方式:M3U,PLS和ASX

[复制链接]
发表于 2006-12-7 19:19:06 | 显示全部楼层 |阅读模式
找了好久,终于让俺找到了,原文在这里:

PLS第二版: http://www.schworak.com/programming/music/PlayList_PLS.asp

M3U: http://www.schworak.com/programming/music/playlist_m3u.asp

ASX: http://www.schworak.com/programming/music/PlayList_ASX.asp

原文是英文的,大体看了一下,基本内容是这样的:
 楼主| 发表于 2006-12-7 19:19:40 | 显示全部楼层
<H2>M3U (WinAmp) Play List Specification</H2>
<P>Winamp playlists are just a text file containing links to the location of the proper file&#46; You can crate or edit a playlist in any text editor&#46; It could be anything to MP3, WMA, or even another playlist&#46; Just because something is in a playlist, doesn\'t mean Winamp can play it though&#46; Winamp will just skip over unknown file formats&#46; This document will hopefully toy to clarify the differences of the playlist formats available&#46; </P>
<CENTER>
<SCRIPT type=text/java script><!--
google_ad_client = \"pub-3057977486983051\";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = \"728x90_as\";
google_ad_type = \"text_image\";
google_ad_channel =\"\";
google_color_border = \"DDAAAA\";
google_color_bg = \"ECF8FF\";
google_color_link = \"0033FF\";
google_color_url = \"0033FF\";
google_color_text = \"000000\";
//--></SCRIPT>

<SCRIPT src=\"http://pagead2&#46;googlesyndication&#46;com/pagead/show_ads&#46;js\" type=text/java script>
</SCRIPT>
</CENTER>
<H3></H3>Generic M3U file
<H3></H3>
<P>A list of links to files makes a valid generic playlist&#46; The entry can be relative (i&#46;e&#46; \\files\\song&#46;mp3) or specific (i&#46;e&#46; c:\\media\\files\\son&#46;mp3)&#46; Also, URLs can he inserted to point to a stream or a file on the Internet&#46; </P>
<P>Here are a few sample generic MP3/PLS files: </P>
<TABLE class=notice cellSpacing=0 cellPadding=5 border=1>
<TBODY>
<TR>
<TD><PRE>Alternative\\Song&#46;mp3
Classical\\New_Song&#46;mp3
crap&#46;mp3
F:\\more music\\foo_bar&#46;mp3
http://www&#46;site&#46;com:8000/listen&#46;pls
http://www&#46;site&#46;com/~user/mine&#46;mp3
</PRE></TD></TR></TBODY></TABLE>
<UL>
<LI>Alternative and Classical are sub-directories of the directory that this playlist is stored in&#46;
<LI>\"Song&#46;mp3\" and \"New_Song&#46;mp3\" are in sub-directories that this playlist is stored in&#46;
<LI>\"Crap&#46;mp3\" is in the same directory that the playlist is stored in&#46;
<LI>\"Foo_Bar&#46;mp3\" is in the specified directory, which may or may not be the same directory the playlist is in&#46;
<LI>http://www&#46;site&#46;com:8000/listen&#46;pls is a Shoutcast stream&#46;
<LI>\"Mine&#46;mp3\" is a MP3 stored on a web server somewhere&#46; </LI></UL>
<P>These path options hold true of the extended playlists described below&#46; </P><BR><BR><BR>
<H3>Extended M3U</H3>
<P>Let\'s first look at an extended M3U file then I will describe everything below </P>
<TABLE class=notice cellSpacing=0 cellPadding=5 border=1>
<TBODY>
<TR>
<TD><PRE>#EXTM3U
#EXTINF:233,Everclear - So Much For The Afterglow
Alternative\\everclear_SMFTA&#46;mp3
#EXTINF:227,Weird Al - Everything You Know Is Wrong
Comedy\\Weird_Al_Everything_You_Know_Is_Wrong&#46;mp3
#EXTINF:187,Weird Al Yankovic - This is the Life
Weird_Al_This_Is_The_Life&#46;mp3
#EXTINF:129,Weird Al: Bad Hair Day - Gump
http://www&#46;site&#46;com/~user/gump&#46;mp3
#EXTINF:-1,My Cool Stream
http://www&#46;site&#46;com:8000/listen&#46;pls
</PRE></TD></TR></TBODY></TABLE>
<UL>
<LI>#EXTM3U At the VERY top of the Extended M3U file is this header, which signifies this is an extended M3U file&#46; \"#EXTM3U\" must be all capital letters&#46;
<LI>#EXTINF:233,Everclear - So Much For The Afterglow<BR>This is the line that tends to confuse people&#46; Let\'s break it up into parts
<UL>
<LI>#EXTINF:<BR>This signifies this is an Extended Information field&#46; It ends with a colorn&#46;
<LI>233,<BR>This is the time of the file in seconds followed by a comma&#46; (233 seconds = 3:53)&#46; On the last entry there is a negative one, this is usually seen on streams, it tells the program to ignore the time entry&#46;
<LI>Everclear - So Much For The Afterglow<BR>Title to display&#46; This is usually the title read from the file name or ID3 tags&#46; This also can be the name of a stream&#46; No characters follow the title&#46; </LI></UL>
<LI>Alternative\\everclear_SMFTA&#46;mp3: File location as described above with basic playlists&#46; </LI></UL>
<P>WinAmp also understands the <A href=\"http://www&#46;schworak&#46;com/programming/music/PlayList_PLS&#46;asp\">PLSv2</A> play list format&#46; Windows Media Player understands M3U and <A href=\"http://www&#46;schworak&#46;com/programming/music/PlayList_ASX&#46;asp\">ASX</A> play list formats&#46; </P>
<SCRIPT type=text/java script>
      try
      {
        StillLoading = 0;
        ShowLoading();
      }
      catch(er)
      {
        // Ignore any error
      }
    </SCRIPT>
<BR>
 楼主| 发表于 2006-12-7 19:22:14 | 显示全部楼层
<H2>Extended PLS (PLSv2)</H2>
<P>This is a simple text file normally named with the &#46;pls extension and read mainly by WinAmp and a few other programs&#46; </P>
<H3>The Code</H3>
<TABLE class=notice cellSpacing=0 cellPadding=5 border=1>
<TBODY>
<TR>
<TD><PRE>[playlist]
File1=Alternative\\everclear - SMFTA&#46;mp3
Title1=Everclear - So Much For The Afterglow
Length1=233
File2=Comedy\\Weird Al - Everything You Know Is Wrong&#46;mp3
Title2=Weird Al - Everything You Know Is Wrong
Length2=227
File3=Weird Al - This Is The Life&#46;mp3
Title3=Weird Al Yankovic - This is the Life
Length3=187
File4=http://www&#46;site&#46;com/~user/gump&#46;mp3
Title4=Weird Al: Bad Hair Day - Gump
Length4=129
File5=http://www&#46;site&#46;com:8000/listen&#46;pls
Title5=My Cool Stream
Length5=-1
NumberOfEntries=5
Version=2
</PRE></TD></TR></TBODY></TABLE>
<UL>
<LI>[playlist]: Signifies that this is a playlist&#46; This is case sensitive&#46;
<LI>File#=: Location of the file in any of the formats described above&#46; This is also case sensitive&#46; Also the # sign after \"File\" signifies what file number it is&#46; The first file in the playlist is \"File1\", the second is \"File2\" and so on&#46;
<LI>Title#=: Title to display&#46; This is usually the title read from the file name or ID3 tags&#46; Like the other fields, this is case sensitive&#46; This also can be the name of a stream&#46; Like \"File#\" the pound sign (#) is replaced by the entry number that is in the playlist&#46;
<LI>Length#=\": Length in seconds, this is aloe case sensitive&#46; On the last entry there is a negative one, this is usually seen on streams, it tells the program to ignore the time entry&#46; Like \"File#\" the pound sign (#) is replaced by the entry number that is in the playlist&#46;
<LI>NumberOfEntries=#: The total number of entries in the playlist&#46; This should match the last number on the \"File#\", \"Title#\", and \"Length#\" fields&#46; Also case sensitive&#46;
<LI>Version=2: This required entry near the bottom tells the player what format the PLS is in&#46; Older versions of the PLS format did not include this&#46; Like everything else, it is case sensitive&#46;
<UL>
<SCRIPT type=text/java script>
      try
      {
        StillLoading = 0;
        ShowLoading();
      }
      catch(er)
      {
        // Ignore any error
      }
    </SCRIPT>
<BR></UL></LI></UL>
 楼主| 发表于 2006-12-7 19:22:48 | 显示全部楼层
<H2>Windows Media Player Play List (ASX)</H2>
<P>This is a simple text file normally named with the &#46;asx extension and read mainly by Window Media Player&#46; It has the look of an HTML file with markup tags&#46; This is in fact an XML database file&#46; If you understand XML, this will be easy enough to read&#46; If not don\'t worry, the format will be explained </P>
<H3>The Code</H3>
<TABLE class=notice cellSpacing=0 cellPadding=5 border=1>
<TBODY>
<TR>
<TD><PRE>&lt;ASX VERSION=\"3&#46;0\"&gt;
&lt;Author&gt;John Smith&lt;/Author&gt;
&lt;Title&gt;John\'s CD Clips&lt;/Title&gt;
&lt;Copyright&gt;John Smith Publishing Inc&#46;&lt;/Copyright&gt;
&lt;Abstract&gt;Cafe-Music CD by John Smith and friends&lt;/Abstract&gt;
&lt;Moreinfo href=\"http://www&#46;johnsmith&#46;com/\" /&gt;
&lt;Entry&gt;
   &lt;Author&gt;John &amp; Jane Smith&lt;/Author&gt;
   &lt;Title&gt;Raging Tango&lt;/Title&gt;
   &lt;Moreinfo href=\"http://www&#46;johnsmith&#46;com/tango&#46;htm\" /&gt;
   &lt;ref href = \"http://www&#46;johnsmith&#46;com/media/Raging_Tango&#46;mp3\"/&gt;
&lt;/Entry&gt;
&lt;/ASX&gt;
</PRE></TD></TR></TBODY></TABLE>
<P>Please note that elements are stored between tag pairs &lt;TAG&gt; and &lt;/TAG&gt;&#46; There are two exceptions <B>Moreinfo</B> and <B>ref</B> which have no end tag&#46; They have a slash just before the end of the tag block&#46; This is described below&#46; </P>
<UL>
<LI>&lt;ASX VERSION=\"3&#46;0\"&gt; and &lt;/ASX&gt; <BR>This must be the outer most element, start on the first line and must be in upper case&#46; The version number identifies the version of the layout format&#46; This number depends on the player you intend on using the play list with&#46; A player that only understands 2&#46;0 play lists will likely ignore a 3&#46;0 playlist&#46; At the end of the file you will find the close tag for this open tag &lt;/ASX&gt; which is also in upper case&#46; There can only be one ASX element&#46;
<LI>&lt;Author&gt; and &lt;/Author&gt; The information within this tag identifies the author of the entire play list&#46; <B>John Smith</B> in our example&#46;
<LI>&lt;Copyright&gt; and &lt;/Copyright&gt; This identifies the holder of the copyright for the play list&#46;
<LI>&lt;Abstract&gt; and &lt;/Abstract&gt; Gives a short description about the play list&#46;
<LI>&lt;Moreinfo href=\"<I>some URL goes here</I>\" /&gt; has not end tag&#46; Instead it ends with /&gt; instead of the &gt; alone&#46; No end tag is needed because the only data is stored in the <B>href</B> parameter&#46; This is the URL path to more information on this play list&#46;
<LI>&lt;Entry&gt; and &lt;/Entry&gt; This element holds the sub elements that describe individual sound files&#46; There can be many of these elements&#46; Each pair of tags is wrapped around the information for a single song&#46;
<UL>
<LI>&lt;Author&gt; and &lt;/Author&gt; The information within this tag identifies the author of this one sound file&#46; <B>John &amp; Jane Smith</B> in our example&#46;
<LI>&lt;Title&gt; and &lt;/Title&gt; This identifies title of this sound file&#46;
<LI>&lt;Moreinfo href=\"<I>some URL goes here</I>\" /&gt; has not end tag&#46; Instead it ends with /&gt; instead of the &gt; alone&#46; No end tag is needed because the only data is stored in the <B>href</B> parameter&#46; This is the URL path to more information on this one sound file&#46;
<LI>&lt;ref href=\"<I>some URL goes here</I>\" /&gt; has not end tag&#46; Instead it ends with /&gt; instead of the &gt; alone&#46; No end tag is needed because the only data is stored in the <B>href</B> parameter&#46; This is the URL path to the actual sound file&#46; </LI></UL></LI></UL>
<P>Please take notice of the case of the tags&#46; Although tests have shown that Media Player will accept some tags in upper or lower case, it will not accept an opening tag in one case (say upper) and the matching close tag in another case (say lower or mixed)&#46; To ensure your play list works properly it is suggested that you use the case shown in the examples above&#46; </P>
<SCRIPT type=text/java script>
      try
      {
        StillLoading = 0;
        ShowLoading();
      }
      catch(er)
      {
        // Ignore any error
      }
    </SCRIPT>
<BR>
 楼主| 发表于 2006-12-7 19:34:01 | 显示全部楼层
大体意思就是说,M3U是Winamp推出的一种歌曲列表方式(在本人看来,这也是最简单的一种了)。m3u比较简单,本质上是一个文本文件(TXT文件,只是后缀名为M3U),里面的内容最简单的形式就是一行一行的歌曲文件或者网络链接(似乎播放列表也是可以的)的列表,每一首歌一行,比如:
  1. Alternative\\Song.mp3
  2. Classical\\New_Song.mp3
  3. crap.mp3
  4. F:\\more music\\foo_bar.mp3
  5. http://www.site.com:8000/listen.pls
  6. http://www.site.com/~user/mine.mp3
复制代码

当然,m3u也有更复杂一点的方式,比如:
  1. #EXTM3U
  2. #EXTINF:233,Everclear - So Much For The Afterglow
  3. Alternativeeverclear_SMFTA.mp3
  4. #EXTINF:227,Weird Al - Everything You Know Is Wrong
  5. ComedyWeird_Al_Everything_You_Know_Is_Wrong.mp3
  6. #EXTINF:187,Weird Al Yankovic - This is the Life
  7. Weird_Al_This_Is_The_Life.mp3
  8. #EXTINF:129,Weird Al: Bad Hair Day - Gump
  9. http://www.site.com/~user/gump.mp3
  10. #EXTINF:-1,My Cool Stream
  11. http://www.site.com:8000/listen.pls
复制代码

上面表示,可以用“#”给这些歌曲加注释,后面的内容可以是播放时间、播放时显示的歌曲标题等等

PLS是另一种播放列表方式,也是一种文本格式的文件(这三种列表文件从本质上说都是文本文件),目前的版本是第二版。Winamp和一些别的软件都可以识别PLS格式。
和M3U不一样的是,PLS的格式比较复杂,是一种传统的INI文件格式,很容易看懂,例子如下:
  1. [playlist]
  2. File1=Alternative\\everclear - SMFTA.mp3
  3. Title1=Everclear - So Much For The Afterglow
  4. Length1=233
  5. File2=Comedy\\Weird Al - Everything You Know Is Wrong.mp3
  6. Title2=Weird Al - Everything You Know Is Wrong
  7. Length2=227
  8. File3=Weird Al - This Is The Life.mp3
  9. Title3=Weird Al Yankovic - This is the Life
  10. Length3=187
  11. File4=http://www.site.com/~user/gump.mp3
  12. Title4=Weird Al: Bad Hair Day - Gump
  13. Length4=129
  14. File5=http://www.site.com:8000/listen.pls
  15. Title5=My Cool Stream
  16. Length5=-1
  17. NumberOfEntries=5
  18. Version=2
复制代码

看起来有点头晕,这样的东东是很难手工编写的


ASX是微软媒体播放器专用的一种格式,和PLS相比,它的特点是用XML来描述文件(更麻烦了! )。编写的工作量这么大,而且也不容易看懂,因此用手工编写的方式已经几乎不可能,要想创建ASX文件列表,可以到网上找一个ASX列表生成工具软件来做:

  1. &lt;ASX VERSION=&quot;3.0&quot;&gt;
  2. &lt;Author&gt;John Smith&lt;/Author&gt;
  3. &lt;Title&gt;John&#39;s CD Clips&lt;/Title&gt;
  4. &lt;Copyright&gt;John Smith Publishing Inc.&lt;/Copyright&gt;
  5. &lt;Abstract&gt;Cafe-Music CD by John Smith and friends&lt;/Abstract&gt;
  6. &lt;Moreinfo href=&quot;http://www.johnsmith.com/&quot; /&gt;
  7. &lt;Entry&gt;
  8.    &lt;Author&gt;John & Jane Smith&lt;/Author&gt;
  9.    &lt;Title&gt;Raging Tango&lt;/Title&gt;
  10.    &lt;Moreinfo href=&quot;http://www.johnsmith.com/tango.htm&quot; /&gt;
  11.    &lt;ref href = &quot;http://www.johnsmith.com/media/Raging_Tango.mp3&quot;/&gt;
  12. &lt;/Entry&gt;
  13. &lt;/ASX&gt;
复制代码
 楼主| 发表于 2006-12-7 19:39:28 | 显示全部楼层
最后,我觉得最好,最简单的方式就是m3u了,不但一目了然,而且容易编写。

推荐大家用m3u格式
发表于 2006-12-7 23:49:08 | 显示全部楼层
就我来看,就拿记事本把我要连播的曲目一条一条写好,在保存的时候把后缀改为M3U也好还是ASX也好,只要可以上传,就可以了,根本就不需要按什么格式编写,播放器自然会处理的。
 楼主| 发表于 2006-12-8 08:59:17 | 显示全部楼层
那倒是,现在的播放器容错能力都贼强啊

另外试了一下,windows media就可以生成WPL、M3U、ASX三种格式的播放列表,而且操作还很简单。

WinAMP可以生成M3U(还有一个UTF-8的M3U格式,叫做M3U8)和PLS两种格式的播放列表
*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|小黑屋|哈飞车友会 ( 鲁ICP备15020090号-4 ) | | 点击这里给我发消息 |

GMT+8, 2024-11-22 00:19 , Processed in 0.041638 second(s), 5 queries , Gzip On, MemCache On.

Powered by Discuz! X

© ys166.com

快速回复 返回顶部 返回列表