summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorNicholas Piper <nicholas@users.sourceforge.net>2007-02-10 13:23:10 +0000
committerNicholas Piper <nicholas@users.sourceforge.net>2007-02-10 13:23:10 +0000
commitb674171ba297607f6dff150bef14929214730b9e (patch)
tree4cd9daa5bb406c4de48fff3deb46a2761a7b827b /bindings
parentec6de65e952b839e39e4e172e89b3002534ab3fa (diff)
downloadlibgpod-b674171ba297607f6dff150bef14929214730b9e.tar.gz
libgpod-b674171ba297607f6dff150bef14929214730b9e.tar.xz
libgpod-b674171ba297607f6dff150bef14929214730b9e.zip
Cope with invalid/not available mp3 tags
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1392 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'bindings')
-rw-r--r--bindings/python/ipod.py37
1 files changed, 24 insertions, 13 deletions
diff --git a/bindings/python/ipod.py b/bindings/python/ipod.py
index 1d02f69..3917e2c 100644
--- a/bindings/python/ipod.py
+++ b/bindings/python/ipod.py
@@ -315,23 +315,34 @@ class Track:
('getBPM','BPM'),
('getPlayCount','playcount'),
('getAlbum','album')):
- value = getattr(tag,func)()
- if value:
- self[attrib] = value
+ try:
+ value = getattr(tag,func)()
+ if value:
+ self[attrib] = value
+ except AttributeError:
+ pass
+ if self['title'] is None:
+ self['title'] = filename
try:
self['genre'] = tag.getGenre().name
except AttributeError:
pass
- disc, of = tag.getDiscNum()
- if disc is not None:
- self['cd_nr'] = disc
- if of is not None:
- self['cds'] = of
- n, of = tag.getTrackNum()
- if n is not None:
- self['track_nr'] = n
- if of is not None:
- self['tracks'] = of
+ try:
+ disc, of = tag.getDiscNum()
+ if disc is not None:
+ self['cd_nr'] = disc
+ if of is not None:
+ self['cds'] = of
+ except AttributeError:
+ pass
+ try:
+ n, of = tag.getTrackNum()
+ if n is not None:
+ self['track_nr'] = n
+ if of is not None:
+ self['tracks'] = of
+ except AttributeError:
+ pass
self['tracklen'] = audiofile.getPlayTime() * 1000
self.set_podcast(podcast)
elif proxied_track: