[pitivi] Formatter: Add optional project argument to _parse()
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Subject: [pitivi] Formatter: Add optional project argument to _parse()
- Date: Thu, 14 May 2009 11:15:52 -0400 (EDT)
commit 1e72a50e2fa21178b16767570e6c22b43b888a5e
Author: Edward Hervey <bilboed bilboed com>
Date: Thu May 14 12:27:20 2009 +0200
Formatter: Add optional project argument to _parse()
---
pitivi/formatters/base.py | 10 ++++++++--
pitivi/formatters/etree.py | 2 +-
pitivi/formatters/playlist.py | 2 +-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/pitivi/formatters/base.py b/pitivi/formatters/base.py
index 4e78b61..e035882 100644
--- a/pitivi/formatters/base.py
+++ b/pitivi/formatters/base.py
@@ -106,7 +106,7 @@ class Formatter(Signallable, Loggable):
# parse the format (subclasses)
# FIXME : maybe have a convenience method for opening a location
- self._parse(location)
+ self._parse(location, project)
if not project:
project = self.newProject()
@@ -227,12 +227,18 @@ class Formatter(Signallable, Loggable):
"""
raise NotImplementedError
- def _parse(self, location):
+ def _parse(self, location, project=None):
"""
Open and parse the given location.
+ If provided, implementation can fill in some global L{Project} properties.
+
To be implemented by subclasses.
+ @arg location: The location to open/parse
+ @type location: C{URI}
+ @type project: L{Project}
+
If any error occurs during this step, subclasses should raise the
FormatterParseError exception.
"""
diff --git a/pitivi/formatters/etree.py b/pitivi/formatters/etree.py
index bb52d24..9af67e5 100644
--- a/pitivi/formatters/etree.py
+++ b/pitivi/formatters/etree.py
@@ -460,7 +460,7 @@ class ElementTreeFormatter(Formatter):
f.write(tostring(root))
f.close()
- def _parse(self, location):
+ def _parse(self, location, project=None):
self.debug("location:%s", location)
# open the given location
self._context.rootelement = parse(location.split('://', 1)[1])
diff --git a/pitivi/formatters/playlist.py b/pitivi/formatters/playlist.py
index 5711420..ed7d8c0 100644
--- a/pitivi/formatters/playlist.py
+++ b/pitivi/formatters/playlist.py
@@ -41,7 +41,7 @@ class PlaylistFormatter(LoadOnlyFormatter):
return 'file://' + ln.strip()
return 'file://' + os.path.join(self._basedir, ln.strip())
- def _parse(self, location):
+ def _parse(self, location, project=None):
path = location.split('file://', 1)[1]
self._basedir = os.path.dirname(path)
res = []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]