GNOME Bugzilla – Bug 350522
gst registry.get_feature_list should facilitate sorting
Last modified: 2006-08-10 16:11:19 UTC
As the number of plugins increases, it becomes useful to have a list of plugins sorted by name. Currently the following code returns a list sorted by some index other than the name strings: registry = gst.registry_get_default() registrylist = registry.get_feature_list(gst.ElementFactory) registrylist.sort() Results in this: typefind tee filesink queue identity filesrc fdsink fdsrc fakesink fakesrc capsfilter xvimagesink ximagesink ... The fastest option is probably to have gst.PluginFeature have it's own __cmp__ method like this: def __cmp__(self, other): return cmp(self.get_name(), other.get_name()) This will make registrylist.sort() result in a list sorted alphabetically by name. Then again, this may be something that should be added to the gstreamer core and is inappropriate for gst-python. The workaround is this: registrylist.sort(lambda x, y: cmp(x.get_name(), y.get_name()))
as you've just proved, it's easily do-able in one line of python, so there's not really any point in putting it in gst-python. Closing.