summaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authornicholas <nicholas@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2007-02-10 13:23:10 +0000
committernicholas <nicholas@f01d2545-417e-4e96-918e-98f8d0dbbcb6>2007-02-10 13:23:10 +0000
commit4f1a049d82d94fd0fba6a2de3c7662c9e78441f9 (patch)
tree4cd9daa5bb406c4de48fff3deb46a2761a7b827b /bindings
parentad2d6ed9d8e6bad2680a98d20020f7c9ff371e72 (diff)
downloadlibgpod-4f1a049d82d94fd0fba6a2de3c7662c9e78441f9.tar.gz
libgpod-4f1a049d82d94fd0fba6a2de3c7662c9e78441f9.tar.xz
libgpod-4f1a049d82d94fd0fba6a2de3c7662c9e78441f9.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: