validate: Add an option to update all .media_info files

This commit is contained in:
Thibault Saunier 2014-11-19 17:58:23 +01:00
parent 11c49a7db8
commit 65eb14de36
2 changed files with 7 additions and 2 deletions

View file

@ -538,13 +538,15 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""")
fpath, GstValidateMediaDescriptor.MEDIA_INFO_EXT) fpath, GstValidateMediaDescriptor.MEDIA_INFO_EXT)
args = G_V_DISCOVERER_COMMAND.split(" ") args = G_V_DISCOVERER_COMMAND.split(" ")
args.append(uri) args.append(uri)
if os.path.isfile(media_info): if os.path.isfile(media_info) and not self.options.update_media_info:
self._add_media(media_info, uri) self._add_media(media_info, uri)
return True return True
elif fpath.endswith(GstValidateMediaDescriptor.STREAM_INFO_EXT): elif fpath.endswith(GstValidateMediaDescriptor.STREAM_INFO_EXT):
self._add_media(fpath) self._add_media(fpath)
return True return True
elif not self.options.generate_info: elif not self.options.generate_info and not self.options.update_media_info:
return True
elif self.options.update_media_info and not os.path.isfile(media_info):
return True return True
media_descriptor = GstValidateMediaDescriptor.new_from_uri( media_descriptor = GstValidateMediaDescriptor.new_from_uri(

View file

@ -223,6 +223,9 @@ def main(libsdir):
parser.add_argument("-g", "--generate-media-info", dest="generate_info", parser.add_argument("-g", "--generate-media-info", dest="generate_info",
action="store_true", default=False, action="store_true", default=False,
help="Set it in order to generate the missing .media_infos files") help="Set it in order to generate the missing .media_infos files")
parser.add_argument("--update-media-info", dest="update_media_info",
action="store_true", default=False,
help="Set it in order to update exising .media_infos files")
parser.add_argument( parser.add_argument(
"-G", "--generate-media-info-with-frame-detection", dest="generate_info_full", "-G", "--generate-media-info-with-frame-detection", dest="generate_info_full",
action="store_true", default=False, action="store_true", default=False,