Remove erronous unsupported file formats from tagger

This commit is contained in:
Sambhav Kothari
2017-01-13 18:14:01 +05:30
parent 2ae52fe1d8
commit 4e5f477158
2 changed files with 6 additions and 8 deletions

View File

@@ -108,6 +108,12 @@ class File(QtCore.QObject, Item):
if error is not None:
self.error = str(error)
self.state = self.ERROR
from picard.formats import supported_extensions
file_name, file_extension = os.path.splitext(self.base_filename)
if file_extension not in supported_extensions():
self.remove()
log.error('Unsupported media file {} wrongly loaded. Removing ...'.format(self))
return
else:
self.error = None
self.state = self.NORMAL

View File

@@ -118,14 +118,6 @@ class MP4File(File):
file.add_tags()
metadata = Metadata()
if not tags:
# MPEG-4 file in an mov container is unsupported and is one of
# the formats which returns a positive score in guess_format method
# If we are unable to add tags, it is not a supported mp4 file
# remove it and log an error
log.error("Unable to load tags for file {}".format(self))
self.remove()
return metadata
for name, values in tags.items():
if name in self.__text_tags: