fix image verify:
- accurip.py: raise exception if accuraterip db entry not found - program.py: verify image with only one table, remove redundant check
This commit is contained in:
@@ -36,6 +36,10 @@ ACCURATERIP_URL = "http://www.accuraterip.com/accuraterip/"
|
||||
_CACHE_DIR = join(directory.cache_path(), 'accurip')
|
||||
|
||||
|
||||
class EntryNotFound(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class _AccurateRipResponse(object):
|
||||
"""
|
||||
An AccurateRip response contains a collection of metadata identifying a
|
||||
@@ -175,7 +179,8 @@ def get_db_entry(path):
|
||||
if raw_entry:
|
||||
_save_entry(raw_entry, cached_path)
|
||||
if not raw_entry:
|
||||
return None
|
||||
logger.warning('entry not found in AccurateRip database')
|
||||
raise EntryNotFound
|
||||
return _split_responses(raw_entry)
|
||||
|
||||
|
||||
|
||||
@@ -558,9 +558,9 @@ class Program:
|
||||
t = image.ImageRetagTask(cueImage, taglists)
|
||||
runner.run(t)
|
||||
|
||||
def verifyImage(self, runner, ittoc, itable):
|
||||
def verifyImage(self, runner, table):
|
||||
"""
|
||||
verify ittoc against accuraterip and cue_path track lengths
|
||||
verify table against accuraterip and cue_path track lengths
|
||||
Verify our image against the given AccurateRip responses.
|
||||
|
||||
Needs an initialized self.result.
|
||||
@@ -576,19 +576,9 @@ class Program:
|
||||
logger.error(verifytask.exceptionMessage)
|
||||
return False
|
||||
|
||||
responses = accurip.get_db_entry(ittoc.accuraterip_path())
|
||||
if not responses:
|
||||
logger.warning('album not found in AccurateRip database')
|
||||
return False
|
||||
responses = accurip.get_db_entry(table.accuraterip_path())
|
||||
logger.info('%d AccurateRip response(s) found' % len(responses))
|
||||
|
||||
for r in responses:
|
||||
if r.cddbDiscId != itable.getCDDBDiscId():
|
||||
logger.error(
|
||||
'AccurateRip response discid differs: %s' % r.cddbDiscId
|
||||
)
|
||||
return False
|
||||
|
||||
checksums = accurip.calculate_checksums([
|
||||
os.path.join(os.path.dirname(self.cuePath), t.indexes[1].path)
|
||||
for t in filter(lambda t: t.number != 0, cueImage.cue.table.tracks)
|
||||
|
||||
Reference in New Issue
Block a user