[Sugar-devel] Getting Journal entries off an XO at the end of a project?

David Van Assche dvanassche at gmail.com
Tue Jan 17 13:50:04 EST 2012


The issue i see here is backing up work so its accesible to all oses not
just linux. Its definetly a fair point as most current edu projects are iOS
based,sadly... but such is the state of the world. Guess well have to wait
for android to make the visible change.
On Jan 17, 2012 12:39 PM, "Sascha Silbe" <silbe at activitycentral.com> wrote:

> Excerpts from Christoph Derndorfer's message of 2012-01-13 19:56:51 +0100:
>
> > (a) Have the pupils copy relevant files they want to keep to USB drives
> via
> > the Journal or the Sugar commander Activity
>
> > (b) Ask them to favorite things they want to keep in the Journal and then
> > run a script that copies all of these entries to a USB drive or possibly
> > even a network share
>
> Given that you're still running Sugar 0.82, one of these is probably the
> best option (in addition to doing a full backup, as explained in my
> previous mail).
>
> Whether the data file is usable outside of Sugar (i.e. in a standard
> format) depends on each activity.
>
> Writing a script that dumps all data files of starred entries is pretty
> straightforward if you borrow some functions from jarabe.journal.model
> (=> GPLv2+). You _will_ loose the metadata (description, tags, etc.) in
> any case: Even when using the UI to write the files, the metadata isn't
> in a format recognised by any other system.
>
>
> The script would look something like this:
>
> === snip ===
> #!/usr/bin/env python
> # License: GPL version 3
> import os
> import shutil
>
> from sugar import mime
> from sugar.datastore import datastore
>
>
> [copy get_file_name() and get_unique_file_name() from
> src/jarabe/journal/model.py]
>
>
> mount_point = '/media/CHERRY_TREE'
> for entry in datastore.find({'keep': '1'})[0]:
>    title = entry.metadata.get('title') or 'Untitled'
>    mime_type = entry.metadata.get('mime_type')
>    target_name = get_unique_file_name(mount_point,
>                                       get_file_name(title, mime_type))
>    target_path = os.path.join(mount_point, target_name)
>    shutil.copyfile(entry.file_path, target_path)
>    entry.destroy()
>
> === snip ===
>
> Untested on Sugar 0.82. Backup/Restore access the data store directly
> via D-Bus rather than through sugar.datastore.datastore, so I don't know
> if the API changed in subtle ways; a quick check confirmed that all of
> the functions imported (not copied) above were available in Sugar
> 0.82.0.
>
> Sascha
>
> --
> http://sascha.silbe.org/
> http://www.infra-silbe.de/
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120117/495487a6/attachment.html>


More information about the Sugar-devel mailing list