コード例 #1
0
ファイル: video_viewer.py プロジェクト: Ben0mega/VideoViewer
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))
コード例 #2
0
ファイル: video.py プロジェクト: Ben0mega/VideoViewer
	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
コード例 #3
0
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
コード例 #4
0
ファイル: video_viewer.py プロジェクト: Ben0mega/VideoViewer
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)