From 5fb3e2f167ba4a742dc84ed58ddd68c8374a1195 Mon Sep 17 00:00:00 2001 From: mikeos Date: Mon, 30 Sep 2013 04:04:18 +0400 Subject: formats: make tag method optional --- cutter | 4 ++++ formats/__base__.py | 3 +++ formats/wav.py | 4 ---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cutter b/cutter index 8112c27..d3d8890 100755 --- a/cutter +++ b/cutter @@ -351,6 +351,7 @@ class CueSplitter: self.tracktotal = len(list(self.all_tracks())) self.enctype = formats.handler(opt.type, logger=printf) + self.tag_supported = self.enctype.is_tag_supported() self.tags = { "album": self.opt.album or self.cue.get("title"), @@ -448,6 +449,9 @@ class CueSplitter: return self.track_info[track].tags def tag(self, track, path): + if not self.tag_supported: + return + printf("Tag [%s] : ", path) if not self.enctype.tag(path, self.track_tags(track)): printf("FAILED\n") diff --git a/formats/__base__.py b/formats/__base__.py index 4bb6598..f17748a 100644 --- a/formats/__base__.py +++ b/formats/__base__.py @@ -23,3 +23,6 @@ class BaseHandler: self.add("-b %d" % opt.bits_per_sample) if opt.channels and opt.channels != info.channels: self.add("-c %d" % opt.channels) + + def is_tag_supported(self): + return hasattr(self, "tag") diff --git a/formats/wav.py b/formats/wav.py index 76c2ed3..66169fc 100644 --- a/formats/wav.py +++ b/formats/wav.py @@ -11,9 +11,5 @@ class WavHandler(BaseHandler): return self.build() - def tag(self, *args): - self.log("SKIP ") - return True - def init(): return WavHandler -- cgit v1.2.3-70-g09d2