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