APT: Instead of using the raw codec string in WhatProvides use the one
produced by the gstreamer packagekit plugin
This commit is contained in:
parent
592e12a179
commit
9166309212
@ -1550,35 +1550,29 @@ class PackageKitAptBackend(PackageKitBaseBackend):
|
||||
self.AllowCancel(False)
|
||||
if provides_type == PROVIDES_CODEC:
|
||||
# The search term from the codec helper looks like this one:
|
||||
# "gstreamer.net|0.10|totem|DivX MPEG-4 Version 5 decoder|" \
|
||||
# "decoder-video/x-divx, divxversion=(int)5 (DivX MPEG-4 Version " \
|
||||
# "5 decoder)"
|
||||
try:
|
||||
(origin, version, app, descr, term) = search.split("|")
|
||||
except ValueError, e:
|
||||
match = re.match(r"gstreamer(.+)\((.+)\)\((.+)\)", search)
|
||||
if not match:
|
||||
self.ErrorCode(ERROR_UNKNOWN,
|
||||
"The search term is invalid")
|
||||
self.Finished(EXIT_FAILED)
|
||||
return
|
||||
codec = "%s:%s" % (match.group(1), match.group(2))
|
||||
db = get_mapping_db("/var/cache/app-install/gai-codec-map.gdbm")
|
||||
if db == None:
|
||||
self.ErrorCode(ERROR_INTERNAL_ERROR,
|
||||
"Failed to open codec mapping database")
|
||||
self.Finished(EXIT_FAILED)
|
||||
return
|
||||
handlers = set()
|
||||
for k in db.keys():
|
||||
codec = k
|
||||
if ":" in codec:
|
||||
codec = codec.split(":")[1]
|
||||
if codec in term:
|
||||
# The codec mapping db stores the packages as a string
|
||||
# separated by spaces. Each package has its section
|
||||
# prefixed and separated by a slash
|
||||
# FIXME: Should make use of the section and emit a
|
||||
# RepositoryRequired signal if the package does
|
||||
# not exist
|
||||
handlers.update(set(map(lambda s: s.split("/")[1],
|
||||
db[k].split(" "))))
|
||||
self._emit_visible_packages_by_name(filters, handlers)
|
||||
if db.has_key(codec):
|
||||
# The codec mapping db stores the packages as a string
|
||||
# separated by spaces. Each package has its section
|
||||
# prefixed and separated by a slash
|
||||
# FIXME: Should make use of the section and emit a
|
||||
# RepositoryRequired signal if the package does
|
||||
# not exist
|
||||
pkgs = map(lambda s: s.split("/")[1],
|
||||
db[codec].split(" "))
|
||||
self._emit_visible_packages_by_name(filters, pkgs)
|
||||
elif provides_type == PROVIDES_MIMETYPE:
|
||||
# Emit packages that contain an application that can handle
|
||||
# the given mime type
|
||||
|
Loading…
Reference in New Issue
Block a user