Author: duncan
Date: Wed Jun 20 19:30:19 2007
New Revision: 9722

Modified:
   branches/rel-1/freevo/ChangeLog
   branches/rel-1/freevo/freevo_config.py
   branches/rel-1/freevo/src/item.py

Log:
[ 1738914 ] item.py "copy" errors
Patch from Valera Koval applied


Modified: branches/rel-1/freevo/ChangeLog
==============================================================================
--- branches/rel-1/freevo/ChangeLog     (original)
+++ branches/rel-1/freevo/ChangeLog     Wed Jun 20 19:30:19 2007
@@ -34,6 +34,7 @@
  * Fixed Panorama skin thumbnail (B#1731877)
  * Fixed recordings manager not deleting old video when the disk is full 
(B#1728182)
  * Fixed recordserver causing stack traces when the record_schedule.xml is 
empty (B#1733192)
+ * Fixed shopping cart to allow copying over existing read-only files 
(B#1738914)
  * Fixed tv recordings manager not deleting files when out of space (B#1728182)
  * Fixed unicoding errors for media ids when there are Unicode (F#1731825)
 

Modified: branches/rel-1/freevo/freevo_config.py
==============================================================================
--- branches/rel-1/freevo/freevo_config.py      (original)
+++ branches/rel-1/freevo/freevo_config.py      Wed Jun 20 19:30:19 2007
@@ -283,6 +283,7 @@
      Added OSD_SOUNDS_ENABLED defaulted to False for menu sounds
      Added SKIN_DEBUG to show boxes around each skin area for debugging skins
      Added IMAGEVIEWER_REVERSED_IMAGES for when the images are incorrectly 
rotated
+     Added SHOPPINGCART_CLOBBER to allow a move to clobber an existing file
      ''' ),
 ]
 
@@ -676,6 +677,8 @@
 for t in ('video', 'audio', 'image', 'games'):
     rom_plugins[t] = plugin.activate('rom_drives.rom_items', type=t, level=50)
 
+# Set to true to allow destination to be clobbered
+SHOPPINGCART_CLOBBER = False
 
 # mixer
 plugin.activate('mixer')

Modified: branches/rel-1/freevo/src/item.py
==============================================================================
--- branches/rel-1/freevo/src/item.py   (original)
+++ branches/rel-1/freevo/src/item.py   Wed Jun 20 19:30:19 2007
@@ -40,6 +40,7 @@
 import util
 
 from util import mediainfo, vfs, Unicode
+from gui import AlertBox
 
 class FileInformation:
     """
@@ -80,18 +81,39 @@
 
     def copy(self, destdir):
         for f in self.files + [ self.fxd_file, self.image, self.edl_file ]:
+            error_msg=''
             if f:
                 if vfs.isoverlay(f):
                     d = vfs.getoverlay(destdir)
                 else:
                     d = destdir
+
                 if not os.path.isdir(d):
                     os.makedirs(d)
+
                 if os.path.isdir(f):
                     dst = os.path.join(d, os.path.split(f)[1])
                     shutil.copytree(f, dst)
                 else:
-                    shutil.copy2(f, d)
+                    dst = os.path.join(d, os.path.split(f)[1])
+                    if os.path.exists(dst):
+                        if config.SHOPPINGCART_CLOBBER:
+                            try:
+                                os.unlink(dst)
+                            except IOError, e:
+                                error_msg='Can\'t delete "%s": %s' % (dst, e)
+
+                        else:
+                            error_msg='Can\'t copy "%s", destination exists' % 
dst
+                    else:
+                        try:
+                            shutil.copy2(f, d)
+                        except IOError, e:
+                            error_msg='Can\'t copy "%s": %s' % (f, e)
+
+            if error_msg:
+                _debug_(error_msg, config.DWARNING)
+                #AlertBox(text=_(Unicode(error_msg))).show()
 
 
     def move_possible(self):

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to