@@ -0,0 +1,2112 @@
+import logging%0D%0Afrom flexget.plugin import register_plugin, get_plugin_by_name, get_plugin_keywords, get_phases_by_plugin, phase_methods%0D%0A%0D%0Alog = logging.getLogger('sequence')%0D%0A%0D%0A%0D%0Aclass PluginSequence(object):%0D%0A    %22%22%22 Allows the same plugin to be configured multiple times in a feed.%0D%0A%0D%0A    Example:%0D%0A    sequence:%0D%0A      - rss: http://feeda.com%0D%0A      - rss: http://feedb.com%0D%0A    %22%22%22%0D%0A%0D%0A    def validator(self):%0D%0A        from flexget import validator%0D%0A        root = validator.factory()%0D%0A        valid_plugins = root.accept('list').accept('dict')%0D%0A        for plugin_name in get_plugin_keywords():%0D%0A            plugin = get_plugin_by_name(plugin_name)%0D%0A            if plugin.api_ver %3E 1 and hasattr(plugin.instance, 'validator'):%0D%0A                valid_plugins.accept(plugin.instance.validator, key=plugin_name)%0D%0A        return root%0D%0A%0D%0A    def __getattr__(self, item):%0D%0A        %22%22%22Returns a function for all on_feed_* and on_process_* events, that runs all the configured plugins.%22%22%22%0D%0A        for phase, method in phase_methods.iteritems():%0D%0A            # TODO: Deal with entry phases%0D%0A            if item == method and phase not in %5B'accept', 'reject', 'fail'%5D:%0D%0A                break%0D%0A        else:%0D%0A            raise AttributeError(item)%0D%0A%0D%0A        def handle_phase(feed, config):%0D%0A            %22%22%22Function that runs all of the configured plugins which act on the current phase.%22%22%22%0D%0A            # Keep a list of all results, for input plugin combining%0D%0A            results = %5B%5D%0D%0A            for item in config:%0D%0A                for plugin_name, plugin_config in item.iteritems():%0D%0A                    if phase in get_phases_by_plugin(plugin_name):%0D%0A                        method = get_plugin_by_name(plugin_name).phase_handlers%5Bphase%5D%0D%0A                        log.debug('Running plugin %25s' %25 plugin_name)%0D%0A                        result = method(feed, plugin_config)%0D%0A                        if isinstance(result, list):%0D%0A                            results.extend(result)%0D%0A            return results%0D%0A%0D%0A        return handle_phase%0D%0A%0D%0A%0D%0Aregister_plugin(PluginSequence, 'sequence', api_ver=2, debug=True)%0D%0A

Add sequence plugin, which allows running plugins in a specified order, and including the same plugin more than once in a feed.