Beispiel #1
0
def format(epg, out):

    # Start XML document
    xml = Document("epg", "pyepg.dtd", "1.0", PYEPG_ENCODING)
    xml.begin(out)

    # Channels
    for c in epg.get_channels():
        out_channel(xml, c)

    # Brands
    for b in epg.get_brands():
        out_brand(xml, b)

    # Series
    for s in epg.get_series():
        out_series(xml, s)

    # Episodes
    for e in epg.get_episodes():
        out_episode(xml, e)

    # Schedules
    sc = epg.get_schedule()
    for c in sc:
        out_schedule(xml, sc[c], c)

    # Done
    xml.end()
Beispiel #2
0
def format ( epg, out, extended = True ):

  now   = datetime.datetime.now().replace(tzinfo=util.TimeZoneSimple(0))
  dtd   = 'xmltv.dtd'
  if extended: dtd = 'e' + dtd
  attrs = {
    'date'            : now.strftime(XMLTV_TIME_FORMAT),
    'gen-info-name'   : 'PyEPG XMLTV Output'
    # TODO: other params?
  }
  xml = Document('tv', dtd, '1.0', XMLTV_ENCODING, **attrs)
  xml.begin(out)

  # Channels
  for c in epg.get_channels():
    out_channel(xml, c, extended)

  # Episodes
  sched = epg.get_schedule()
  for c in sched:
    for e in sched[c]:
      out_episode(xml, e, extended)

  # Done
  xml.end()
Beispiel #3
0
def format ( epg, out ):

  # Start XML document
  xml = Document('epg', 'pyepg.dtd', '1.0', PYEPG_ENCODING)
  xml.begin(out)

  # Channels
  for c in epg.get_channels():
    out_channel(xml, c)

  # Brands
  for b in epg.get_brands():
    out_brand(xml, b)

  # Series
  for s in epg.get_series():
    out_series(xml, s)

  # Episodes
  for e in epg.get_episodes():
    out_episode(xml, e)

  # Schedules
  sc = epg.get_schedule()
  for c in sc:
    out_schedule(xml, sc[c], c)

  # Done
  xml.end()
Beispiel #4
0
def format(epg, out, extended=True):

    now = datetime.datetime.now().replace(tzinfo=util.TimeZoneSimple(0))
    dtd = 'xmltv.dtd'
    if extended: dtd = 'e' + dtd
    attrs = {
        'date': now.strftime(XMLTV_TIME_FORMAT),
        'gen-info-name': 'PyEPG XMLTV Output'
        # TODO: other params?
    }
    xml = Document('tv', dtd, '1.0', XMLTV_ENCODING, **attrs)
    xml.begin(out)

    # Channels
    for c in epg.get_channels():
        out_channel(xml, c, extended)

    # Episodes
    sched = epg.get_schedule()
    for c in sched:
        for e in sched[c]:
            out_episode(xml, e, extended)

    # Done
    xml.end()