summaryrefslogtreecommitdiff
path: root/cue.py
diff options
context:
space:
mode:
authormikeos <mike.osipov@gmail.com>2013-07-22 23:32:55 +0400
committermikeos <mike.osipov@gmail.com>2013-07-22 23:32:55 +0400
commit7410948eb8a5fcf386d66c4ac3d60bd935255606 (patch)
treec1125a96fa40eee869f300a0c5321c6d4e266844 /cue.py
parent2ac973dc16c036dba9cb4ad284c22d4a14d4b1ca (diff)
new tag options composer and albumartist, extended dump option
Diffstat (limited to 'cue.py')
-rw-r--r--cue.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/cue.py b/cue.py
index 493bee9..4239084 100644
--- a/cue.py
+++ b/cue.py
@@ -27,7 +27,9 @@ class Track:
return sort_iter(self._indexes)
def get(self, attr):
- return self._attrs.get(attr)
+ return self._attrs.get(attr,
+ None if attr in ("pregap", "postgap") else ""
+ )
def isaudio(self):
return self.type == "AUDIO" and self.begin is not None
@@ -38,8 +40,8 @@ class File:
self.type = filetype
self._tracks = []
- def tracks(self, audio_only = False):
- return filter(Track.isaudio if audio_only else None, self._tracks)
+ def tracks(self, filter_audio = True):
+ return filter(Track.isaudio if filter_audio else None, self._tracks)
def add_track(self, track):
self._tracks.append(track)
@@ -48,12 +50,12 @@ class File:
return self.type == "WAVE"
def has_audio_tracks(self):
- return len(list(self.tracks(Track))) > 0
+ return len(list(self.tracks())) > 0
def split_points(self, info):
rate = info.sample_rate * info.bits_per_sample * info.channels // 8
- for track in list(self.tracks(True))[1:]:
+ for track in list(self.tracks())[1:]:
yield rate * track.begin // 75
def __repr__(self):
@@ -67,11 +69,11 @@ class Cue:
def attrs(self):
return sort_iter(self._attrs)
- def files(self, audio_only = False):
- return filter(File.isaudio if audio_only else None, self._files)
+ def files(self, filter_audio = True):
+ return filter(File.isaudio if filter_audio else None, self._files)
def get(self, attr):
- return self._attrs.get(attr)
+ return self._attrs.get(attr, "")
def add_file(self, file):
self._files.append(file)