Discussion:
Category in mimetypes.
Stef Bon
2015-01-06 11:11:52 UTC
Permalink
Hi,

I'm working on a backupprogram, and it's the meaning thar the user can
select files to backup per directory:

- per individual mimetype (like application/vnd.oasis.opendocument.text)
- per group (like office or programming) of mimetypes

Now the first option is easy, the second I do not know.
Are there function groups of mimetypes?

What I mean with functional group (or category) is the collection
mimetypes like the group office:
all those mimetypes for officedocuments (document, spreadsheet,
presentation, database etc).

The category programming contains mimetypes like text/x-csrc and text/x-chdr.

Are these categories available somehow? When I look to a desktop file
in /usr/share/applications, I see the keyword Category. For example in
the libreoffice-base.desktop file there is the line

Categories=Office;Database;X-Red-Hat-Base;X-MandrivaLinux-MoreApplications-Databases;

This looks more like categories of programs, or is this the category
of mimetypes I'm looking for?

Stef
Rex Dieter
2015-01-06 13:11:42 UTC
Permalink
Post by Stef Bon
When I look to a desktop file
in /usr/share/applications, I see the keyword Category. For example in
the libreoffice-base.desktop file there is the line
Categories=Office;Database;X-Red-Hat-Base;X-MandrivaLinux-
MoreApplications-Databases;
Post by Stef Bon
This looks more like categories of programs, or is this the category
of mimetypes I'm looking for?
Categories of programs, per the menu spec, see also:
http://standards.freedesktop.org/menu-spec/latest/apa.html


-- rex
Stef Bon
2015-01-06 13:50:59 UTC
Permalink
Thanks Rex,

I've foud that page also,

but are these categories of programs the same as categories of mimetypes?

And if so, how can I get these categories from the commandline, something like:

xdg-mime list categories

(which does not exist yet, just an example).

Stef
Rex Dieter
2015-01-07 00:58:30 UTC
Permalink
Post by Stef Bon
categories of programs
^^ that. :)

-- Rex
Thomas Kluyver
2015-01-07 18:04:53 UTC
Permalink
Post by Rex Dieter
Post by Stef Bon
categories of programs
^^ that. :)
To expand a bit: such categories do not really exist for mimetypes (someone
correct me if I'm wrong). You may be able to make use of:

- The media types, the part of the mimetype before the slash, e.g. 'image',
'audio', 'text'. However, a lot of disparate kinds of file will end up
under the 'application' media type, and it may not be what you want - e.g.
'image' does not distinguish between photos and icons.
- Building a mapping of mime types to programs used to open them, and then
saying that e.g. anything that can be opened by an office application is an
office document. Your example shows one possible issue with this: I
wouldn't expect a database file to be treated as an office document. In
fact, the whole concept of 'office documents' seems like a bizarre
categorisation that only came about because a set of proprietary
applications was sold as a bundle.
- Hardcoded lists and heuristics - e.g. image/jpeg > 100 KB is probably a
photo. Be wary of making this too complex, because for backups you want it
to be clear to the user what is included in each category.

Thomas
Stef Bon
2015-01-07 20:42:32 UTC
Permalink
Hi Thomas,

thanks for your answer.

Now a few days later, I go for the hardcoded lists. Not really
hardcoded lists, the user can modify them.

When making a backup of a directory (not recursive), in my idea I go
for a "backup profile".
Directories you want to backup to my experience are for example:

- a directory with code files: c- and h-files, and the README,
Changes, NEWS, documentation and some others.
- a directory with documents for resume's and lettres to aplly to a job.
- a directory with documents for work: presentations, pdf's,
spreadsheets and text documents

It looks like the best sollution is a profile:
a set of mimetypes to include (a group of mimetypes)
filenames to include
and as extra: a maximum of filesizes

My idea is to create a gui to construct:
-groups of mimetypes (like the group "programming")
-rules that apply to a directory like "backup all these files with the
mimetype which is part of group programming".

Stef
Post by Thomas Kluyver
Post by Rex Dieter
Post by Stef Bon
categories of programs
^^ that. :)
To expand a bit: such categories do not really exist for mimetypes (someone
- The media types, the part of the mimetype before the slash, e.g. 'image',
'audio', 'text'. However, a lot of disparate kinds of file will end up under
the 'application' media type, and it may not be what you want - e.g. 'image'
does not distinguish between photos and icons.
- Building a mapping of mime types to programs used to open them, and then
saying that e.g. anything that can be opened by an office application is an
office document. Your example shows one possible issue with this: I wouldn't
expect a database file to be treated as an office document. In fact, the
whole concept of 'office documents' seems like a bizarre categorisation that
only came about because a set of proprietary applications was sold as a
bundle.
- Hardcoded lists and heuristics - e.g. image/jpeg > 100 KB is probably a
photo. Be wary of making this too complex, because for backups you want it
to be clear to the user what is included in each category.
Thomas
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
Loading...