]> pere.pagekite.me Git - homepage.git/blob - blog/data/2013-01-18-debian-browserplugin.txt
Generated.
[homepage.git] / blog / data / 2013-01-18-debian-browserplugin.txt
1 Title: How to find a browser plugin supporting a given MIME type
2 Tags: english, debian
3 Date: 2013-01-18 10:40
4
5 <p>Some times I try to figure out which Iceweasel browser plugin to
6 install to get support for a given MIME type. Thanks to
7 <a href="https://wiki.ubuntu.com/MozillaTeam/Plugins">specifications
8 done by Ubuntu</a> and Mozilla, it is possible to do this in Debian.
9 Unfortunately, not very many packages provide the needed meta
10 information, Anyway, here is a small script to look up all browser
11 plugin packages announcing ther MIME support using this specification:</p>
12
13 <pre>
14 #!/usr/bin/python
15 import sys
16 import apt
17 def pkgs_handling_mimetype(mimetype):
18 cache = apt.Cache()
19 cache.open(None)
20 thepkgs = []
21 for pkg in cache:
22 version = pkg.candidate
23 if version is None:
24 version = pkg.installed
25 if version is None:
26 continue
27 record = version.record
28 if not record.has_key('Npp-MimeType'):
29 continue
30 mime_types = record['Npp-MimeType'].split(',')
31 for t in mime_types:
32 t = t.rstrip().strip()
33 if t == mimetype:
34 thepkgs.append(pkg.name)
35 return thepkgs
36 mimetype = "audio/ogg"
37 if 1 < len(sys.argv):
38 mimetype = sys.argv[1]
39 print "Browser plugin packages supporting %s:" % mimetype
40 for pkg in pkgs_handling_mimetype(mimetype):
41 print " %s" %pkg
42 </pre>
43
44 <p>It can be used like this to look up a given MIME type:</p>
45
46 <pre>
47 % ./apt-find-browserplug-for-mimetype
48 Browser plugin packages supporting audio/ogg:
49 gecko-mediaplayer
50 % ./apt-find-browserplug-for-mimetype application/x-shockwave-flash
51 Browser plugin packages supporting application/x-shockwave-flash:
52 browser-plugin-gnash
53 %
54 </pre>
55
56 <p>In Ubuntu this mechanism is combined with support in the browser
57 itself to query for plugins and propose to install the needed
58 packages. It would be great if Debian supported such feature too. Is
59 anyone working on adding it?</p>
60
61 <p><strong>Update 2013-01-18 14:20</strong>: The Debian BTS
62 request for icweasel support for this feature is
63 <a href="http://bugs.debian.org/484010">#484010</a> from 2008 (and
64 <a href="http://bugs.debian.org/698426">#698426</a> from today). Lack
65 of manpower and wish for a different design is the reason thus feature
66 is not yet in iceweasel from Debian.</p>