home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / totem / plugins / bbc / installablecodecs.pyc (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.7 KB  |  59 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import gobject
  5. gobject.threads_init()
  6. import pygst
  7. pygst.require('0.10')
  8. import gst
  9. import os
  10.  
  11. def getInstallableCodecsUbuntu():
  12.     import warnings
  13.     warnings.filterwarnings('ignore', 'apt API not stable yet', FutureWarning)
  14.     import apt
  15.     codecs = []
  16.     
  17.     try:
  18.         apt_cache = apt.Cache()
  19.     except:
  20.         gst.warning('Failed to read APT cache')
  21.         return []
  22.  
  23.     for pkg in apt_cache:
  24.         if 'gstreamer' not in pkg.name and pkg.isInstalled or not (pkg.candidateDownloadable):
  25.             continue
  26.         
  27.         record = pkg.candidateRecord
  28.         if not record:
  29.             continue
  30.         
  31.         if not record.has_key('Gstreamer-Version'):
  32.             continue
  33.         
  34.         if record.has_key('Gstreamer-Decoders'):
  35.             codec_list = record['Gstreamer-Decoders'].split(';')
  36.             []([ item.split(',')[0].strip() for item in codec_list ])
  37.             continue
  38.         []
  39.     
  40.     return codecs
  41.  
  42.  
  43. def getInstallableCodecs():
  44.     codecs = []
  45.     if os.access('/var/cache/app-install/gai-codec-map.gdbm', os.R_OK):
  46.         codecs = getInstallableCodecsUbuntu()
  47.     
  48.     return codecs
  49.  
  50. if __name__ == '__main__':
  51.     codecs = getInstallableCodecs()
  52.     if len(codecs) > 0:
  53.         for codec in codecs:
  54.             print 'installable: %s' % codec
  55.         
  56.     else:
  57.         print 'No codecs known to be installable'
  58.  
  59.