File: mime.rst

package info (click to toggle)
pyxdg 0.28-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 784 kB
  • sloc: python: 4,584; makefile: 135; sh: 14
file content (60 lines) | stat: -rw-r--r-- 1,184 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
.. module:: xdg.Mime

Shared MIME-info Database
=========================

`XDG Shared MIME-info Database specification <http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html>`_

Finding a file's Mime type
--------------------------

Example::

    >>> Mime.get_type2('/path/to/foo.zip')
    MIMEtype('application', 'zip')

.. autofunction:: get_type2

.. autofunction:: get_type_by_name

.. autofunction:: get_type_by_contents

.. autofunction:: get_type_by_data

.. autofunction:: get_type

Installing Mime data
--------------------

.. autofunction:: install_mime_info

MIMEtype objects
----------------

.. autoclass:: MIMEtype
   :members: canonical, inherits_from
   
   .. versionchanged:: 1.0
      The class now takes care of caching; call :func:`lookup` in earlier versions.
   
   .. attribute:: media
   
      e.g. 'text'
   
   .. attribute:: subtype
      
      e.g. 'plain'
      
   .. automethod:: get_comment
   
   .. versionadded:: 0.25
      :meth:`MIMEtype.canonical` and :meth:`MIMEtype.inherits_from`.

.. autofunction:: lookup

Miscellaneous
-------------

.. autofunction:: get_extensions

.. autofunction:: is_text_file