Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/serialize.py
diff options
context:
space:
mode:
Diffstat (limited to 'serialize.py')
-rwxr-xr-xserialize.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/serialize.py b/serialize.py
index 32b5db7..ad7ce24 100755
--- a/serialize.py
+++ b/serialize.py
@@ -4,8 +4,16 @@ import os
import gtk
import logging
import dbus
+import subprocess
+from datetime import datetime
+import time
+import tempfile
+import shutil
+import copy
from sugar.datastore import datastore
+from sugar import mime
+from sugar import env
import constants
from instance import Instance
@@ -253,7 +261,7 @@ def _saveMediaToDatastore(el, recd, activity):
recd.savedMedia = True
_saveXml(el, recd)
- else:
+ elif recd.saveInternal:
#this will remove the media from being accessed on the local disk since it puts it away into cold storage
#therefore this is only called when write_file is called by the activity superclass
mediaObject = datastore.create()
@@ -296,3 +304,17 @@ def _saveMediaToDatastore(el, recd, activity):
_saveXml(el, recd)
recd.mediaFilename = None
+ else:
+ if recd.metaChange:
+ oldMediaFilepath = copy.copy(recd.oldFilepath)
+ mediaThumbFilename = utils.getUniqueFilepath(recd.title + " @ " + str(recd.time),
+ recd.activity.Instance.get_path())
+ mediaFilename = mediaThumbFilename
+ mediaFilename = mediaFilename + "." + constants.MEDIA_INFO[recd.type]['ext']
+
+ mediaFilepath = os.path.join( recd.activity.Instance.get_path(), mediaFilename )
+ mediaFilepath = utils.getUniqueFilepath( mediaFilepath, 0 )
+ recd.mediaFilename = os.path.basename( mediaFilepath )
+ recd.oldFilepath = mediaFilepath
+
+ shutil.move(oldMediaFilepath, mediaFilepath)