def parseVideos(paths): for a in jsonObjectParse(paths): for key in a.keys(): parseVideos.keys.add(key) vids = a.get('VideoFile', None) # skip "video" with no file if vids is None: continue if list(vids) == vids and any(not os.path.exists(expand_path(b, os.path.dirname(paths))) for b in vids): continue if list(vids) != vids and not os.path.exists(expand_path(vids, os.path.dirname(paths))): continue yield Video(a, os.path.dirname(paths))
def __getitem__(self, arg): if arg in Video.PATH_ATTRS: if arg not in self.attrs.keys(): if self.hasSeries(): return self.getSeries()[arg] return None stuff = self.attrs[arg] # can have multiple files for Videos # or for subtitles if list(stuff) == stuff: data = [] for a in stuff: data.append(expand_path(a, self.folder)) return data return expand_path(self.attrs[arg], self.folder) tmp = self.attrs.get(arg,None) if tmp is None and self.hasSeries(): return self.getSeries()[arg] return tmp
def findVideosFolders(path): folder = expand_path(path, os.path.abspath(os.sep)) for dirpath, subdirs, files in os.walk(folder): if CONFIG_FILE in files: continue if checkForVideo(files): yield dirpath # yield folders that do not have config files # but have video files pass
def findDBs(top_folder): folder = expand_path(top_folder, os.path.abspath(os.sep)) for dirpath, subdirs, files in os.walk(folder): if CONFIG_FILE in files: yield path_join(folder, dirpath, CONFIG_FILE)