"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) epgstream.getfiles()
clist[channel]["order"] = channelspackages[package][channel][ "order"] channelsm3u = channelparser.channels2m3u(clist) if args.filename: FILE_M3U = args.filename if os.path.isfile(FILE_M3U): os.remove(FILE_M3U) fM3u = open(FILE_M3U, 'w+') fM3u.write(channelsm3u) fM3u.close else: print channelsm3u exit() OBJ_XMLTV = channelparser.channels2xmltv(OBJ_XMLTV, rawclist) last_day = args.grab_offset + args.grab_days if last_day > 6: last_day = 6 threads = list() for d in range(args.grab_offset, last_day): t = threading.Thread(target=parse_day, args=(d, OBJ_XMLTV, rawclist)) threads.append(t) t.start() [x.join() for x in threads] # A standard grabber should print the xmltv file to the stdout or to # filename if called with option --output filename
clist[channel] = rawclist[channel] clist[channel]["order"] = channelspackages[package][channel]["order"] channelsm3u = channelparser.channels2m3u(clist) if args.filename: FILE_M3U = args.filename if os.path.isfile(FILE_M3U): os.remove(FILE_M3U) fM3u = open(FILE_M3U, "w+") fM3u.write(channelsm3u) fM3u.close else: print channelsm3u exit() OBJ_XMLTV = channelparser.channels2xmltv(OBJ_XMLTV, rawclist) last_day = args.grab_offset + args.grab_days if last_day > 6: last_day = 6 threads = list() for d in range(args.grab_offset, last_day): t = threading.Thread(target=parse_day, args=(d, OBJ_XMLTV, rawclist)) threads.append(t) t.start() [x.join() for x in threads] # A standard grabber should print the xmltv file to the stdout or to # filename if called with option --output filename