Author: duncan
Date: Thu Jan 18 20:16:49 2007
New Revision: 8997

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

Log:
Finally this is now looking correct, when the
runtime is 0 then take the length from the file


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        Thu Jan 18 20:16:49 2007
@@ -234,42 +234,31 @@
                         length *= 60 + int(m.group(2))
                 else:
                     length = 0
-                # leaving in the old code for reference
-                #if not length or length == 'None':
-                #    length = '0 min'
-                #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 = "%s min" % str(int(length))
-
-            elif self.subitems:
-                for s in self.subitems:
-                    if s.info['length']:
-                        length = s.info['length']
-                    if not length and hasattr(s, 'length'):
-                        length = s.length
-                    if not length:
-                        continue
-                    try:
-                        total += length
-                    except ValueError, TypeError:
-                        pass
-                total = "%s min" % str(int(total / 60))
+                total = '%s min' % str(int(length))
 
-            else:
-                if self.info['length']:
-                    total = self.info['length']
-                elif hasattr(self, 'length'):
-                    total = self.length
-                total = "%s min" % str(int(total / 60))
+            if length == 0:
+                if self.subitems:
+                    for s in self.subitems:
+                        if s.info['length']:
+                            length = s.info['length']
+                        if not length and hasattr(s, 'length'):
+                            length = s.length
+                        if not length:
+                            continue
+                        try:
+                            total += length
+                        except ValueError, TypeError:
+                            pass
+                    total = "%s min" % str(int(total / 60))
 
-            return total
+                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
 
         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