def deleteLocalEpgidPath(self, epgid=False, file=False): if epgid: path = self.__getLocalEpgidPath(epgid, mkdir=False) json_file = self.__getEpgidJsonFile(epgid) elif file: path = file json_file = path + '.json.v1' else: return False if not vfs.exists(json_file): xbmc.log('could not delete %s, no info file found' % path) return False else: try: if file: if vfs.exists(path): vfs.delete(path) if vfs.exists(json_file): vfs.delete(json_file) elif epgid and vfs.exists(path): for file_name in vfs.listdir(path)[1]: file_path = vfs.path.join(path, file_name) vfs.delete(file_path) vfs.rmdir(path) except Exception, e: xbmc.log("failed to delete %s (%s)" % (path, str(e))) else:
def __findAllRecordingInfo(self): for dir_name in vfs.listdir(self.path)[0]: json_file = self.__getEpgidJsonFile(dir_name) try: if vfs.exists(json_file): if not isinstance(json.loads( __sx__.noNull(vfs.File(json_file).read()) ), dict): continue else: continue except Exception, e: xbmc.log("%s: %s" % (json_file, str(e))) else: epgid = dir_name yield epgid
def __findAllRecordingInfo(self): for dir_name in vfs.listdir(self.path)[0]: json_file = self.__getEpgidJsonFile(dir_name) try: if vfs.exists(json_file): if not isinstance( json.loads( __sx__.noNull(vfs.File(json_file).read())), dict): continue else: continue except Exception, e: xbmc.log("%s: %s" % (json_file, str(e))) else: epgid = dir_name yield epgid
def __findEpgidLocalCopies(self, local_path): for file_name in vfs.listdir(local_path)[1]: if file_name.endswith('.json.v1'): json_file = vfs.path.join(local_path, file_name) reference_file = json_file.rstrip('.json.v1') if not vfs.exists(reference_file): continue try: file_info = json.loads( __sx__.noNull(vfs.File(json_file).read()) ) except Exception, e: xbmc.log("%s: %s" % (json_file, str(e))) else: if 'type' in file_info and file_info['type'] == 'local_copy': file_info['file'] = reference_file file_info['file_type'] = reference_file.split('.').pop() file_info['json_file'] = json_file yield {file_info['file_name']:file_info}
def __findEpgidLocalCopies(self, local_path): for file_name in vfs.listdir(local_path)[1]: if file_name.endswith('.json.v1'): json_file = vfs.path.join(local_path, file_name) reference_file = json_file.rstrip('.json.v1') if not vfs.exists(reference_file): continue try: file_info = json.loads( __sx__.noNull(vfs.File(json_file).read())) except Exception, e: xbmc.log("%s: %s" % (json_file, str(e))) else: if 'type' in file_info and file_info[ 'type'] == 'local_copy': file_info['file'] = reference_file file_info['file_type'] = reference_file.split( '.').pop() file_info['json_file'] = json_file yield {file_info['file_name']: file_info}