def live_catalog(self): if os.path.isfile(CACHE_FILE): f = open(CACHE_FILE, 'r') try: self.catalog = pickle.load(f) except: self.catalog = None f.close() else: self.catalog = None if self.catalog is None or self.catalog.is_old(): url = urllib.urlopen(LIVE_XML_CATALOG) catalog_xml = url.read() url.close() try: channels = etree.XML(catalog_xml) except etree.XMLSyntaxError: msg_win = MessageWindow(text=_( 'XML file is malformed !!!\nPlease wait while BeautifulSoup fix it' ), title=_('XML Error'), button=False) msg_win.show() catalog_xml = str(BeautifulStoneSoup(catalog_xml)) try: msg_win.hide() except: pass self.catalog = Catalog(catalog_xml) if not os.path.exists(CACHE_DIR): os.mkdir(CACHE_DIR) f = open(CACHE_FILE, 'w') pickle.dump(self.catalog, f) f.close() return self.catalog.catalog
def _copy_ts(ts_file, psp_path): psp_mp4_file, psp_thm_file = _get_psp_filenames(psp_path) msg = MessageWindow(_('Copying to PSP (tm) please wait...'), button=None) msg.show() mp4_cmd = '/usr/bin/ts2psp "%s" "%s"' % (ts_file, psp_mp4_file) thm_cmd = 'cp "%s" "%s"' % (thm_src_file, psp_thm_file) log.debug(mp4_cmd) os.system(mp4_cmd) log.debug(thm_cmd) os.system(thm_cmd) os.system('sync') sleep(2) msg.hide() return None
o: self.nodes: {0: <unpyclib.structure.node instance at 0xb7748e6c>} nname: 0 n 0(None)[psp_mp4_file, psp_thm_file = _get_psp_filenames(psp_path) msg = MessageWindow(_('Copying to PSP (tm) please wait...'), button=None) msg.show() mp4_cmd = '/usr/bin/ts2psp "%s" "%s"' % (ts_file, psp_mp4_file) thm_cmd = 'cp "%s" "%s"' % (thm_src_file, psp_thm_file) log.debug(mp4_cmd) os.system(mp4_cmd) log.debug(thm_cmd) os.system(thm_cmd) os.system('sync') sleep(2) msg.hide() return None ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb7748fec>} nname: 53 n 53(None)[Task(_copy_ts, output_file, psp_path).start(0) raise StopIteration() ]: i: 26(), 52() o: nname: 52 n 52(None)[]: