Update of /cvsroot/freevo/freevo/src/video
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18628

Modified Files:
        __init__.py videoitem.py 
Log Message:
better dvd disc support

Index: __init__.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/__init__.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** __init__.py 3 Feb 2004 20:51:12 -0000       1.27
--- __init__.py 15 Feb 2004 15:22:42 -0000      1.28
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.28  2004/02/15 15:22:42  dischi
+ # better dvd disc support
+ #
  # Revision 1.27  2004/02/03 20:51:12  dischi
  # fix/enhance dvd on disc
***************
*** 121,134 ****
          items = []
  
-         for i in copy.copy(files):
-             if os.path.isdir(i+'/VIDEO_TS'):
-                 # DVD Image
-                 x = VideoItem('', None)
-                 # Trailing slash is important for Xine
-                 x.set_url('dvd://' + i[1:] + '/VIDEO_TS/')  
-                 x.name = os.path.basename(i)
-                 items += [ x ]
-                 files.remove(i)
- 
          for file in util.find_matches(files, config.VIDEO_SUFFIX):
              if parent and parent.type == 'dir' and \
--- 124,127 ----
***************
*** 147,150 ****
--- 140,149 ----
              files.remove(file)
  
+         for i in copy.copy(files):
+             if os.path.isdir(i+'/VIDEO_TS'):
+                 # DVD Image, trailing slash is important for Xine
+                 items.append(VideoItem('dvd://' + i[1:] + '/VIDEO_TS/', parent))
+                 files.remove(i)
+ 
          return items
  

Index: videoitem.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/videoitem.py,v
retrieving revision 1.124
retrieving revision 1.125
diff -C2 -d -r1.124 -r1.125
*** videoitem.py        12 Feb 2004 12:28:38 -0000      1.124
--- videoitem.py        15 Feb 2004 15:22:42 -0000      1.125
***************
*** 11,14 ****
--- 11,17 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.125  2004/02/15 15:22:42  dischi
+ # better dvd disc support
+ #
  # Revision 1.124  2004/02/12 12:28:38  dischi
  # prevent a crash
***************
*** 134,138 ****
          self.selected_subtitle = None
          self.selected_audio    = None
-         self.num_titles        = 0
          self.elapsed           = 0
          
--- 137,140 ----
***************
*** 186,196 ****
              if self.url.find('/VIDEO_TS/') > 0:
                  # dvd on harddisc
!                 self.filename   = self.url[5:self.url.rfind('/VIDEO_TS/')]
!                 self.info       = util.mediainfo.get(self.filename)
!                 self.files      = FileInformation()
!                 self.num_titles = len(self.info['tracks'])
                  self.files.append(self.filename)
              else:
!                 self.filename   = ''
              
          if not self.image or (self.parent and self.image == self.parent.image):
--- 188,200 ----
              if self.url.find('/VIDEO_TS/') > 0:
                  # dvd on harddisc
!                 self.filename = self.url[5:self.url.rfind('/VIDEO_TS/')]
!                 self.info     = util.mediainfo.get(self.filename)
!                 self.files    = FileInformation()
!                 self.name     = self.info['title:filename']
!                 if not self.name:
!                     self.name = util.getname(self.filename)
                  self.files.append(self.filename)
              else:
!                 self.filename = ''
              
          if not self.image or (self.parent and self.image == self.parent.image):
***************
*** 220,245 ****
          return the specific attribute
          """
!         if key == 'item_id':
!             if self.media:
!                 filename = self.filename[len(self.media.mountdir):]
!                 id = 'cd://%s-%s' % (self.media.id, filename)
!             else:
!                 id = 'file://%s' % self.filename
!             if self.subitems:
!                 for s in self.subitems:
!                     id += s.getattr(key)
!             if self.variants:
!                 for v in self.variants:
!                     id += v.getattr(key)
!                     
!             return util.hexify(md5.new(id).digest())
!         
!         if key in ('geometry', 'aspect') and self.info:
!             if key == 'geometry' and self.info['width'] and self.info['height']:
!                 return '%sx%s' % (self.info['width'], self.info['height'])
!             if key == 'aspect' and self.info['aspect']:
!                 aspect = self.info['aspect']
!                 return aspect[:aspect.find(' ')].replace('/', ':')
              
          return Item.__getitem__(self, key)
  
--- 224,259 ----
          return the specific attribute
          """
!         if key == 'geometry' and self.info['width'] and self.info['height']:
!             return '%sx%s' % (self.info['width'], self.info['height'])
! 
!         if key == 'aspect' and self.info['aspect']:
!             aspect = self.info['aspect']
!             return aspect[:aspect.find(' ')].replace('/', ':')
              
+         if key == 'runtime':
+             length = None
+ 
+             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 ''
+ 
+             if isinstance(length, int) or isinstance(length, float) or \
+                    isinstance(length, long):
+                 length = str(int(round(length) / 60))
+             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)
  
***************
*** 531,536 ****
              self.menuw = menuw
  
          # only one track, play it
!         if self.num_titles == 1:
              i=copy.copy(self)
              i.possible_player = []
--- 545,553 ----
              self.menuw = menuw
  
+         # delete the submenu that got us here
+         self.menuw.delete_submenu(False)
+         
          # only one track, play it
!         if len(self.info['tracks']) == 1:
              i=copy.copy(self)
              i.possible_player = []
***************
*** 541,559 ****
          # build a menu
          items = []
!         for title in range(1,self.num_titles+1):
              i = copy.copy(self)
!             i.set_url(self.url + str(title), False)
              i.info = copy.copy(self.info)
              # copy the attributes from mmpython about this track
!             if self.info.has_key('tracks'):
!                 i.info.mmdata = self.info.mmdata['tracks'][title-1]
!                 i.info.set_variables(self.info.get_variables())
!                 i.info['audio']     = i.info.mmdata.audio 
!                 i.info['subtitles'] = i.info.mmdata.subtitles 
!                 i.info['chapters']  = i.info.mmdata.chapters 
              i.info_type       = 'track'
              i.possible_player = []
              i.files           = None
!             i.name            = _('Play Title %s') % title
              items.append(i)
  
--- 558,572 ----
          # build a menu
          items = []
!         for title in range(len(self.info['tracks'])):
              i = copy.copy(self)
!             i.set_url(self.url + str(title+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.set_variables(self.info.get_variables())
              i.info_type       = 'track'
              i.possible_player = []
              i.files           = None
!             i.name            = _('Play Title %s') % (title+1)
              items.append(i)
  



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to