Update of /cvsroot/freevo/freevo/src
In directory sc8-pr-cvs1:/tmp/cvs-serv26879

Modified Files:
        directory.py 
Log Message:
use new vfs

Index: directory.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/directory.py,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** directory.py        22 Nov 2003 02:31:15 -0000      1.61
--- directory.py        22 Nov 2003 20:34:44 -0000      1.62
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.62  2003/11/22 20:34:44  dischi
+ # use new vfs
+ #
  # Revision 1.61  2003/11/22 02:31:15  gsbarbieri
  # Please don't use:
***************
*** 111,115 ****
                    _('Show the items in the list in reverse order.')),
  
-                  ('COVER_DIR', '', ''),
                   ('AUDIO_FORMAT_STRING', '', ''),
  
--- 114,117 ----
***************
*** 169,187 ****
          if name:
              self.name = name
!       elif os.path.isfile(directory + '/album.xml'):
              try:
                  self.name = bins.get_bins_desc(directory)['desc']['title']
              except:
!                 self.name = os.path.basename(directory)
          else:
!             self.name = os.path.basename(directory)
  
          
          # check for image in album.xml
!         if os.path.isfile(directory + '/album.xml'):
              try:
                  image = bins.get_bins_desc(directory)['desc']['sampleimage']
!                 image = os.path.join(directory, image)
!                 if os.path.isfile(image):
                      self.image = image
                      self.handle_type = self.display_type
--- 171,189 ----
          if name:
              self.name = name
!       elif vfs.isfile(directory + '/album.xml'):
              try:
                  self.name = bins.get_bins_desc(directory)['desc']['title']
              except:
!                 self.name = vfs.basename(directory)
          else:
!             self.name = vfs.basename(directory)
  
          
          # check for image in album.xml
!         if vfs.isfile(directory + '/album.xml'):
              try:
                  image = bins.get_bins_desc(directory)['desc']['sampleimage']
!                 image = vfs.join(directory, image)
!                 if vfs.isfile(image):
                      self.image = image
                      self.handle_type = self.display_type
***************
*** 189,200 ****
                  pass
  
!         # Check for cover in COVER_DIR
!         if config.COVER_DIR:
!             image = util.getimage(config.COVER_DIR+os.path.basename(directory))
!             if image:
!                 self.image = image
!                 self.handle_type = self.display_type
! 
!         # Check for a cover in current dir, overide COVER_DIR if needed
          image = util.getimage(directory+'/cover')
          if image:
--- 191,195 ----
                  pass
  
!         # Check for a cover in current dir
          image = util.getimage(directory+'/cover')
          if image:
***************
*** 214,218 ****
              # the configurable regexp
              try:
!                 files = os.listdir(directory)
              except OSError:
                  print "oops, os.listdir() error"
--- 209,213 ----
              # the configurable regexp
              try:
!                 files = vfs.listdir(directory)
              except OSError:
                  print "oops, os.listdir() error"
***************
*** 221,237 ****
              image = None
              if len(images) == 1:
!                 image = os.path.join(directory, images[0])
              elif len(images) > 1:
                  covers = filter(cover_filter, images)
                  if covers:
!                     image = os.path.join(directory, covers[0])
              self.image = image
  
          if not self.image and config.TV_SHOW_DATA_DIR:
!             self.image = util.getimage(os.path.join(config.TV_SHOW_DATA_DIR,
!                                                     
os.path.basename(directory).lower()))
  
!             if 
config.TV_SHOW_INFORMATIONS.has_key(os.path.basename(directory).lower()):
!                 tvinfo = 
config.TV_SHOW_INFORMATIONS[os.path.basename(directory).lower()]
                  self.info = tvinfo[1]
                  if not self.image:
--- 216,232 ----
              image = None
              if len(images) == 1:
!                 image = vfs.join(directory, images[0])
              elif len(images) > 1:
                  covers = filter(cover_filter, images)
                  if covers:
!                     image = vfs.join(directory, covers[0])
              self.image = image
  
          if not self.image and config.TV_SHOW_DATA_DIR:
!             self.image = util.getimage(vfs.join(config.TV_SHOW_DATA_DIR,
!                                                     vfs.basename(directory).lower()))
  
!             if config.TV_SHOW_INFORMATIONS.has_key(vfs.basename(directory).lower()):
!                 tvinfo = config.TV_SHOW_INFORMATIONS[vfs.basename(directory).lower()]
                  self.info = tvinfo[1]
                  if not self.image:
***************
*** 240,244 ****
                      self.xml_file = tvinfo[3]
  
!         if os.path.isfile(directory+'/folder.fxd'): 
              self.xml_file = directory+'/folder.fxd'
  
--- 235,239 ----
                      self.xml_file = tvinfo[3]
  
!         if vfs.isfile(directory+'/folder.fxd'): 
              self.xml_file = directory+'/folder.fxd'
  
***************
*** 255,262 ****
          """
          self.xml_file = file
!         if self.xml_file and os.path.isfile(self.xml_file):
              try:
                  parser = qp_xml.Parser()
!                 f = open(self.xml_file)
                  var_def = parser.parse(f.read())
                  f.close()
--- 250,257 ----
          """
          self.xml_file = file
!         if self.xml_file and vfs.isfile(self.xml_file):
              try:
                  parser = qp_xml.Parser()
!                 f = vfs.open(self.xml_file)
                  var_def = parser.parse(f.read())
                  f.close()
***************
*** 296,301 ****
              try:
                  image = node.attrs[('', 'cover-img')].encode(config.LOCALE)
!                 if image and os.path.isfile(os.path.join(self.dir, image)):
!                     self.image = os.path.join(self.dir, image)
              except KeyError:
                  pass
--- 291,296 ----
              try:
                  image = node.attrs[('', 'cover-img')].encode(config.LOCALE)
!                 if image and vfs.isfile(vfs.join(self.dir, image)):
!                     self.image = vfs.join(self.dir, image)
              except KeyError:
                  pass
***************
*** 303,308 ****
              try:
                  import_xml = node.attrs[('', 'import')].encode(config.LOCALE)
!                 if os.path.isfile(os.path.join(self.dir, import_xml + '.fxd')):
!                     info = parseMovieFile(os.path.join(self.dir, import_xml + 
'.fxd'),
                                            self, [])
                      if info:
--- 298,303 ----
              try:
                  import_xml = node.attrs[('', 'import')].encode(config.LOCALE)
!                 if vfs.isfile(vfs.join(self.dir, import_xml + '.fxd')):
!                     info = parseMovieFile(vfs.join(self.dir, import_xml + '.fxd'),
                                            self, [])
                      if info:
***************
*** 344,348 ****
          save the modified fxd file
          """
!         self.xml_file = os.path.join(self.dir, 'folder.fxd')
  
          try:
--- 339,343 ----
          save the modified fxd file
          """
!         self.xml_file = vfs.join(self.dir, 'folder.fxd')
  
          try:
***************
*** 482,486 ****
              util.mount(self.mountpoint)
              
!       if os.path.isfile(self.dir + '/.password'):
            print 'password protected dir'
              self.arg   = arg
--- 477,481 ----
              util.mount(self.mountpoint)
              
!       if vfs.isfile(self.dir + '/.password'):
            print 'password protected dir'
              self.arg   = arg
***************
*** 495,499 ****
        # read the contents of self.dir/.passwd and compare to word
        try:
!           pwfile = open(self.dir + '/.password')
            line = pwfile.readline()
        except IOError, e:
--- 490,494 ----
        # read the contents of self.dir/.passwd and compare to word
        try:
!           pwfile = vfs.open(self.dir + '/.password')
            line = pwfile.readline()
        except IOError, e:
***************
*** 518,536 ****
          if self.display_type == 'tv':
              display_type = 'video'
!         
!         datadir = util.getdatadir(self)
!         try:
!             files = ([ os.path.join(self.dir, fname)
!                        for fname in os.listdir(self.dir) ])
!             if os.path.isdir(datadir):
!                 for f in ([ os.path.join(datadir, fname)
!                             for fname in os.listdir(datadir) ]):
!                     if not os.path.isdir(f):
!                         files.append(f)
!                         
!             self.all_files = copy.copy(files)
!         except OSError:
!             print 'util:match_files(): Got error on dir = "%s"' % self.dir
!             return
  
          # build play_items for video, audio, image, games
--- 513,519 ----
          if self.display_type == 'tv':
              display_type = 'video'
! 
!         files = vfs.listdir(self.dir)
!         self.all_files = copy.copy(files)
  
          # build play_items for video, audio, image, games
***************
*** 600,608 ****
          dir_items = []
          for filename in files:
!             if (os.path.isdir(filename) and
!                 os.path.basename(filename) != 'CVS' and
!                 os.path.basename(filename) != '.xvpics' and
!                 os.path.basename(filename) != '.thumbnails' and
!                 os.path.basename(filename) != '.pics'):
                  dir_items += [ DirItem(filename, self, display_type =
                                         self.display_type) ]
--- 583,591 ----
          dir_items = []
          for filename in files:
!             if (vfs.isdir(filename) and
!                 vfs.basename(filename) != 'CVS' and
!                 vfs.basename(filename) != '.xvpics' and
!                 vfs.basename(filename) != '.thumbnails' and
!                 vfs.basename(filename) != '.pics'):
                  dir_items += [ DirItem(filename, self, display_type =
                                         self.display_type) ]
***************
*** 678,682 ****
  
              plugin.getbyname('Dirwatcher').cwd(menuw, self, item_menu, self.dir,
!                                                datadir, self.all_files)
              self.menu  = item_menu
              self.menuw = menuw
--- 661,665 ----
  
              plugin.getbyname('Dirwatcher').cwd(menuw, self, item_menu, self.dir,
!                                                self.all_files)
              self.menu  = item_menu
              self.menuw = menuw
***************
*** 688,694 ****
          called when we return to this menu
          """
-         datadir = util.getdatadir(self)
          plugin.getbyname('Dirwatcher').cwd(self.menuw, self, self.menu, self.dir,
!                                            datadir, self.all_files)
          plugin.getbyname('Dirwatcher').scan(force=True)
  
--- 671,676 ----
          called when we return to this menu
          """
          plugin.getbyname('Dirwatcher').cwd(self.menuw, self, self.menu, self.dir,
!                                            self.all_files)
          plugin.getbyname('Dirwatcher').scan(force=True)
  
***************
*** 755,763 ****
          new_dir_items = []
          for dir in new_files:
!             if (os.path.isdir(dir) and
!                 os.path.basename(dir) != 'CVS' and
!                 os.path.basename(dir) != '.xvpics' and
!                 os.path.basename(dir) != '.thumbnails' and
!                 os.path.basename(dir) != '.pics'):
                  new_dir_items += [ DirItem(dir, self,
                                             display_type = self.display_type) ]
--- 737,745 ----
          new_dir_items = []
          for dir in new_files:
!             if (vfs.isdir(dir) and
!                 vfs.basename(dir) != 'CVS' and
!                 vfs.basename(dir) != '.xvpics' and
!                 vfs.basename(dir) != '.thumbnails' and
!                 vfs.basename(dir) != '.pics'):
                  new_dir_items += [ DirItem(dir, self,
                                             display_type = self.display_type) ]
***************
*** 974,978 ****
          self.item_menu     = None
          self.dir           = None
-         self.datadir       = None
          self.files         = None
          self.poll_interval = 100
--- 956,959 ----
***************
*** 981,992 ****
  
  
!     def cwd(self, menuw, item, item_menu, dir, datadir, files):
          self.menuw     = menuw
          self.item      = item
          self.item_menu = item_menu
          self.dir       = dir
-         self.datadir   = datadir
          self.files     = files
!         self.last_time = os.stat(self.dir)[stat.ST_MTIME]
          
      def scan(self, force=False):
--- 962,972 ----
  
  
!     def cwd(self, menuw, item, item_menu, dir, files):
          self.menuw     = menuw
          self.item      = item
          self.item_menu = item_menu
          self.dir       = dir
          self.files     = files
!         self.last_time = vfs.stat(self.dir)[stat.ST_MTIME]
          
      def scan(self, force=False):
***************
*** 994,1003 ****
              return
          if not force and config.DIRECTORY_USE_STAT_FOR_CHANGES and \
!                os.stat(self.dir)[stat.ST_MTIME] == self.last_time:
              return True
  
          try:
!             files = ([ os.path.join(self.dir, fname)
!                        for fname in os.listdir(self.dir) ])
          except OSError:
              # the directory is gone
--- 974,982 ----
              return
          if not force and config.DIRECTORY_USE_STAT_FOR_CHANGES and \
!                vfs.stat(self.dir)[stat.ST_MTIME] == self.last_time:
              return True
  
          try:
!             files = vfs.listdir(self.dir, False)
          except OSError:
              # the directory is gone
***************
*** 1008,1019 ****
              return
          
-         try:
-             for f in ([ os.path.join(self.datadir, fname)
-                         for fname in os.listdir(self.datadir) ]):
-                 if not os.path.isdir(f):
-                     files.append(f)
-         except OSError:
-             pass
-         
          new_files = []
          del_files = []
--- 987,990 ----
***************
*** 1029,1033 ****
              _debug_('directory has changed')
              self.item.update(new_files, del_files, files)
!             self.last_time = os.stat(self.dir)[stat.ST_MTIME]
                      
          self.files = files
--- 1000,1004 ----
              _debug_('directory has changed')
              self.item.update(new_files, del_files, files)
!             self.last_time = vfs.stat(self.dir)[stat.ST_MTIME]
                      
          self.files = files




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to