Re: [Sugar-devel] activities using zip files (was: Re: [IAEP] Journal criticism)

2009-05-29 Thread Tomeu Vizoso
On Thu, May 28, 2009 at 22:53, Sascha Silbe
sascha-ml-ui-sugar-de...@silbe.org wrote:
 On Wed, May 27, 2009 at 12:34:03PM -0500, James Simmons wrote:

 5).  When several Activities support the same MIME type (Zip files are
 BOUND to be popular) then there needs to be a way of specifying that a
 particular Journal entry should be resumed by a particular Activity by
 default.

 Actually zip is just a container format and should be handled as such (if
 possible at all). I.e. zips created by activities should use a MIME type
 identifying the _contents_, not the generic application/zip.

 File formats can be - and often are - nested: OpenOffice documents are
 xml-inside-zip, some other application might be using
 xml-inside-tar-inside-gz and source tarballs are
 (C+Makefile+...)-inside-tar-inside-bz2. Unfortunately, most software using
 MIME types has very little support for such complexity (only
 gzip/bzip/compress as encodings). While it would be nice for the Journal
 to handle the full (i.e. nested) type, we'll need to cope with the lack of
 support in other software (like web servers) for quite some time.

The journal and browse are able to sniff the types of these formats,
so activity authors are encourage to use this scheme and ship a
mimetypes.ml file inside their bundles.

Regards,

Tomeu

 CU Sascha

 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)

 iQEcBAEBAgAGBQJKHvm9AAoJELpz82VMF3Da2m0IAIys+LuTpmJ1V9HFOHbW9PuU
 B6DpPj2i7SFkcdJ+8Rn4M/aSrslvV1f+3vFXeHhiFzYXFteWd2Vmc7zZCKRYLvxo
 6IaFqIGWIFTViLbq1rJNtHu7ZBm5zS5bzRTRP2PKZ9rHCdfLzDM3lfLdKkAeOHX+
 u+MzC+YLAPGp7Va4o9jov1qXJm1QH0dxzt80z2r5cI9ihoXuK90B9TmckGXU+MxO
 kbbdFSW2RVogix7btAZZQyQmx0rbNgqVTzQW8nkRLAIheJ2yBGGGWxs9YdzNmPUv
 JDeg5lTuoCGfW1kgzIPBRZNdsXSntaen1gCvwjFZCrwr5BBXr37y83KVmq5LBlk=
 =c5vn
 -END PGP SIGNATURE-

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] activities using zip files (was: Re: [IAEP] Journal criticism)

2009-05-29 Thread Tomeu Vizoso
On Fri, May 29, 2009 at 13:50, Walter Bender walter.ben...@gmail.com wrote:
 On Fri, May 29, 2009 at 7:32 AM, Tomeu Vizoso to...@sugarlabs.org wrote:
 [snip]
 The journal and browse are able to sniff the types of these formats,
 so activity authors are encourage to use this scheme and ship a
 mimetypes.ml file inside their bundles.


 Is there an example of what this should look like and where in the
 bundle it should go?

 The closest I was able to find I found this example in ClassroomPresenter.

 ClassroomPresenter.activity/activity/mimetypes.xml

 ?xml version=1.0 encoding=UTF-8?
 mime-info xmlns=http://www.freedesktop.org/standards/shared-mime-info;
        mime-type type=application/x-classroompresenter
                commentClassroom Presenter Slide Deck/comment
                glob pattern=*.cpxo/
        /mime-type
 /mime-info

From /usr/share/mime/packages/freedesktop.org.xml :

  mime-type type=application/vnd.oasis.opendocument.text
commentODT document/comment
comment xml:lang=b...@latinDakument ODT/comment
...
comment xml:lang=viTài liệu ODT/comment
acronymODT/acronym
expanded-acronymOpenDocument Text/expanded-acronym
sub-class-of type=application/zip/
generic-icon name=x-office-document/
magic priority=50
  match value=PK\003\004 type=string offset=0
match value=mimetype type=string offset=30
  match value=application/vnd.oasis.opendocument.text
type=string offset=38/
/match
  /match
/magic
glob pattern=*.odt/
  /mime-type

This works for .odt files because at the beginning of the zip file
there's an uncompressed file named mimetype that contains the mime
type. That's why at the offset 38 we should find the string
application/vnd.oasis.opendocument.text.

Some info here:

http://books.evc-cit.info/odbook/ch01.html

Regards,

Tomeu

 -walter

 --
 Walter Bender
 Sugar Labs
 http://www.sugarlabs.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] activities using zip files

2009-05-29 Thread Tomeu Vizoso
On Fri, May 29, 2009 at 00:24, James Simmons jim.simm...@walgreens.com wrote:
 Sascha,

 If the Activity creates a Zip file then the Journal automatically
 resumes it in that Activity.  Making Activities use a special MIME type
 when creating a Journal entry doesn't give me anything I don't have already.

Well, if the file has its own file extension, then when you move files
across computers it will be still resumable with your activity (and
will use its icon). Not critically important but may be handy in some
cases.

 Where we have problems is in downloading Zip files from Gutenberg and
 other places that don't do anything special with the MIME type.  For
 instance, Gutenberg has zipped up text files as well as zipped up
 websites (multiple html pages plus illustrations).  Somebody mentioned
 that Browse will eventually be able to save web pages with
 illustrations, etc. as zipfiles for offline reading.  If Browse could
 handle that, you'd also want it to be able to open these Gutenberg zip
 files if they are saved in the Journal, and it would be nice to do it
 with one click.

Yeah, Browse could grow some generic support for zip files, but anyway
the worst problem is that people are using zip files as a generic
container but without signaling its contents with an specific file
extension :/

 The format I use for View Slides is sometimes called CBZ.  It's just a
 Zip file containing images with a .cbz suffix rather than .zip.  The
 GNOME desktop recognizes this file type and displays the first image in
 the file as the file's icon.  I don't think there is a MIME type for
 that though.

View Slides could register a mime type for that extension. This way,
when someone downloads or copies a file ending in .cbz, ir would open
with VS and would use its icon. More info:

http://wiki.sugarlabs.org/go/Development_Team/Almanac/Activity_Bundles#Bundle_structure

Regards,

Tomeu

 James Simmons


 Sascha Silbe wrote:
 On Wed, May 27, 2009 at 12:34:03PM -0500, James Simmons wrote:

 5).  When several Activities support the same MIME type (Zip files
 are BOUND to be popular) then there needs to be a way of specifying
 that a particular Journal entry should be resumed by a particular
 Activity by default.
 Actually zip is just a container format and should be handled as such
 (if possible at all). I.e. zips created by activities should use a
 MIME type identifying the _contents_, not the generic application/zip.

 File formats can be - and often are - nested: OpenOffice documents are
 xml-inside-zip, some other application might be using
 xml-inside-tar-inside-gz and source tarballs are
 (C+Makefile+...)-inside-tar-inside-bz2. Unfortunately, most software
 using MIME types has very little support for such complexity (only
 gzip/bzip/compress as encodings). While it would be nice for the
 Journal to handle the full (i.e. nested) type, we'll need to cope with
 the lack of support in other software (like web servers) for quite
 some time.

 CU Sascha



 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] activities using zip files

2009-05-28 Thread James Simmons
Sascha,

If the Activity creates a Zip file then the Journal automatically 
resumes it in that Activity.  Making Activities use a special MIME type 
when creating a Journal entry doesn't give me anything I don't have already.

Where we have problems is in downloading Zip files from Gutenberg and 
other places that don't do anything special with the MIME type.  For 
instance, Gutenberg has zipped up text files as well as zipped up 
websites (multiple html pages plus illustrations).  Somebody mentioned 
that Browse will eventually be able to save web pages with 
illustrations, etc. as zipfiles for offline reading.  If Browse could 
handle that, you'd also want it to be able to open these Gutenberg zip 
files if they are saved in the Journal, and it would be nice to do it 
with one click.

The format I use for View Slides is sometimes called CBZ.  It's just a 
Zip file containing images with a .cbz suffix rather than .zip.  The 
GNOME desktop recognizes this file type and displays the first image in 
the file as the file's icon.  I don't think there is a MIME type for 
that though.

James Simmons


Sascha Silbe wrote:
 On Wed, May 27, 2009 at 12:34:03PM -0500, James Simmons wrote:

 5).  When several Activities support the same MIME type (Zip files 
 are BOUND to be popular) then there needs to be a way of specifying 
 that a particular Journal entry should be resumed by a particular 
 Activity by default.
 Actually zip is just a container format and should be handled as such 
 (if possible at all). I.e. zips created by activities should use a 
 MIME type identifying the _contents_, not the generic application/zip.

 File formats can be - and often are - nested: OpenOffice documents are 
 xml-inside-zip, some other application might be using 
 xml-inside-tar-inside-gz and source tarballs are 
 (C+Makefile+...)-inside-tar-inside-bz2. Unfortunately, most software 
 using MIME types has very little support for such complexity (only 
 gzip/bzip/compress as encodings). While it would be nice for the 
 Journal to handle the full (i.e. nested) type, we'll need to cope with 
 the lack of support in other software (like web servers) for quite 
 some time.

 CU Sascha



___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] activities using zip files

2009-05-28 Thread Sayamindu Dasgupta
On Fri, May 29, 2009 at 3:54 AM, James Simmons
jim.simm...@walgreens.com wrote:
 Sascha,

 If the Activity creates a Zip file then the Journal automatically
 resumes it in that Activity.  Making Activities use a special MIME type
 when creating a Journal entry doesn't give me anything I don't have already.

 Where we have problems is in downloading Zip files from Gutenberg and
 other places that don't do anything special with the MIME type.  For
 instance, Gutenberg has zipped up text files as well as zipped up
 websites (multiple html pages plus illustrations).  Somebody mentioned
 that Browse will eventually be able to save web pages with
 illustrations, etc. as zipfiles for offline reading.  If Browse could
 handle that, you'd also want it to be able to open these Gutenberg zip
 files if they are saved in the Journal, and it would be nice to do it
 with one click.

 The format I use for View Slides is sometimes called CBZ.  It's just a
 Zip file containing images with a .cbz suffix rather than .zip.  The
 GNOME desktop recognizes this file type and displays the first image in
 the file as the file's icon.  I don't think there is a MIME type for
 that though.


The version of Read that is associated with OLPC 8.2.1 release (as
well as newer versions of Read) should be able to handle CBZ files.
application/x-cbz is what I used in the activity.info file.

Thanks,
Sayamindu

-- 
Sayamindu Dasgupta
[http://sayamindu.randomink.org/ramblings]
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel