From 6dd21d791ef5643d9e12a4f7fe9febb75c71d0e8 Mon Sep 17 00:00:00 2001 From: Johannes Dewender Date: Sun, 6 Oct 2013 01:32:54 +0200 Subject: [PATCH] also test for success in track class --- discid/track.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/discid/track.py b/discid/track.py index ef9c274..d937b29 100644 --- a/discid/track.py +++ b/discid/track.py @@ -42,12 +42,18 @@ def __str__(self): _LIB.discid_get_track_offset.argtypes = (c_void_p, c_int) _LIB.discid_get_track_offset.restype = c_int def _get_track_offset(self): - return _LIB.discid_get_track_offset(self._disc._handle, self.number) + if self._disc._success: + return _LIB.discid_get_track_offset(self._disc._handle, self.number) + else: + return None _LIB.discid_get_track_length.argtypes = (c_void_p, c_int) _LIB.discid_get_track_length.restype = c_int def _get_track_length(self): - return _LIB.discid_get_track_length(self._disc._handle, self.number) + if self._disc._success: + return _LIB.discid_get_track_length(self._disc._handle, self.number) + else: + return None try: _LIB.discid_get_track_isrc.argtypes = (c_void_p, c_int)