<div class="gmail_quote">On Tue, Jan 17, 2012 at 12:39 PM, Sascha Silbe <span dir="ltr"><<a href="mailto:silbe@activitycentral.com">silbe@activitycentral.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Excerpts from Christoph Derndorfer's message of <a href="tel:2012-01-13%2019" value="+12012011319">2012-01-13 19</a>:56:51 +0100:<br>
<div class="im"><br>
> (a) Have the pupils copy relevant files they want to keep to USB drives via<br>
> the Journal or the Sugar commander Activity<br>
<br>
> (b) Ask them to favorite things they want to keep in the Journal and then<br>
> run a script that copies all of these entries to a USB drive or possibly<br>
> even a network share<br>
<br>
</div>Given that you're still running Sugar 0.82, one of these is probably the<br>
best option (in addition to doing a full backup, as explained in my<br>
previous mail).<br>
<br>
Whether the data file is usable outside of Sugar (i.e. in a standard<br>
format) depends on each activity.<br>
<br>
Writing a script that dumps all data files of starred entries is pretty<br>
straightforward if you borrow some functions from jarabe.journal.model<br>
(=> GPLv2+). You _will_ loose the metadata (description, tags, etc.) in<br>
any case: Even when using the UI to write the files, the metadata isn't<br>
in a format recognised by any other system.<br>
<br>
<br>
The script would look something like this:<br>
<br>
=== snip ===<br>
#!/usr/bin/env python<br>
# License: GPL version 3<br>
import os<br>
import shutil<br>
<br>
from sugar import mime<br>
from sugar.datastore import datastore<br>
<br>
<br>
[copy get_file_name() and get_unique_file_name() from<br>
src/jarabe/journal/model.py]<br>
<br>
<br>
mount_point = '/media/CHERRY_TREE'<br>
for entry in datastore.find({'keep': '1'})[0]:<br>
    title = entry.metadata.get('title') or 'Untitled'<br>
    mime_type = entry.metadata.get('mime_type')<br>
    target_name = get_unique_file_name(mount_point,<br>
                                       get_file_name(title, mime_type))<br>
    target_path = os.path.join(mount_point, target_name)<br>
    shutil.copyfile(entry.file_path, target_path)<br>
    entry.destroy()<br>
<br>
=== snip ===<br>
<br>
Untested on Sugar 0.82. Backup/Restore access the data store directly<br>
via D-Bus rather than through sugar.datastore.datastore, so I don't know<br>
if the API changed in subtle ways; a quick check confirmed that all of<br>
the functions imported (not copied) above were available in Sugar<br>
0.82.0.</blockquote><div><br></div><div>Thanks for the additional information and explanations, this is very helpful indeed! :-)</div><div><br>Christoph </div></div><div><br></div>-- <br>Christoph Derndorfer<div><br></div>
<div><div>volunteer, OLPC (Austria) [<a href="http://www.olpc.at/" target="_blank">www.olpc.at</a>]<br><div>editor, OLPC News [<a href="http://www.olpcnews.com/" target="_blank">www.olpcnews.com</a>]<br>contributor, TechnikBasteln [<a href="http://www.technikbasteln.net/" target="_blank">www.technikbasteln.net</a>]</div>
</div><div><br></div><div>e-mail: <a href="mailto:christoph@derndorfer.eu" target="_blank">christoph@derndorfer.eu</a></div><div><br></div></div><br>