Author: tack
Date: Thu Dec  7 02:31:52 2006
New Revision: 2170

Modified:
   trunk/metadata/bin/mminfo
   trunk/metadata/src/mediainfo.py

Log:
Format output in a tree style.


Modified: trunk/metadata/bin/mminfo
==============================================================================
--- trunk/metadata/bin/mminfo   (original)
+++ trunk/metadata/bin/mminfo   Thu Dec  7 02:31:52 2006
@@ -90,11 +90,10 @@
     medium = kaa.metadata.parse(file)
     print
     if len(file) > 70:
-        print "filename : %s[...]%s" % (file[:30], file[len(file)-30:])
+        print "%s[...]%s" % (file[:30], file[len(file)-30:])
     else:
-        print "    filename: %s" % file
+        print "%s" % file
     if medium:
         print medium
-        print
     else:
         print "No Match found"

Modified: trunk/metadata/src/mediainfo.py
==============================================================================
--- trunk/metadata/src/mediainfo.py     (original)
+++ trunk/metadata/src/mediainfo.py     Thu Dec  7 02:31:52 2006
@@ -31,6 +31,7 @@
 
 # python imports
 import os
+import re
 import logging
 import copy
 import sys
@@ -125,18 +126,21 @@
                 continue
             if key in UNPRINTABLE_KEYS:
                 value = '<unprintable data>'
-            result += u'  %10s: %s\n' % (unicode(key), unicode(value))
+            result += u'| %10s: %s\n' % (unicode(key), unicode(value))
 
         # print lists
         for key, l in lists:
-            result += u'\n  %5s list:' % key
-            for item in l:
-                result += '\n    ' + unicode(item).replace('\n', '\n    ') + 
u'\n'
+            for n, item in enumerate(l):
+                label = '+-- ' + key.rstrip('s').capitalize()
+                if key != 'tracks':
+                    label += ' Track'
+                result += u'%s #%d\n' % (label, n+1)
+                result += '|    ' + re.sub(r'\n(.)', r'\n|    \1', 
unicode(item))
 
         # print tables
         if log.level >= 10:
             for name, table in self._tables.items():
-                result += '\n\n    Table %s' % str(name)
+                result += '+-- Table %s\n' % str(name)
                 for key, value in table.items():
                     try:
                         value = unicode(value)
@@ -144,7 +148,7 @@
                             value = '<unprintable data>'
                     except UnicodeDecodeError:
                         value = '<unprintable data>'
-                    result += '\n        %s: %s' % (unicode(key), 
unicode(value))
+                    result += u'|    | %s: %s\n' % (unicode(key), 
unicode(value))
         return result
 
 

-------------------------------------------------------------------------
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