home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import gobject
- gobject.threads_init()
- import pygst
- pygst.require('0.10')
- import gst
- import os
-
- def getInstallableCodecsUbuntu():
- import warnings
- warnings.filterwarnings('ignore', 'apt API not stable yet', FutureWarning)
- import apt
- codecs = []
-
- try:
- apt_cache = apt.Cache()
- except:
- gst.warning('Failed to read APT cache')
- return []
-
- for pkg in apt_cache:
- if 'gstreamer' not in pkg.name and pkg.isInstalled or not (pkg.candidateDownloadable):
- continue
-
- record = pkg.candidateRecord
- if not record:
- continue
-
- if not record.has_key('Gstreamer-Version'):
- continue
-
- if record.has_key('Gstreamer-Decoders'):
- codec_list = record['Gstreamer-Decoders'].split(';')
- []([ item.split(',')[0].strip() for item in codec_list ])
- continue
- []
-
- return codecs
-
-
- def getInstallableCodecs():
- codecs = []
- if os.access('/var/cache/app-install/gai-codec-map.gdbm', os.R_OK):
- codecs = getInstallableCodecsUbuntu()
-
- return codecs
-
- if __name__ == '__main__':
- codecs = getInstallableCodecs()
- if len(codecs) > 0:
- for codec in codecs:
- print 'installable: %s' % codec
-
- else:
- print 'No codecs known to be installable'
-
-