Sugar.mime

From OLPC
Revision as of 17:00, 1 July 2008 by Fanwar (talk | contribs) (New page: = Helper Functions = === Given a specific filename, how do I figure out what its mime type is? === The mime.get_from_file_name() method lets you get the mime type based on the name of a g...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Helper Functions

Given a specific filename, how do I figure out what its mime type is?

The mime.get_from_file_name() method lets you get the mime type based on the name of a given file.

from sugar import mime
...
       # Get the mime type for a specific file
        print mime.get_from_file_name('~/file-test/sample-music.mp3')

Class: ObjectType