From 135cc9ce05f32d537ac53ba1d06b4f9e3c05a97d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20=E2=80=9CFreso=E2=80=9D=20S=2E=20Olesen?= Date: Mon, 18 Mar 2019 12:15:28 +0100 Subject: [PATCH] Include MusicBrainz Release URL in log output (#382) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Include MusicBrainz Release URL in log output This also passes *all* metadata to the `result` object, giving loggers a lot more (release) metadata to work with, in case custom, “3rd party” loggers (or even ourselves in the future!) want to do something more fancy or expansive with the metadata in the log file. Fixes https://github.com/whipper-team/whipper/issues/381 Signed-off-by: Frederik “Freso” S. Olesen * Uppercase "url" in output: "URL" Signed-off-by: Frederik “Freso” S. Olesen --- whipper/command/cd.py | 1 + whipper/result/logger.py | 5 ++++- whipper/result/result.py | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/whipper/command/cd.py b/whipper/command/cd.py index 0843876..f32c115 100644 --- a/whipper/command/cd.py +++ b/whipper/command/cd.py @@ -182,6 +182,7 @@ class _CD(BaseCommand): _, self.program.result.vendor, self.program.result.model, \ self.program.result.release = \ cdio.Device(self.device).get_hwinfo() + self.program.result.metadata = self.program.metadata self.doCommand() diff --git a/whipper/result/logger.py b/whipper/result/logger.py index 5858b59..40c9c84 100644 --- a/whipper/result/logger.py +++ b/whipper/result/logger.py @@ -70,8 +70,11 @@ class WhipperLogger(result.Logger): lines.append(" CDDB Disc ID: %s" % ripResult. table.getCDDBDiscId()) lines.append(" MusicBrainz Disc ID: %s" % ripResult. table.getMusicBrainzDiscId()) - lines.append(" MusicBrainz lookup url: %s" % + lines.append(" MusicBrainz lookup URL: %s" % ripResult. table.getMusicBrainzSubmitURL()) + if ripResult.metadata: + lines.append(" MusicBrainz Release URL: %s" % + ripResult.metadata.url) lines.append("") # TOC section diff --git a/whipper/result/result.py b/whipper/result/result.py index 265514c..35af580 100644 --- a/whipper/result/result.py +++ b/whipper/result/result.py @@ -72,6 +72,8 @@ class RipResult: @ivar offset: sample read offset @ivar table: the full index table @type table: L{whipper.image.table.Table} + @ivar metadata: disc metadata from MusicBrainz (if available) + @type metadata: L{whipper.common.mbngs.DiscMetadata} @ivar vendor: vendor of the CD drive @ivar model: model of the CD drive @@ -88,6 +90,7 @@ class RipResult: table = None artist = None title = None + metadata = None vendor = None model = None