def _list_uris(self): if self._uris: return self._uris if self.options.validate_uris: for uri in self.options.validate_uris: self._discover_file(uri, uri) return self._uris if not self.args: if isinstance(self.options.paths, str): self.options.paths = [os.path.join(self.options.paths)] for path in self.options.paths: if os.path.isfile(path): self._discover_file(path2url(path), path) else: for root, dirs, files in os.walk(path): for f in files: fpath = os.path.abspath(os.path.join(root, f)) if os.path.isdir(fpath) or \ fpath.endswith(GstValidateMediaDescriptor.MEDIA_INFO_EXT) or\ fpath.endswith(ScenarioManager.FILE_EXTENSION): continue else: self._discover_file(path2url(fpath), fpath) self.debug("Uris found: %s", self._uris) return self._uris
def register_defaults(self, project_paths=None): projects = list() if not self.args: if project_paths == None: path = self.options.projects_paths else: path = project_paths for root, dirs, files in os.walk(path): for f in files: if not f.endswith(".xges"): continue projects.append(utils.path2url(os.path.join(path, root, f))) else: for proj_uri in self.args: if not utils.isuri(proj_uri): proj_uri = utils.path2url(proj_uri) if os.path.exists(proj_uri): projects.append(proj_uri) if self.options.long_limit != 0: scenarios = ["none", "scrub_forward_seeking", "scrub_backward_seeking"] else: scenarios = ["play_15s", "scrub_forward_seeking_full", "scrub_backward_seeking_full"] for proj_uri in projects: # First playback casses project = XgesProjectDescriptor(proj_uri) for scenario_name in scenarios: scenario = self._scenarios.get_scenario(scenario_name) if scenario is None: continue if scenario.get_min_media_duration() >= (project.get_duration() / utils.GST_SECOND): continue classname = "playback.%s.%s" % (scenario.name, os.path.basename(proj_uri).replace(".xges", "")) self.add_test(GESPlaybackTest(classname, self.options, self.reporter, project, scenario=scenario) ) # And now rendering casses for comb in GES_ENCODING_TARGET_COMBINATIONS: classname = "render.%s.%s" % (str(comb).replace(' ', '_'), os.path.splitext(os.path.basename(proj_uri))[0]) self.add_test(GESRenderTest(classname, self.options, self.reporter, project, combination=comb) )
def quote_uri(uri): """Encodes a URI/path according to RFC 2396.""" # Split off the "file:///" part, if present. parts = urllib.parse.urlsplit(uri, allow_fragments=False) # Make absolutely sure the string is unquoted before quoting again! raw_path = unquote(parts.path) return utils.path2url(raw_path)
def quote_uri(uri): """ Encode a URI/path according to RFC 2396, without touching the file:/// part. """ # Split off the "file:///" part, if present. parts = urllib.parse.urlsplit(uri, allow_fragments=False) # Make absolutely sure the string is unquoted before quoting again! raw_path = unquote(parts.path) return utils.path2url(raw_path)
def set_rendering_info(self): self.dest_file = os.path.join( self.options.dest, self.classname.replace(".transcode.", os.sep).replace(".", os.sep)) mkdir(os.path.dirname(urlparse.urlsplit(self.dest_file).path)) if urlparse.urlparse(self.dest_file).scheme == "": self.dest_file = path2url(self.dest_file) profile = self.get_profile() self.add_arguments("-o", profile)
def set_rendering_info(self): self.dest_file = os.path.join(self.options.dest, self.classname.replace(".transcode.", os.sep). replace(".", os.sep)) mkdir(os.path.dirname(urlparse.urlsplit(self.dest_file).path)) if urlparse.urlparse(self.dest_file).scheme == "": self.dest_file = path2url(self.dest_file) profile = self.get_profile() self.add_arguments("-o", profile)
def _set_rendering_info(self): self.dest_file = path = os.path.join(self.options.dest, self.classname.replace(".render.", os.sep). replace(".", os.sep)) utils.mkdir(os.path.dirname(urllib.parse.urlsplit(self.dest_file).path)) if not utils.isuri(self.dest_file): self.dest_file = utils.path2url(self.dest_file) profile = self.get_profile() self.add_arguments("-f", profile, "-o", self.dest_file)
def _set_rendering_info(self): self.dest_file = path = os.path.join( self.options.dest, self.classname.replace(".render.", os.sep).replace(".", os.sep)) utils.mkdir(os.path.dirname( urllib.parse.urlsplit(self.dest_file).path)) if not utils.isuri(self.dest_file): self.dest_file = utils.path2url(self.dest_file) profile = self.get_profile() self.add_arguments("-f", profile, "-o", self.dest_file)
def register_defaults(self, project_paths=None): projects = list() if not self.args: if project_paths == None: path = self.options.projects_paths else: path = project_paths for root, dirs, files in os.walk(path): for f in files: if not f.endswith(".xges"): continue projects.append(utils.path2url(os.path.join(path, root, f))) else: for proj_uri in self.args: if not utils.isuri(proj_uri): proj_uri = utils.path2url(proj_uri) if os.path.exists(proj_uri): projects.append(proj_uri) if self.options.long_limit != 0: scenarios = [ "none", "scrub_forward_seeking", "scrub_backward_seeking" ] else: scenarios = [ "play_15s", "scrub_forward_seeking_full", "scrub_backward_seeking_full" ] for proj_uri in projects: # First playback casses project = XgesProjectDescriptor(proj_uri) for scenario_name in scenarios: scenario = self._scenarios.get_scenario(scenario_name) if scenario is None: continue if scenario.get_min_media_duration() >= ( project.get_duration() / utils.GST_SECOND): continue classname = "playback.%s.%s" % ( scenario.name, os.path.basename(proj_uri).replace( ".xges", "")) self.add_test( GESPlaybackTest(classname, self.options, self.reporter, project, scenario=scenario)) # And now rendering casses for comb in GES_ENCODING_TARGET_COMBINATIONS: classname = "render.%s.%s" % (str(comb).replace( ' ', '_'), os.path.splitext(os.path.basename(proj_uri))[0]) self.add_test( GESRenderTest(classname, self.options, self.reporter, project, combination=comb))
def run_external_checks(self): reference_file_path = urllib.parse.urlsplit( self.media_descriptor.get_uri()).path + ".expected_result" if os.path.exists(reference_file_path): self.run_iqa_test(utils.path2url(reference_file_path))
def register_defaults(self, project_paths=None, scenarios_path=None): projects = list() all_scenarios = {} if not self.args: if project_paths == None: path = self.options.projects_paths else: path = project_paths for root, dirs, files in os.walk(path): for f in files: if not f.endswith(".xges"): continue projects.append(utils.path2url(os.path.join(path, root, f))) if self.options.scenarios_path: scenarios_path = self.options.scenarios_path if scenarios_path: for root, dirs, files in os.walk(scenarios_path): for f in files: name, ext = os.path.splitext(f) f = os.path.join(root, f) if ext == ".validatetest": fpath = os.path.abspath(os.path.join(root, f)) pathname = os.path.abspath(os.path.join( root, name)) name = pathname.replace( os.path.commonpath([scenarios_path, root]), '').replace('/', '.') self.add_test( GESTest('test' + name, self.options, self.reporter, None, testfile=fpath)) continue elif ext != ".scenario": continue config = f + ".config" if not os.path.exists(config): config = None all_scenarios[f] = config else: for proj_uri in self.args: if not utils.isuri(proj_uri): proj_uri = utils.path2url(proj_uri) if os.path.exists(proj_uri): projects.append(proj_uri) if self.options.long_limit != 0: scenarios = [ "none", "scrub_forward_seeking", "scrub_backward_seeking" ] else: scenarios = [ "play_15s", "scrub_forward_seeking_full", "scrub_backward_seeking_full" ] for proj_uri in projects: # First playback casses project = XgesProjectDescriptor(proj_uri) for scenario_name in scenarios: scenario = self._scenarios.get_scenario(scenario_name) if scenario is None: continue if scenario.get_min_media_duration() >= ( project.get_duration() / utils.GST_SECOND): continue classname = "playback.%s.%s" % ( scenario.name, os.path.basename(proj_uri).replace( ".xges", "")) self.add_test( GESPlaybackTest(classname, self.options, self.reporter, project, scenario=scenario, nest=False)) #For nested timelines classname = "playback.nested.%s.%s" % ( scenario.name, os.path.basename(proj_uri).replace( ".xges", "")) self.add_test( GESPlaybackTest(classname, self.options, self.reporter, project, scenario=scenario, nest=True)) # And now rendering casses for comb in GES_ENCODING_TARGET_COMBINATIONS: classname = "render.%s.%s" % (str(comb).replace( ' ', '_'), os.path.splitext(os.path.basename(proj_uri))[0]) self.add_test( GESRenderTest(classname, self.options, self.reporter, project, combination=comb)) if all_scenarios: for scenario in self._scenarios.discover_scenarios( list(all_scenarios.keys())): config = all_scenarios[scenario.path] classname = "scenario.%s" % scenario.name test = GESScenarioTest(classname, self.options, self.reporter, scenario=scenario) if config: test.add_validate_config(config) self.add_test(test)