From a758ea5dfdb64b2e2719e1f34380fa396ebab3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20=E2=80=9CFreso=E2=80=9D=20S=2E=20Olesen?= Date: Sat, 16 Mar 2019 12:01:07 +0100 Subject: [PATCH 1/2] Include MusicBrainz Release URL in log output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- whipper/command/cd.py | 1 + whipper/result/logger.py | 3 +++ whipper/result/result.py | 3 +++ 3 files changed, 7 insertions(+) diff --git a/whipper/command/cd.py b/whipper/command/cd.py index 08438763..f32c115e 100644 --- a/whipper/command/cd.py +++ b/whipper/command/cd.py @@ -182,6 +182,7 @@ def do(self): _, 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 5858b59a..9f8fb3a7 100644 --- a/whipper/result/logger.py +++ b/whipper/result/logger.py @@ -72,6 +72,9 @@ def logRip(self, ripResult, epoch): ripResult. table.getMusicBrainzDiscId()) 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 265514ce..35af5804 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 From 8133c1c7e33f1a295b901db4f5b56871c1a06035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20=E2=80=9CFreso=E2=80=9D=20S=2E=20Olesen?= Date: Sun, 17 Mar 2019 18:37:05 +0100 Subject: [PATCH 2/2] Uppercase "url" in output: "URL" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Frederik “Freso” S. Olesen --- whipper/result/logger.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/whipper/result/logger.py b/whipper/result/logger.py index 9f8fb3a7..40c9c84a 100644 --- a/whipper/result/logger.py +++ b/whipper/result/logger.py @@ -70,10 +70,10 @@ def logRip(self, ripResult, epoch): 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" % + lines.append(" MusicBrainz Release URL: %s" % ripResult.metadata.url) lines.append("")