Author: duncan
Date: Fri Dec 29 15:03:26 2006
New Revision: 8857

Modified:
   branches/rel-1/freevo/src/video/videoitem.py

Log:
[ 1621220 ] Sum length of subitems and manual aspect
Patch from Gorka Olaizola applied


Modified: branches/rel-1/freevo/src/video/videoitem.py
==============================================================================
--- branches/rel-1/freevo/src/video/videoitem.py        (original)
+++ branches/rel-1/freevo/src/video/videoitem.py        Fri Dec 29 15:03:26 2006
@@ -218,34 +218,26 @@
                 return aspect
             
         if key == 'runtime':
-            length = None
+            total = ''
+
+            if self.info['runtime']:
 
-            if self.info['runtime'] and self.info['runtime'] != 'None':
                 length = self.info['runtime']
-            elif self.info['length'] and self.info['length'] != 'None':
-                length = self.info['length']
-            if not length and hasattr(self, 'length'):
-                length = self.length
-            if not length:
-                return ''
-
-            try:
-                total = int(length)
-            except ValueError:
-                length = 0
-                total = 0
 
-            if self.subitems:
+                if length.find('min') == -1:
+                    length = '%s min' % length
+                if length.find('/') > 0:
+                    length = length[:length.find('/')].rstrip()
+                if length.find(':') > 0:
+                    length = length[length.find(':')+1:]
+                if length == '0 min':
+                    length = ''
+
+                total = length
+
+            elif self.subitems:
+                total = 0
                 for s in self.subitems:
-                    if s.info['runtime']:
-                        length = s.info['runtime']
-                        try:
-                            minpos = length.find('min') - 1
-                            if minpos >= 0:
-                                total = int(length[:minpos]) * 60
-                        except TypeError:
-                            pass
-                        break
                     if s.info['length']:
                         length = s.info['length']
                     if not length and hasattr(s, 'length'):
@@ -257,17 +249,19 @@
                     except ValueError, TypeError:
                         pass
 
-            length = str(total / 60)
+                total = "%s min" % str(int(total / 60))
+
+            else:
+
+                if self.info['length']:
+                    total = self.info['length']
+                elif hasattr(self, 'length'):
+                    total = self.length
+
+                total = "%s min" % str(int(total / 60))
+
+            return total
 
-            if length.find('min') == -1:
-                length = '%s min' % length
-            if length.find('/') > 0:
-                length = length[:length.find('/')].rstrip()
-            if length.find(':') > 0:
-                length = length[length.find(':')+1:]
-            if length == '0 min':
-                return ''
-            return length
 
         return Item.__getitem__(self, key)
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to