| 1 |
.. module:: xdg.Mime |
| 2 |
|
| 3 |
Shared MIME-info Database |
| 4 |
========================= |
| 5 |
|
| 6 |
`XDG Shared MIME-info Database specification <http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html>`_ |
| 7 |
|
| 8 |
Finding a file's Mime type |
| 9 |
-------------------------- |
| 10 |
|
| 11 |
Example:: |
| 12 |
|
| 13 |
>>> Mime.get_type2('/path/to/foo.zip') |
| 14 |
MIMEtype('application', 'zip') |
| 15 |
|
| 16 |
.. autofunction:: get_type2 |
| 17 |
|
| 18 |
.. autofunction:: get_type_by_name |
| 19 |
|
| 20 |
.. autofunction:: get_type_by_contents |
| 21 |
|
| 22 |
.. autofunction:: get_type_by_data |
| 23 |
|
| 24 |
.. autofunction:: get_type |
| 25 |
|
| 26 |
Installing Mime data |
| 27 |
-------------------- |
| 28 |
|
| 29 |
.. autofunction:: install_mime_info |
| 30 |
|
| 31 |
MIMEtype objects |
| 32 |
---------------- |
| 33 |
|
| 34 |
.. autoclass:: MIMEtype |
| 35 |
:members: canonical, inherits_from |
| 36 |
|
| 37 |
.. versionchanged:: 1.0 |
| 38 |
The class now takes care of caching; call :func:`lookup` in earlier versions. |
| 39 |
|
| 40 |
.. attribute:: media |
| 41 |
|
| 42 |
e.g. 'text' |
| 43 |
|
| 44 |
.. attribute:: subtype |
| 45 |
|
| 46 |
e.g. 'plain' |
| 47 |
|
| 48 |
.. automethod:: get_comment |
| 49 |
|
| 50 |
.. versionadded:: 0.25 |
| 51 |
:meth:`MIMEtype.canonical` and :meth:`MIMEtype.inherits_from`. |
| 52 |
|
| 53 |
.. autofunction:: lookup |
| 54 |
|
| 55 |
Miscellaneous |
| 56 |
------------- |
| 57 |
|
| 58 |
.. autofunction:: get_extensions |
| 59 |
|
| 60 |
.. autofunction:: is_text_file |