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

Modified Files:
        __init__.py 
Log Message:
auto detect movies with more than one file

Index: __init__.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/__init__.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** __init__.py 27 Mar 2004 00:46:23 -0000      1.30
--- __init__.py 2 Jun 2004 21:36:49 -0000       1.31
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.31  2004/06/02 21:36:49  dischi
+ # auto detect movies with more than one file
+ #
  # Revision 1.30  2004/03/27 00:46:23  outlyer
  # Fixed a crash. It occured when I used the "Configure Directory" option to
***************
*** 90,94 ****
  import plugin
  
! from videoitem import VideoItem
  
  # variables for the hashing function
--- 93,97 ----
  import plugin
  
! from videoitem import VideoItem, FileInformation
  
  # variables for the hashing function
***************
*** 131,140 ****
          items = []
  
!         for file in util.find_matches(files, config.VIDEO_SUFFIX):
!             if parent and parent.type == 'dir' and 
hasattr(parent,'VIDEO_DIRECTORY_AUTOBUILD_THUMBNAILS') and \
                     parent.VIDEO_DIRECTORY_AUTOBUILD_THUMBNAILS:
                  util.videothumb.snapshot(file, update=False, popup=True)
  
              x = VideoItem(file, parent)
              if parent.media:
                  file_id = parent.media.id + \
--- 134,183 ----
          items = []
  
!         all_files    = util.find_matches(files, config.VIDEO_SUFFIX)
!         hidden_files = []
! 
!         for file in all_files:
!             if parent and parent.type == 'dir' and \
!                    hasattr(parent,'VIDEO_DIRECTORY_AUTOBUILD_THUMBNAILS') and \
                     parent.VIDEO_DIRECTORY_AUTOBUILD_THUMBNAILS:
                  util.videothumb.snapshot(file, update=False, popup=True)
  
+             if file in hidden_files:
+                 files.remove(file)
+                 continue
+             
              x = VideoItem(file, parent)
+ 
+             # join video files
+             if config.VIDEO_AUTOJOIN and file.find('1') > 0:
+                 pos = 0
+                 for count in range(file.count('1')):
+                     add_file = []
+                     missing  = 0
+                     for i in range(2, 6):
+                         current = file[:pos] + file[pos:].replace('1', str(i), 1)
+                         if current in all_files:
+                             add_file.append(current)
+                             end = i
+                         elif not missing:
+                             # one file missing, stop searching
+                             missing = i
+                         
+                     if add_file and missing > end:
+                         if len(add_file) > 3:
+                             # more than 4 files, I don't belive it
+                             break
+                         # create new name
+                         name = file[:pos] + file[pos:].replace('1', '1-%s' % end, 1)
+                         x = VideoItem(name, parent)
+                         x.files = FileInformation()
+                         for f in [ file ] + add_file:
+                             x.files.append(f)
+                             x.subitems.append(VideoItem(f, x))
+                             hidden_files.append(f)
+                         break
+                     else:
+                         pos += file[pos:].find('1') + 1
+                         
              if parent.media:
                  file_id = parent.media.id + \
***************
*** 144,148 ****
                  except KeyError:
                      pass
!             items += [ x ]
              files.remove(file)
  
--- 187,191 ----
                  except KeyError:
                      pass
!             items.append(x)
              files.remove(file)
  



-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
>From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to