zaheer - in flumotion/trunk: . flumotion/component flumotion/manager

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Wed May 9 17:30:01 CEST 2007


Author: zaheer
Date: Wed May  9 17:29:58 2007
New Revision: 4916

Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/component/feedcomponent010.py
   flumotion/trunk/flumotion/manager/depgraph.py
Log:
	* flumotion/component/feedcomponent010.py
	  (FeedComponent.get_eater_name_for_feedid):
	Add helper method.
	* flumotion/manager/depgraph.py (DepGraph.mapEatersToFeeders,
	  DepGraph.whatShouldBeStarted):
	Migrate depgraph to use the eater key rather than the source key.



Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Wed May  9 17:29:58 2007
@@ -1,3 +1,12 @@
+2007-05-09  Zaheer Abbas Merali  <<zaheerabbas at merali dot org>>
+
+	* flumotion/component/feedcomponent010.py
+	  (FeedComponent.get_eater_name_for_feedid):
+	Add helper method.
+	* flumotion/manager/depgraph.py (DepGraph.mapEatersToFeeders,
+	  DepGraph.whatShouldBeStarted):
+	Migrate depgraph to use the eater key rather than the source key.
+
 2007-05-09  Michael Smith <msmith at fluendo.com>
 
 	* flumotion/component/producers/playlist/playlistparser.py:

Modified: flumotion/trunk/flumotion/component/feedcomponent010.py
==============================================================================
--- flumotion/trunk/flumotion/component/feedcomponent010.py	(original)
+++ flumotion/trunk/flumotion/component/feedcomponent010.py	Wed May  9 17:29:58 2007
@@ -1308,4 +1308,9 @@
                 self._gotFirstNewSegment[feedId] = True
         return True
 
+    def get_eater_name_for_feedid(self, feedId):
+        if self._eaterMapping.has_key(feedId):
+            return self._eaterMapping[feedId]
+        return None
+
 pygobject.type_register(FeedComponent)

Modified: flumotion/trunk/flumotion/manager/depgraph.py
==============================================================================
--- flumotion/trunk/flumotion/manager/depgraph.py	(original)
+++ flumotion/trunk/flumotion/manager/depgraph.py	Wed May  9 17:29:58 2007
@@ -200,46 +200,41 @@
             # for this component setup, go through all the feeders in it
             config = eatingComponent.get('config')
 
-            if not config.has_key('source'):
+            if not config.has_key('eater'):
                 # no eaters
                 self.debug("Component %r has no eaters" % eatingComponent)
             else:
-                # source is a list of componentName[:feedName]
+                # eater is a dict of eaterName -> list of componentName[:feedName]
                 # with feedName defaulting to default
-                # FIXME: maybe source should really be eaters and contain
-                # a list of feedId
-                list = config['source']
-
-                # FIXME: there's a bug in config parsing - sometimes this gives
-                # us one string, and sometimes a list of one string, and
-                # sometimes a list
-                if isinstance(list, str):
-                    list = [list, ]
-
-                for source in list:
-                    feederFound = False
-                    feederComponentName = source.split(':')[0]
-                    # find the feeder
-                    for feedingComponent in toSetup:
-                        if feedingComponent.get("name") == feederComponentName:
-                            feederFound = True
-                            try:
-                                self._addEdge(feedingComponent, eatingComponent,
-                                    "COMPONENTSETUP", "COMPONENTSETUP")
-                            except KeyError:
-                                # it is possible for a component to have
-                                # two eaters, each eating from feeders on
-                                # one other component
-                                pass
-                            try:
-                                self._addEdge(feedingComponent, eatingComponent,
-                                    "COMPONENTSTART", "COMPONENTSTART")
-                            except KeyError:
-                                pass
-
-                    if not feederFound:
-                        raise errors.ComponentConfigError(eatingComponent,
-                            "No feeder exists for eater %s" % source)
+                eaters = config['eater']
+
+                for eater in eaters:
+                    for feed in eaters[eater]:
+                        feederFound = False
+                        feederComponentName = feed.split(':')[0]
+                        # find the feeder
+                        for feedingComponent in toSetup:
+                            if feedingComponent.get("name") == feederComponentName:
+                                feederFound = True
+                                try:
+                                    self._addEdge(feedingComponent, eatingComponent,
+                                        "COMPONENTSETUP", "COMPONENTSETUP")
+                                except KeyError:
+                                    # it is possible for a component to have
+                                    # two eaters, each eating from feeders on
+                                    # one other component
+                                    pass
+                                try:
+                                    self._addEdge(feedingComponent, eatingComponent,
+                                        "COMPONENTSTART", "COMPONENTSTART")
+                                except KeyError:
+                                    pass
+
+                        if not feederFound:
+                            raise errors.ComponentConfigError(eatingComponent,
+                                "No feeder exists for eater %s on component %s"
+                                " feeding from %s" % (eater, eatingComponent,
+                                feed))
 
     def whatShouldBeStarted(self):
         """


More information about the flumotion-commit mailing list