Copy to and from the Journal: Difference between revisions

From OLPC
Jump to navigation Jump to search
(added instructions to wget the scripts. So many mentions of Opera, when wget does the trick... and is non-proprietary)
No edit summary
 
(17 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{G1G1 Support FAQ}}
{{G1G1 Support FAQ}}
==Copy to Journal Script==
==To a USB stick==
Insert a USB stick
[http://dev.laptop.org/git?p=users/phil/support-scripts;a=blob_plain;f=copy-to-journal This Python script] by Reinier Heeres and Phil Bordelon seems to do the trick.


This allows you to copy files from [[Linux]] to the [[Journal Activity]] filesystem.
start the [[Terminal Activity]], and type
cp /home/olpc/.sugar/default/datastore/store/* /media/KINGSTON


replacing KINGSTON by the name of your USB stick. To find what that name is, go to Journal and hover with the mouse over the USB stick symbol.
To use it, save it using the name '''copy-to-journal.py'''. Save it in /home/olpc using the [[Opera]] web browser or using wget in the Terminal:

wget http://dev.laptop.org/git?p=users/phil/support-scripts;a=blob_plain;f=copy-to-journal
This sort of works, but after a few files gives me an "out of space" error <sub>[[User:Yamaplos|Yamaplos]] 05:30, 9 December 2008 (UTC)</sub>
.

Go to the [[Terminal Activity]], and type
[[Journal_Activity#External_storage_devices| To remove the USB stick]] in the Journal hover over the USB stick symbol until you get the "unmount" option, click on it, wait until the USB symbol disappears, then take your USB to any other computer. Filenames are heavily hashed, meaning "myfile.bzip" might show up as 2637-4737-13323-dl77nf, or some such gibberish.
cd /home/olpc

To go to the directory you saved the file in. Then type
==Copy to Journal script==
python copy-to-journal.py FILENAME -m MIMETYPE -t TITLE
The [http://dev.laptop.org/git/users/phil/support-scripts/plain/copy-to-journal copy-to-journal] script written by Reinier Heeres and Phil Bordelon allows you to copy files from the [[Linux]] filesystem into to the [[Journal Activity|Sugar Journal]].
* '''FILENAME''' is the name you saved in the filesystem,

* '''MIMETYPE''' is the [[Mimetype]] (eg txt or pdf).
Once you've gotten the script (see below), start the [[Terminal Activity]], and type
* '''TITLE''' is the name you want in the journal.
copy-to-journal ''FILENAME'' -g -t ''TITLE''
But replace:
* ''FILENAME'' with the name you saved in the filesystem,
* ''TITLE'' with the name you want in the journal.

<tt>-g</tt> means *guess* the mime-type (via the <tt>file</tt> command). If you want to specify the mime-type explicitly, just add <tt>-m</tt> ''MIMETYPE'' instead of <tt>-g</tt>. Examples of valid mimetypes are <tt>application/pdf</tt>, <tt>image/png</tt>, <tt>text/html</tt> and <tt>video/mp4</tt>.

The ''MIMETYPE'' (for the Journal to know which Activity to pass the instance to) can be determined by probing the file system:
# under /home/olpc/.sugar/default/datastore/''folder'' (these folders hold the activity instances) or /home/olpc/.sugar/default/datastore/store/''file.metadata'' for Sugar 0.82 and earlier;
# Create and Keep an instance of the desired type;
# then search for the most recently created/changed folder/file;
# and read the ''folder''/metadata/mime_type file or ''file.metadata'' for the mime_type value (for example, <code>cat ''file.metadata''</code>).


==Copy from Journal script==
==Copy from Journal script==
[http://dev.laptop.org/git?p=users/phil/support-scripts;a=blob_plain;f=copy-from-journal This Python script] allows you to copy files from the Journal to the Linux filesystem.
The [http://dev.laptop.org/git/users/phil/support-scripts/plain/copy-from-journal copy-from-journal] script allows you to copy files from the [[Journal Activity|Sugar Journal]] to the [[Linux]] filesystem.

Once you've gotten it (see below), start the [[Terminal Activity]], and type
copy-from-journal -t ''NAME''
Replace ''NAME'' with the name you saved in the Journal.

If you use the <tt>-q</tt> flag, it will search on the title and description fields.
copy-from-journal -q <nowiki>'</nowiki>''title of some journal object''<nowiki>'</nowiki> ''filename''

== Getting these scripts ==

=== 767, G1G1v2, and later ===

Later builds have these scripts already installed in /usr/bin already. You don't need to download them, you can just use them, as above, except that the -g option is no longer supported.
:<tt>Usage: copy-to-journal <file> -m MIMETYPE [-t TITLE] [-d DESC] [-T tag [-T tag2 ...]]
</tt>

=== Older builds ===

For older builds, get the script by starting the Terminal activity and typing:

cd /home/olpc
wget -O copy-to-journal http://dev.laptop.org/git/users/phil/support-scripts/plain/copy-to-journal
wget -O copy-from-journal http://dev.laptop.org/git/users/phil/support-scripts/plain/copy-from-journal

...you can then use them by following the directions in the sections above by typing 'python ' (without the quotes) before the beginning of the line with the script, like this:

python copy-to-journal ...
python copy-from-journal ...

== Links ==

You can find another version of these scripts at http://xoexperience.blogspot.com/2008/02/copy-files-to-and-from-journal.html .
<nowiki>Insert non-formatted text here</nowiki>


[[Category:Journal]]
To use it, save it using the name '''copy-from-journal.py'''. Save it in /home/olpc using the [[Opera]] web browser or using wget in the Terminal:
wget http://dev.laptop.org/git?p=users/phil/support-scripts;a=blob_plain;f=copy-from-journal
.
Go to the [[Terminal Activity]], and type
cd /home/olpc
To go to the directory you saved the file in. Then type
python copy-from-journal.py -t NAME
But replace '''NAME''' with the name you saved in the Journal.

Latest revision as of 15:00, 7 October 2010

This page is part of the XO Support FAQ.     Support Index | Print This Page
<imagemap>

Image:Support-banner-square.png|173px|community support pages rect 0 0 135 204 [1] rect 135 0 345 204 Support FAQ rect 0 205 135 408 [2]

  1. Comment : there's some whitespace here:

rect 135 205 345 408 Other support

  1. maybe desc none is better. testing.

desc none

</imagemap>

To a USB stick

Insert a USB stick

start the Terminal Activity, and type

cp /home/olpc/.sugar/default/datastore/store/* /media/KINGSTON

replacing KINGSTON by the name of your USB stick. To find what that name is, go to Journal and hover with the mouse over the USB stick symbol.

This sort of works, but after a few files gives me an "out of space" error Yamaplos 05:30, 9 December 2008 (UTC)

To remove the USB stick in the Journal hover over the USB stick symbol until you get the "unmount" option, click on it, wait until the USB symbol disappears, then take your USB to any other computer. Filenames are heavily hashed, meaning "myfile.bzip" might show up as 2637-4737-13323-dl77nf, or some such gibberish.

Copy to Journal script

The copy-to-journal script written by Reinier Heeres and Phil Bordelon allows you to copy files from the Linux filesystem into to the Sugar Journal.

Once you've gotten the script (see below), start the Terminal Activity, and type

copy-to-journal FILENAME -g -t TITLE

But replace:

  • FILENAME with the name you saved in the filesystem,
  • TITLE with the name you want in the journal.

-g means *guess* the mime-type (via the file command). If you want to specify the mime-type explicitly, just add -m MIMETYPE instead of -g. Examples of valid mimetypes are application/pdf, image/png, text/html and video/mp4.

The MIMETYPE (for the Journal to know which Activity to pass the instance to) can be determined by probing the file system:

  1. under /home/olpc/.sugar/default/datastore/folder (these folders hold the activity instances) or /home/olpc/.sugar/default/datastore/store/file.metadata for Sugar 0.82 and earlier;
  2. Create and Keep an instance of the desired type;
  3. then search for the most recently created/changed folder/file;
  4. and read the folder/metadata/mime_type file or file.metadata for the mime_type value (for example, cat file.metadata).

Copy from Journal script

The copy-from-journal script allows you to copy files from the Sugar Journal to the Linux filesystem.

Once you've gotten it (see below), start the Terminal Activity, and type

copy-from-journal -t NAME

Replace NAME with the name you saved in the Journal.

If you use the -q flag, it will search on the title and description fields.

copy-from-journal -q 'title of some journal object' filename

Getting these scripts

767, G1G1v2, and later

Later builds have these scripts already installed in /usr/bin already. You don't need to download them, you can just use them, as above, except that the -g option is no longer supported.

Usage: copy-to-journal <file> -m MIMETYPE [-t TITLE] [-d DESC] [-T tag [-T tag2 ...]]

Older builds

For older builds, get the script by starting the Terminal activity and typing:

cd /home/olpc 
wget -O copy-to-journal  http://dev.laptop.org/git/users/phil/support-scripts/plain/copy-to-journal
wget -O copy-from-journal http://dev.laptop.org/git/users/phil/support-scripts/plain/copy-from-journal

...you can then use them by following the directions in the sections above by typing 'python ' (without the quotes) before the beginning of the line with the script, like this:

python copy-to-journal ...
python copy-from-journal ...

Links

You can find another version of these scripts at http://xoexperience.blogspot.com/2008/02/copy-files-to-and-from-journal.html . Insert non-formatted text here