Author: duncan
Date: Thu Mar 15 20:08:58 2007
New Revision: 9330

Modified:
   branches/rel-1/freevo/freevo_config.py
   branches/rel-1/freevo/src/item.py
   branches/rel-1/freevo/src/skins/main/area.py
   branches/rel-1/freevo/src/skins/main/skin_utils.py
   branches/rel-1/freevo/src/util/mediainfo.py
   branches/rel-1/freevo/src/video/configure.py
   branches/rel-1/freevo/src/video/videoitem.py

Log:
[ 1677364 ] In mkv files, not able to select audio and subtitle track
Fixes applied


Modified: branches/rel-1/freevo/freevo_config.py
==============================================================================
--- branches/rel-1/freevo/freevo_config.py      (original)
+++ branches/rel-1/freevo/freevo_config.py      Thu Mar 15 20:08:58 2007
@@ -259,6 +259,9 @@
      Added VIDEO_PRE_PLAY and VIDEO_POST_PLAY to allow external commands to be 
run
      Added CD_RIP_ for the cd backup plug-in
      ''' ),
+    (5.18,
+     '''Added tv.recodings_manager plug-in to show what has been watched, 
TVRM_*,
+     ''' ),
 ]
 
 

Modified: branches/rel-1/freevo/src/item.py
==============================================================================
--- branches/rel-1/freevo/src/item.py   (original)
+++ branches/rel-1/freevo/src/item.py   Thu Mar 15 20:08:58 2007
@@ -479,7 +479,7 @@
 
         else:
             r = None
-            if self.info.has_key(attr):
+            if self.info and self.info.has_key(attr):
                 r = self.info[attr]
             if (r == None or r == '') and hasattr(self, attr):
                 r = getattr(self,attr)
@@ -500,5 +500,7 @@
         if attr[:4] == 'len(' and attr[-1] == ')':
             return self.__getitem__(attr)
         else:
-            r = self.__getitem__(attr)
-            return Unicode(r)
+            if self and self.__getitem__:
+                r = self.__getitem__(attr)
+                return Unicode(r)
+            return attr

Modified: branches/rel-1/freevo/src/skins/main/area.py
==============================================================================
--- branches/rel-1/freevo/src/skins/main/area.py        (original)
+++ branches/rel-1/freevo/src/skins/main/area.py        Thu Mar 15 20:08:58 2007
@@ -566,11 +566,9 @@
                         if os.path.isfile(cache) and \
                                os.stat(cache)[stat.ST_MTIME] > \
                                os.stat(imagefile)[stat.ST_MTIME]:
-                            f = open(cache, 'r')
-                            image = 
pygame.image.fromstring(str().join(f.readlines()),
-                                                            
(bg.width,bg.height), 'RGBA')
-                            f.close()
+                            image = 
pygame.image.fromstring(file(cache).read(), (bg.width,bg.height), 'RGBA')
                             self.imagecache[cname] = image
+
                     if not image:
                         image = osd.loadbitmap(imagefile)
                         if image:

Modified: branches/rel-1/freevo/src/skins/main/skin_utils.py
==============================================================================
--- branches/rel-1/freevo/src/skins/main/skin_utils.py  (original)
+++ branches/rel-1/freevo/src/skins/main/skin_utils.py  Thu Mar 15 20:08:58 2007
@@ -68,7 +68,7 @@
     cname = '%s-%s-%s-%s-%s-%s-%s' % (settings.icon_dir, item.image, type,
                                       item.type, width, height, force)
 
-    if item['rotation']:
+    if hasattr(item, 'rotation') and item['rotation']:
         cname = '%s-%s' % (cname, item['rotation'])
             
     if item.media and item.media.item == item:
@@ -100,10 +100,12 @@
                     orientation = tags['Image Orientation']
                     if str(orientation) == "Rotated 90 CCW":
                         item['rotation'] = 90
+                        #item['rotation'] = 270
                     elif str(orientation) == "Rotated 180":
                         item['rotation'] = 180
                     elif str(orientation) == "Rotated 90 CW":
                         item['rotation'] = 270
+                        #item['rotation'] = 90
             except Exception, e:
                 pass
 

Modified: branches/rel-1/freevo/src/util/mediainfo.py
==============================================================================
--- branches/rel-1/freevo/src/util/mediainfo.py (original)
+++ branches/rel-1/freevo/src/util/mediainfo.py Thu Mar 15 20:08:58 2007
@@ -32,9 +32,9 @@
 import os, stat
 import sys
 import copy
+from pprint import pformat
 
 import kaa.metadata as mmpython
-#from kaa.metadata.disc.discinfo import cdrom_disc_id
 
 import config
 import util
@@ -257,7 +257,7 @@
 
 class MMCache(Cache):
     """
-    cache for mmpython information
+    cache for kaa metadata information
     """
     def __init__(self):
         Cache.__init__(self, 'mmpython.cache')
@@ -266,20 +266,22 @@
 
     def simplify(self, object):
         """
-        mmpython has huge objects to cache, we don't need them.
+        kaa metadata has huge objects to cache, we don't need them.
         This function simplifies them to be only string, intger, dict or
         list of one of those above. This makes the caching much faster
+
+        kaa metadata has changed the definition of chapters and subtitles
         """
         ret = {}
         for k in object.keys():
             if not k in self.uncachable_keys and getattr(object,k) != None:
                 value = getattr(object,k)
                 if isstring(value):
-                    value = Unicode(value.replace('\0', '').lstrip().rstrip())
+                    value = Unicode(value.replace('\0', '').strip())
                 if value:
                     ret[k] = value
 
-        for k in  ( 'video', 'audio'):
+        for k in  ( 'video', 'audio', 'chapters', 'subtitles', 'tracks'):
             # if it's an AVCORE object, also simplify video and audio
             # lists to string and it
             if hasattr(object, k) and getattr(object, k):
@@ -287,8 +289,8 @@
                 for o in getattr(object, k):
                     ret[k].append(self.simplify(o))
 
-        for k in ('subtitles', 'chapters', 'mime', 'id', 'tracks' ):
-            if hasattr(object, k) and getattr(object, k):
+        for k in ('mime', 'name', 'pos' ):
+            if hasattr(object, k) and getattr(object, k) != None:
                 ret[k] = getattr(object, k)
 
         return ret
@@ -298,7 +300,6 @@
         """
         create mmpython information about the given file
         """
-        #info = mmpython.Factory().create(filename)
         info = mmpython.parse(filename)
         if info:
             thumbnail = None
@@ -338,7 +339,7 @@
 
     def update(self, filename, info):
         """
-        update mmpython cache information
+        update kaa metadata cache information
         """
         return self.create(filename)
 
@@ -596,7 +597,7 @@
 
 def disc_info(media, force=False):
     """
-    return mmpython disc information for the media
+    return kaa metadata disc information for the media
     """
     type, id = mmpython.cdrom.status(media.devicename)
     if not id:
@@ -686,7 +687,7 @@
 
 def del_cache():
     """
-    delete all cache files because mmpython got updated
+    delete all cache files because kaa metadata got updated
     """
     for f in util.recursefolders(config.OVERLAY_DIR,1,'mmpython.cache',1):
         os.unlink(f)
@@ -747,7 +748,7 @@
 
 
 #
-# setup mmpython
+# setup kaa metadata
 #
 
 if config.DEBUG > 2:
@@ -794,7 +795,7 @@
 
             elif kaa.metadata.version.VERSION > mmchanged:
                 print
-                print 'Warning: mmpython as changed.'
+                print 'Warning: kaa metadata as changed.'
                 print 'Please rerun \'freevo cache\' to get the latest updates'
                 print
                 del_cache()
@@ -806,7 +807,7 @@
                 print
     except:
         print
-        print 'Error: unable to read mmpython version information'
+        print 'Error: unable to read kaa metadata version information'
         print 'Please update kaa.metadata to the latest release or if you use'
         print 'Freevo svn versions, please also use kaa.metadata svn.'
         print

Modified: branches/rel-1/freevo/src/video/configure.py
==============================================================================
--- branches/rel-1/freevo/src/video/configure.py        (original)
+++ branches/rel-1/freevo/src/video/configure.py        Thu Mar 15 20:08:58 2007
@@ -29,14 +29,13 @@
 # -----------------------------------------------------------------------
 
 
+import re
+import copy
+
 # The menu widget class
 import menu
 import plugin
 
-# RegExp
-import re
-
-
 #
 # Dummy for playing the movie
 #
@@ -57,14 +56,16 @@
     item       = arg
     menu_items = []
 
-    for a in item.info['audio']:
-        print a.__dict__
-        #if not a.has_key('id') or a['id'] in ('', None):
-        #    a['id'] = item.info['audio'].index(a) + 1
-        
-        if a.has_key('languagedesc') and a['languagedesc']:
-            a['language'] = a['languagedesc']
-        elif not a.has_key('language') or not a['language']:
+    for audio in item.info['audio']:
+        a = copy.copy(audio)
+        
+        if not a.has_key('id') or not a['id']:
+            a['id'] = item.info['audio'].index(audio)
+
+        if not a.has_key('title') or not a['title']:
+            a['title'] = ''
+
+        if not a.has_key('language') or not a['language']:
             a['language'] = _('Stream %s') % a['id']
 
         if not a.has_key('channels') or not a['channels']:
@@ -73,7 +74,7 @@
         if not a.has_key('codec') or not a['codec']:
             a['codec'] = '???'
 
-        txt = '%(language)s (channels=%(channels)s:%(codec)s)' % a
+        txt = '%(language)s %(title)s (channels=%(channels)s:%(codec)s)' % a
         menu_items.append(menu.MenuItem(txt, audio_selection, (item, a['id'])))
 
     moviemenu = menu.Menu(_('Audio Menu'), menu_items, fxd_file=item.skin_fxd)
@@ -92,20 +93,25 @@
     item = arg
 
     menu_items = [ menu.MenuItem(_('no subtitles'), subtitle_selection, (item, 
-1)) ]
-    for s in item.info['subtitles']:
-        if s.has_key('languagedesc') and s['languagedesc']:
-            s['language'] = s['languagedesc']
-        elif not s.has_key('language') or not s['language']:
+
+    for subtitle in item.info['subtitles']:
+        s = copy.copy(subtitle)
+        
+        if not s.has_key('id') or not s['id']:
+            s['id'] = item.info['subtitles'].index(subtitle)
+
+        if not s.has_key('language') or not s['language']:
             s['language'] = _('Stream %s') % s['id']
 
-        if not s.has_key('content') or not s['content']:
-            s['content'] = ''
-        if s['content'] == 'Undefined':
-            s['content'] = ''
-        if s['content'] != '':
-            s['content'] = format(' (%s)' % s['content'])
+        if not s.has_key('title') or not s['title']:
+            s['title'] = ''
+        if s['title'] == 'Undefined':
+            s['title'] = ''
+
+        if s['title'] != '':
+            s['title'] = ' (%s)' % s['title']
 
-        txt = '%(language)s%(content)s' % s
+        txt = '%(language)s%(title)s' % s
         menu_items.append(menu.MenuItem(txt, subtitle_selection, (item, 
s['id'])))
 
     moviemenu = menu.Menu(_('Subtitle Menu'), menu_items, 
fxd_file=item.skin_fxd)
@@ -121,16 +127,31 @@
     play_movie(menuw=menuw, arg=arg)
     
 def chapter_selection_menu(arg=None, menuw=None):
-    item  = arg
+    item = arg
     menu_items = []
     if isinstance(arg.info['chapters'], int):
         for c in range(1, arg.info['chapters']):
             menu_items += [ menu.MenuItem(_('Play chapter %s') % c, 
chapter_selection,
                                           (arg, ' -chapter %s' % c)) ]
     elif arg.info['chapters']:
-        for c in arg.info['chapters']:
-            menu_items += [ menu.MenuItem(c.name, chapter_selection,
-                                          (arg, ' -ss %s' % c.pos)) ]
+        for chapter in arg.info['chapters']:
+            c = copy.copy(chapter)
+
+            if not c.has_key('id') or not c['id']:
+                c['id'] = item.info['chapters'].index(chapter)
+
+            if not c.has_key('name') or not c['name']:
+                c['name'] = ''
+
+            if not c.has_key('pos') or not c['pos']:
+                c['pos'] = 0
+
+            if c['name']:
+                txt = '%(name)s (%(pos)s)' % c
+            else:
+                txt = '%(id)s (%(pos)s)' % c
+
+            menu_items.append(menu.MenuItem(txt, chapter_selection, (item, ' 
-ss %s' % c['pos'])))
         
     moviemenu = menu.Menu(_('Chapter Menu'), menu_items, 
fxd_file=item.skin_fxd)
     menuw.pushmenu(moviemenu)

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 Mar 15 20:08:58 2007
@@ -59,10 +59,6 @@
 
         if info:
             self.info.set_variables(info)
-        # FIXME This is not the correct place to do this, should be done in 
mediainfo
-        if hasattr(self.info, 'filename') and self.info.filename:
-            self.info = metadata.parse(self.info.filename)
-
 
         self.variants          = []         # if this item has variants
         self.subitems          = []         # more than one file/track to play
@@ -207,6 +203,9 @@
         """
         return the specific attribute
         """
+        if not self.info:
+            return ''
+
         if key == 'geometry' and self.info['width'] and self.info['height']:
             return '%sx%s' % (self.info['width'], self.info['height'])
 
@@ -605,18 +604,18 @@
 
         # build a menu
         items = []
-        for title in range(len(self.info['tracks'])):
+        for titlenum in range(len(self.info['tracks'])):
             i = copy.copy(self)
             i.parent = self
-            i.set_url(self.url + str(title+1), False)
+            i.set_url(self.url + str(titlenum+1), False)
             i.info = copy.copy(self.info)
             # copy the attributes from mmpython about this track
-            i.info.mmdata = self.info.mmdata['tracks'][title]
+            i.info.mmdata = self.info.mmdata['tracks'][titlenum]
             i.info.set_variables(self.info.get_variables())
             i.info_type       = 'track'
             i.possible_player = []
             i.files           = None
-            i.name            = Unicode(_('Play Title %s')) % (title+1)
+            i.name            = Unicode(_('Play Title %d') % (titlenum+1))
             items.append(i)
 
         moviemenu = menu.Menu(self.name, items, umount_all = 1, 
fxd_file=self.skin_fxd)

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