Update of /cvsroot/gtkpod/libgpod/bindings/python
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv25551

Modified Files:
        ipod.py 
Log Message:
Cope with invalid/not available mp3 tags

Index: ipod.py
===================================================================
RCS file: /cvsroot/gtkpod/libgpod/bindings/python/ipod.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ipod.py     14 Jan 2007 21:40:16 -0000      1.11
+++ ipod.py     10 Feb 2007 13:23:10 -0000      1.12
@@ -315,23 +315,34 @@
                                  ('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:


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to