mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-09 10:03:59 +00:00
Merge pull request #2367 from phw/handle-invalid-filesize
Handle exceptions if ~filesize is not numeric
This commit is contained in:
@@ -826,7 +826,10 @@ class File(QtCore.QObject, Item):
|
||||
if not value and not get_config().setting['clear_existing_tags']:
|
||||
value = self.orig_metadata[column]
|
||||
if column == '~filesize':
|
||||
value = bytes2human.binary(value)
|
||||
try:
|
||||
value = bytes2human.binary(value)
|
||||
except ValueError:
|
||||
pass
|
||||
return value
|
||||
|
||||
def _lookup_finished(self, lookuptype, document, http, error):
|
||||
|
||||
@@ -287,7 +287,10 @@ def format_file_info(file_):
|
||||
info.append((_("Format:"), file_.orig_metadata['~format']))
|
||||
if '~filesize' in file_.orig_metadata:
|
||||
size = file_.orig_metadata['~filesize']
|
||||
sizestr = "%s (%s)" % (bytes2human.decimal(size), bytes2human.binary(size))
|
||||
try:
|
||||
sizestr = "%s (%s)" % (bytes2human.decimal(size), bytes2human.binary(size))
|
||||
except ValueError:
|
||||
sizestr = _("unknown")
|
||||
info.append((_("Size:"), sizestr))
|
||||
if file_.orig_metadata.length:
|
||||
info.append((_("Length:"), format_time(file_.orig_metadata.length)))
|
||||
|
||||
Reference in New Issue
Block a user