コード例 #1
0
ファイル: epg.py プロジェクト: neopack1/PyEPG
def out_episode ( xml, eps ):
  ele = Element('episode', id=eps.uri)
  if eps.brand:
    ele.addAttribute('brand', eps.brand.uri)
  if eps.series:
    ele.addAttribute('series', eps.series.uri)
  # TODO: re-think this!
  ele.addChild(Element('title', eps.get_title()))
  st = eps.get_subtitle()
  if st:
    ele.addChild(Element('subtitle', st))
  su = eps.get_summary()
  if su:
    ele.addChild(Element('summary', su))
  if eps.number:
    ele.addChild(Element('number', eps.number))
  if eps.part_num:
    ele.addChild(Element('part-number', eps.part_num))
  if eps.part_cnt:
    ele.addChild(Element('part-count', eps.part_cnt))
  if eps.film:
    ele.addChild(Element('film'))
  for g in eps.get_genres():
    ele.addChild(Element('genre', g))
  cs = eps.get_credits()
  if cs:
    cre = Element('credits')
    for r in cs:
      for p in cs[r]:
        if p.role == 'actor' and p.character:
          cre.addChild(Element('actor', p.name, character=p.character))
        else:
          cre.addChild(Element(r, p.name))
    ele.addChild(cre)
  if eps.year and eps.film:
    ele.addChild(Element('date', eps.year))
  if eps.baw:
    ele.addChild(Element('blackandwhite'))

  # TODO: images
  #if eps.image:
  #  ele.addChild(Element('image', eps.image))
  #if eps.thumb:
  #  ele.addChild(Element('thumb', eps.thumb))

  # TODO: HD (as in showing on HD channel)

  xml.addChild(ele)
コード例 #2
0
ファイル: epg.py プロジェクト: adamsutton/PyEPG
def out_episode(xml, eps):
    ele = Element("episode", id=eps.uri)
    if eps.brand:
        ele.addAttribute("brand", eps.brand.uri)
    if eps.series:
        ele.addAttribute("series", eps.series.uri)
    # TODO: re-think this!
    ele.addChild(Element("title", eps.get_title()))
    st = eps.get_subtitle()
    if st:
        ele.addChild(Element("subtitle", st))
    su = eps.get_summary()
    if su:
        ele.addChild(Element("summary", su))
    if eps.number:
        ele.addChild(Element("number", eps.number))
    if eps.part_num:
        ele.addChild(Element("part-number", eps.part_num))
    if eps.part_cnt:
        ele.addChild(Element("part-count", eps.part_cnt))
    if eps.film:
        ele.addChild(Element("film"))
    for g in eps.get_genres():
        ele.addChild(Element("genre", g))
    cs = eps.get_credits()
    if cs:
        cre = Element("credits")
        for r in cs:
            for p in cs[r]:
                if p.role == "actor" and p.character:
                    cre.addChild(Element("actor", p.name, character=p.character))
                else:
                    cre.addChild(Element(r, p.name))
        ele.addChild(cre)
    if eps.year and eps.film:
        ele.addChild(Element("date", eps.year))
    if eps.baw:
        ele.addChild(Element("blackandwhite"))

    # TODO: images
    # if eps.image:
    #  ele.addChild(Element('image', eps.image))
    # if eps.thumb:
    #  ele.addChild(Element('thumb', eps.thumb))

    # TODO: HD (as in showing on HD channel)

    xml.addChild(ele)
コード例 #3
0
ファイル: epg.py プロジェクト: neopack1/PyEPG
def out_series ( xml, series ):
  ele = Element('series', id=series.uri)
  if series.brand:
    ele.addAttribute('brand', series.brand.uri)
  if series.title:
    ele.addChild(Element('title', series.title))
  if series.summary:
    ele.addChild(Element('summary', series.summary))
  if series.image:
    ele.addChild(Element('image', series.image))
  if series.thumb:
    ele.addChild(Element('thumb', series.thumb))
  if series.number is not None:
    ele.addChild(Element('number', series.number))
  else:
    log.warn('no series number for %s' % series.uri)
  if series.episode_count:
    ele.addChild(Element('episode_count', series.episode_count))
  xml.addChild(ele)
コード例 #4
0
ファイル: epg.py プロジェクト: adamsutton/PyEPG
def out_series(xml, series):
    ele = Element("series", id=series.uri)
    if series.brand:
        ele.addAttribute("brand", series.brand.uri)
    if series.title:
        ele.addChild(Element("title", series.title))
    if series.summary:
        ele.addChild(Element("summary", series.summary))
    if series.image:
        ele.addChild(Element("image", series.image))
    if series.thumb:
        ele.addChild(Element("thumb", series.thumb))
    if series.number is not None:
        ele.addChild(Element("number", series.number))
    else:
        log.warn("no series number for %s" % series.uri)
    if series.episode_count:
        ele.addChild(Element("episode_count", series.episode_count))
    xml.addChild(ele)