Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions whipper/command/cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ def _ripIfNotRipped(number):
except accurip.EntryNotFound:
logger.warning('AccurateRip entry not found')

accurip.log_notfound_crcs(self.program.result)
accurip.print_report(self.program.result)

self.program.writeLog(discName, self.logger)
Expand Down
33 changes: 25 additions & 8 deletions whipper/common/accurip.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import os
from urllib.error import URLError, HTTPError
from urllib.request import urlopen, Request
from ruamel.yaml.comments import CommentedMap as OrderedDict

from whipper.program.arc import accuraterip_checksum

Expand Down Expand Up @@ -211,8 +212,18 @@ def verify_result(result, responses, checksums):
return _match_responses(tracks, responses)


def print_report(result):
def log_notfound_crcs(result):
"""Generate log messages for any failed tracks"""
for _, track in enumerate(result.tracks):
if track.number == 0:
continue
if not (track.AR['v1']['CRC'] or track.AR['v2']['CRC']):
logger.error('no track AR CRC on non-HTOA track %d', track.number)


def generate_report(result):
"""Print AccurateRip verification results."""
report = OrderedDict()
for _, track in enumerate(result.tracks):
status = 'rip NOT accurate'
conf = '(not found)'
Expand All @@ -237,13 +248,19 @@ def print_report(result):
)
# htoa tracks (i == 0) do not have an ARCRC
if track.number == 0:
print('track 0: unknown (not tracked)')
report['Track 0'] = 'unknown (not tracked)'
continue
if not (track.AR['v1']['CRC'] or track.AR['v2']['CRC']):
logger.error('no track AR CRC on non-HTOA track %d', track.number)
print('track %2d: unknown (error)' % track.number)
report['Track %2d' % track.number] = 'unknown (error)'
else:
print('track %2d: %-16s %-23s v1 [%s], v2 [%s], DB [%s]' % (
track.number, status, conf,
track.AR['v1']['CRC'], track.AR['v2']['CRC'], db
))
report['Track %2d' % track.number] = '%-16s %-23s v1 [%s], v2 [%s], DB [%s]' % (
status, conf, track.AR['v1']['CRC'], track.AR['v2']['CRC'], db
)
return report


def print_report(result):
"""Generate and print AccurateRip verification results summary."""
report = generate_report(result)
for key, item in report.items():
print('%s: %s' % (key.lower(), item))
6 changes: 5 additions & 1 deletion whipper/result/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import whipper

from whipper.common import common
from whipper.common import accurip, common
from whipper.common.yaml import YAML
from whipper.result import result

Expand Down Expand Up @@ -116,6 +116,10 @@ def logRip(self, ripResult, epoch):
duration += t.testduration + t.copyduration
riplog["Tracks"] = data

# Track Summary section
data = accurip.generate_report(ripResult)
riplog["Track Summary"] = data

# Status report
data = OrderedDict()
if self._inARDatabase == 0:
Expand Down