XMLTV格式简单说明

可以自定义直播源的IPTV播放器“Perfect Player”支持解析的 XMLTV 格式的 EPG 文件数据,这边收集了该格式的一些信息。

《XMLTV格式简单说明》
XMLTV是一项 XML 技术,它能够对电视节目单进行处理和加工。使用的格式不同于大多数其他基于 XML 的电视节目表格式,因为它是从用户的角度(而不是广播公司的角度)编写的。它不将节目表分为频道,而是将所有频道混合到一个统一的列表中。每个节目都有一些细节,如名称、描述和学分,作为补充存储,但元数据,如广播细节,则作为属性存储。支持多种语言的节目表,每个节目可以有“语言”和“原始语言”的详细信息。XMLTV也提供了关联到节目信息的链接,这些信息包括节目的来 源,录制时间、节目的导演、节目的参与者,以及节目的种类等等。

XMLTV文件格式最初由Ed Avis创建,目前由XMLTV项目维护。对于XMLTV文件类型定义(XMLTV DTD),简单地说,它展示了一个用于电视节目单的、简单但功能强大、并且具备描述性的标记语言。DTD的的一些定义可以见文章后面的“附录1”部分。这个文法的关键元素包括以下几个方面:

  • tv generator-info-name:节目单的来源
  • channel id:频道名称信息、网络URL链接、显示信息以及更多信息
  • programme:节目的英文名称,单一节目数据存储的地方
  • title:节目名称
  • desc:文本的节目描述
  • credits:对导演及其他有贡献者的谢启和姓名
  • director:导演姓名
  • actor演员姓名
  • date:数据存储
  • country:原产国家
  • episode-num:情节数,用于区分每一个情节、辨认已经录制了的重播情节
  • video:视频描述符的集合,如特征(比率)
  • aspect:纪录的比率特征(4:3表示SDTV,,16:9 表示HDTV)
  • rating:评估数据
  • value:已确定的评估值
  • icon:显示的评估图标
  • star-rating:质量、受欢迎度,通过明星个数表示

虽然,上面的列表只包含了一部分关键元素,而且也仅仅是大致的描述(请参考DTD完整细节和解释),但是,它很清楚的表明了,为什么能够捕获以及存储所有电视节目的信息——人们需要获得这些信息,并且根据它们选择看什么以及录制什么节目。
简单来说 xmltv 文件有两种类型的记录

  1. “channel”记录,存储有关频道的信息
  2. “programme”记录,存储有关单个剧集的信息

以下就是一个 XMLTV 格式的例子,其中大多数信息是可选的,可能并非所有来源都提供。

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE tv SYSTEM "xmltv.dtd">

<tv source-info-url="http://www.schedulesdirect.org/" source-info-name="Schedules Direct" generator-info-name="XMLTV/$Id: tv_grab_na_dd.in,v 1.70 2008/03/03 15:21:41 rmeden Exp $" generator-info-url="http://www.xmltv.org/">
  <channel id="I10436.labs.zap2it.com">
    <display-name>13 KERA</display-name>
    <display-name>13 KERA TX42822:-</display-name>
    <display-name>13</display-name>
    <display-name>13 KERA fcc</display-name>
    <display-name>KERA</display-name>
    <display-name>KERA</display-name>
    <display-name>PBS Affiliate</display-name>
    <icon src="file://C:\Perl\site/share/xmltv/icons/KERA.gif" />
  </channel>
  <channel id="I10759.labs.zap2it.com">
    <display-name>11 KTVT</display-name>
    <display-name>11 KTVT TX42822:-</display-name>
    <display-name>11</display-name>
    <display-name>11 KTVT fcc</display-name>
    <display-name>KTVT</display-name>
    <display-name>KTVT</display-name>
    <display-name>CBS Affiliate</display-name>
    <icon src="file://C:\Perl\site/share/xmltv/icons/KTVT.gif" />
  </channel>
  <programme start="20080715003000 -0600" stop="20080715010000 -0600" channel="I10436.labs.zap2it.com">
    <title lang="en">NOW on PBS</title>
    <desc lang="en">Jordan's Queen Rania has made job creation a priority to help curb the staggering unemployment rates among youths in the Middle East.</desc>
    <date>20080711</date>
    <category lang="en">Newsmagazine</category>
    <category lang="en">Interview</category>
    <category lang="en">Public affairs</category>
    <category lang="en">Series</category>
    <episode-num system="dd_progid">EP01006886.0028</episode-num>
    <episode-num system="onscreen">427</episode-num>
    <audio>
      <stereo>stereo</stereo>
    </audio>
    <previously-shown start="20080711000000" />
    <subtitles type="teletext" />
  </programme>
  <programme start="20080715010000 -0600" stop="20080715023000 -0600" channel="I10436.labs.zap2it.com">
    <title lang="en">Mystery!</title>
    <sub-title lang="en">Foyle's War, Series IV: Bleak Midwinter</sub-title>
    <desc lang="en">Foyle investigates an explosion at a munitions factory, which he comes to believe may have been premeditated.</desc>
    <date>20070701</date>
    <category lang="en">Anthology</category>
    <category lang="en">Mystery</category>
    <category lang="en">Series</category>
    <episode-num system="dd_progid">EP00003026.0665</episode-num>
    <episode-num system="onscreen">2705</episode-num>
    <audio>
      <stereo>stereo</stereo>
    </audio>
    <previously-shown start="20070701000000" />
    <subtitles type="teletext" />
  </programme>
  <programme start="20080715023000 -0600" stop="20080715040000 -0600" channel="I10436.labs.zap2it.com">
    <title lang="en">Mystery!</title>
    <sub-title lang="en">Foyle's War, Series IV: Casualties of War</sub-title>
    <desc lang="en">The murder of a prominent scientist may have been due to a gambling debt.</desc>
    <date>20070708</date>
    <category lang="en">Anthology</category>
    <category lang="en">Mystery</category>
    <category lang="en">Series</category>
    <episode-num system="dd_progid">EP00003026.0666</episode-num>
    <episode-num system="onscreen">2706</episode-num>
    <audio>
      <stereo>stereo</stereo>
    </audio>
    <previously-shown start="20070708000000" />
    <subtitles type="teletext" />
  </programme>
  <programme start="20080715040000 -0600" stop="20080715043000 -0600" channel="I10436.labs.zap2it.com">
    <title lang="en">BBC World News</title>
    <desc lang="en">International issues.</desc>
    <category lang="en">News</category>
    <category lang="en">Series</category>
    <episode-num system="dd_progid">SH00315789.0000</episode-num>
    <previously-shown />
    <subtitles type="teletext" />
  </programme>
  <programme start="20080715043000 -0600" stop="20080715050000 -0600" channel="I10436.labs.zap2it.com">
    <title lang="en">Sit and Be Fit</title>
    <date>20070924</date>
    <category lang="en">Exercise</category>
    <category lang="en">Series</category>
    <episode-num system="dd_progid">EP00003847.0074</episode-num>
    <episode-num system="onscreen">901</episode-num>
    <audio>
      <stereo>stereo</stereo>
    </audio>
    <previously-shown start="20070924000000" />
    <subtitles type="teletext" />
  </programme>
  <programme start="20080715060000 -0600" stop="20080715080000 -0600" channel="I10759.labs.zap2it.com">
    <title lang="en">The Early Show</title>
    <desc lang="en">Republican candidate John McCain; premiere of the film "The Dark Knight."</desc>
    <date>20080715</date>
    <category lang="en">Talk</category>
    <category lang="en">News</category>
    <category lang="en">Series</category>
    <episode-num system="dd_progid">EP00337003.2361</episode-num>
    <audio>
      <stereo>stereo</stereo>
    </audio>
    <subtitles type="teletext" />
  </programme>
  <programme start="20080715080000 -0600" stop="20080715090000 -0600" channel="I10759.labs.zap2it.com">
    <title lang="en">Rachael Ray</title>
    <desc lang="en">Actresses Kim Raver, Brooke Shields and Lindsay Price ("Lipstick Jungle"); women in their 40s tell why they got breast implants; a 30-minute meal.</desc>
    <credits>
      <presenter>Rachael Ray</presenter>
    </credits>
    <date>20080306</date>
    <category lang="en">Talk</category>
    <category lang="en">Series</category>
    <episode-num system="dd_progid">EP00847333.0303</episode-num>
    <episode-num system="onscreen">2119</episode-num>
    <audio>
      <stereo>stereo</stereo>
    </audio>
    <previously-shown start="20080306000000" />
    <subtitles type="teletext" />
  </programme>
  <programme start="20080715090000 -0600" stop="20080715100000 -0600" channel="I10759.labs.zap2it.com">
    <title lang="en">The Price Is Right</title>
    <desc lang="en">Contestants bid for prizes then compete for fabulous showcases.</desc>
    <credits>
      <director>Bart Eskander</director>
      <producer>Roger Dobkowitz</producer>
      <presenter>Drew Carey</presenter>
    </credits>
    <category lang="en">Game show</category>
    <category lang="en">Series</category>
    <episode-num system="dd_progid">SH00004372.0000</episode-num>
    <audio>
      <stereo>stereo</stereo>
    </audio>
    <subtitles type="teletext" />
    <rating system="VCHIP">
      <value>TV-G</value>
    </rating>
  </programme>
  <programme start="20080715100000 -0600" stop="20080715103000 -0600" channel="I10759.labs.zap2it.com">
    <title lang="en">Jeopardy!</title>
    <credits>
      <presenter>Alex Trebek</presenter>
    </credits>
    <date>20080715</date>
    <category lang="en">Game show</category>
    <category lang="en">Series</category>
    <episode-num system="dd_progid">EP00002348.1700</episode-num>
    <episode-num system="onscreen">5507</episode-num>
    <subtitles type="teletext" />
    <rating system="VCHIP">
      <value>TV-G</value>
    </rating>
  </programme>
  <programme start="20080715103000 -0600" stop="20080715113000 -0600" channel="I10759.labs.zap2it.com">
    <title lang="en">The Young and the Restless</title>
    <sub-title lang="en">Sabrina Offers Victoria a Truce</sub-title>
    <desc lang="en">Jeff thinks Kyon stole the face cream; Nikki asks Nick to give David a chance; Amber begs Adrian to go to Australia.</desc>
    <credits>
      <actor>Peter Bergman</actor>
      <actor>Eric Braeden</actor>
      <actor>Jeanne Cooper</actor>
      <actor>Melody Thomas Scott</actor>
    </credits>
    <date>20080715</date>
    <category lang="en">Soap</category>
    <category lang="en">Series</category>
    <episode-num system="dd_progid">EP00004422.1359</episode-num>
    <episode-num system="onscreen">8937</episode-num>
    <audio>
      <stereo>stereo</stereo>
    </audio>
    <subtitles type="teletext" />
    <rating system="VCHIP">
      <value>TV-14</value>
    </rating>
  </programme>
</tv>

而且,与XML的其它所有格式一样,这一数据也是明码文本,因此是非常易于获取、下载、解析、解释、存储以及处理的。如果你花时间来阅读DTD 的话,你也能够了解到,XMLTV的结构和语法其实都并不复杂。对于那些有兴趣创建自己的电视节目收藏的人们而言,使节目的获取——不仅从无线电信号,而 且从电缆或者卫星提供者,甚至是从日益增加的网络信息源和提供者那里获取节目——变得简单,这确实带来了实际的好处。

附录1:DTD说明 ==> 展开/收缩

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

  1. yangyanc yangyanc 说道:

    大佬有研究webgrab plus么?专门抓epg的软件…上面的元素全都能抓啊

    1. 白鸟 白鸟 说道:

      那东西没什么用,有个配置文件要自己写,国内的epg好像只提供没几个,而且早就没有人维护了不能用了
      不如自己动手,抓epg简单的很,特别是通过api调用的更简单

    2. 黑鸟君 说道:

      这东西只是了解了下,看文档操作起来也是挺复杂的,就没搞了..

  2. fy789 说道:

    终于更新了 :biggrin: :biggrin: :biggrin:

    1. 黑鸟君 说道:

      懒癌发作,都不想动..