コード例 #1
0
def parse_day(n, xmltv, rawclist):
    i = n + 130
    logger.info("Reading day " + str(i - 130))
    epgstream = TvaStream('239.0.2.' + str(i), config['mcast_port'])
    epgstream.getfiles()
    for i in epgstream.files().keys():
        logger.info("Parsing " + i)
        epgparser = TvaParser(epgstream.files()[i])
        epgparser.parseepg(OBJ_XMLTV, rawclist)
    return
コード例 #2
0
def parse_day(n, xmltv, rawclist):
    i = n + 130
    logger.info("Reading day " + str(i - 130))
    epgstream = TvaStream("239.0.2." + str(i), config["mcast_port"])
    epgstream.getfiles()
    for i in epgstream.files().keys():
        logger.info("Parsing " + i)
        epgparser = TvaParser(epgstream.files()[i])
        epgparser.parseepg(OBJ_XMLTV, rawclist)
    return
コード例 #3
0
                str(config['mcast_port']))

    ENCODING_EPG = 'utf-8'
    ENCODING_SYS = sys.getdefaultencoding()
    sys.setdefaultencoding(ENCODING_EPG)

    # Main starts

    demarcationstream = TvaStream(config['mcast_grp_start'],
                                  config['mcast_port'])
    demarcationstream.getfiles()
    demarcationxml = demarcationstream.files()["1_0"]

    logger.info("Getting channels source for DEM: " +
                str(config['demarcation']))
    MCAST_CHANNELS = TvaParser(demarcationxml).get_mcast_demarcationip(
        config['demarcation'])

    now = datetime.datetime.utcnow()
    OBJ_XMLTV = ET.Element(
        "tv", {
            "date": now.strftime("%Y%m%d%H%M%S +0000"),
            "source_info_url": "https://go.tv.movistar.es",
            "source_info_name": "Grabber for internal multicast of MovistarTV",
            "generator_info_name": "python-xml-parser",
            "generator_info_url": "http://wiki.xmltv.org/index.php/XMLTVFormat"
        })
    #OBJ_XMLTV = ET.Element("tv" , {"date":now.strftime("%Y%m%d%H%M%S")+" +0200"})

    logger.info("Getting channels list from: " + MCAST_CHANNELS)
    channelsstream = TvaStream(MCAST_CHANNELS, config['mcast_port'])
    channelsstream.getfiles()
コード例 #4
0
        "source_info_name": "Grabber for internal multicast of MovistarTV",
        "generator_info_name": "python-xml-parser",
        "generator_info_url": "http://wiki.xmltv.org/index.php/XMLTVFormat"
    })
#OBJ_XMLTV = ET.Element("tv" , {"date":now.strftime("%Y%m%d%H%M%S")+" +0200"})

first_day = int(sys.argv[1])
last_day = int(sys.argv[2])

logger.info("Getting channels list")

channelsstream = TvaStream(MCAST_CHANNELS, MCAST_PORT)
channelsstream.getfiles()
xmlchannels = channelsstream.files()["2_0"]

channelparser = TvaParser(xmlchannels)
OBJ_XMLTV = channelparser.channels2xmltv(OBJ_XMLTV)

channelsm3u = channelparser.channels2m3u()
if os.path.isfile(FILE_M3U):
    os.remove(FILE_M3U)
fM3u = open(FILE_M3U, 'w+')
fM3u.write(channelsm3u)
fM3u.close

for day in range(first_day, last_day):
    i = int(day) + 130
    grabbedDay = now + timedelta(days=int(day))
    logger.info("Reading day " + grabbedDay.strftime("%d-%m-%Y"))
    epgstream = TvaStream('239.0.2.' + str(i), MCAST_PORT)
コード例 #5
0
            "date": now.strftime("%Y%m%d%H%M%S +0000"),
            "source_info_url": "https://go.tv.movistar.es",
            "source_info_name": "Grabber for internal multicast of MovistarTV",
            "generator_info_name": "python-xml-parser",
            "generator_info_url": "http://wiki.xmltv.org/index.php/XMLTVFormat",
        },
    )
    # OBJ_XMLTV = ET.Element("tv" , {"date":now.strftime("%Y%m%d%H%M%S")+" +0200"})

    logger.info("Getting channels list from: " + MCAST_CHANNELS)
    channelsstream = TvaStream(MCAST_CHANNELS, config["mcast_port"])
    channelsstream.getfiles()
    xmlchannels = channelsstream.files()["2_0"]
    xmlchannelspackages = channelsstream.files()["5_0"]

    channelparser = TvaParser(xmlchannels)
    rawclist = {}
    rawclist = channelparser.channellist(rawclist)

    channelspackages = {}
    channelspackages = TvaParser(xmlchannelspackages).getpackages()

    # If m3u arg create m3u and exit
    if args.m3u:
        clist = {}
        for package in config["tvpackages"]:
            for channel in channelspackages[package].keys():
                clist[channel] = rawclist[channel]
                clist[channel]["order"] = channelspackages[package][channel]["order"]

        channelsm3u = channelparser.channels2m3u(clist)