validate:launcher: handle file path in --medias-paths
authorVineeth TM <vineeth.tm@samsung.com>
Wed, 22 Jul 2015 06:20:54 +0000 (15:20 +0900)
committerLuis de Bethencourt <luis@debethencourt.com>
Wed, 22 Jul 2015 15:35:49 +0000 (16:35 +0100)
right now --medias-paths accepts only directories. Added support to
accept file path as well.

https://bugzilla.gnome.org/show_bug.cgi?id=752692

validate/launcher/apps/gstvalidate.py

index af35e49..0a5f004 100644 (file)
@@ -667,15 +667,18 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""")
                 self.options.paths = [os.path.join(self.options.paths)]
 
             for path in self.options.paths:
-                for root, dirs, files in os.walk(path):
-                    for f in files:
-                        fpath = os.path.join(path, 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)
+                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.join(path, 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)