From 22a43ca2e8cf778092776855aba6f137061e9627 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Thu, 2 Oct 2014 14:06:19 +0300 Subject: [PATCH] Added simple search and parsing for CPLs (ID and issue date). --- debian/changelog | 8 ++++++++ fabfile.py | 3 +-- source/dcp.py | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2a8debf..1120fd8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +dcpman (0.1.5) UNRELEASED; urgency=medium + + * Tagged debian/0.1.4 + * modified: debian/changelog modified: fabfile.py + * Now logs exception as well. + + -- Adar Nimrod <nimrod@shore.co.il> Sun, 28 Sep 2014 10:03:55 +0300 + dcpman (0.1.4) unstable; urgency=medium * Tagged debian/0.1.4 diff --git a/fabfile.py b/fabfile.py index 11795ae..712a616 100644 --- a/fabfile.py +++ b/fabfile.py @@ -11,7 +11,6 @@ def publish (): @task def build (): - #local ('''git dch -a''') local ('''dpkg-buildpackage -us -uc''') @task @@ -25,4 +24,4 @@ def clean (): @task def push (): - local ('''git push --all gitweb''') + local ('''git push --all gitdaemon''') diff --git a/source/dcp.py b/source/dcp.py index 428728a..7139bb5 100755 --- a/source/dcp.py +++ b/source/dcp.py @@ -180,6 +180,21 @@ class DCP: except BaseException as e: raise RuntimeError ('Failed to parse packinglist file') from e + def _find_cpl (self): + '''Goes through the xml files, finds the CPL and extracts the data from + it.''' + for asset in [x for x in self.assets if hasattr (x, 'type') and x.type.find ('xml') > -1]: + elements = (parse (asset.fullpath)).getElementsByTagName \ + ('CompositionPlaylist') + if len (elements) > 0: + try: + self.cpl_id = elements[0].getElementsByTagName \ + ('Id')[0].firstChild.data + self.cpl_date = elements[0].getElementsByTagName \ + ('IssueDate')[0].firstChild.data + except: + pass + def __init__ (self, directory): '''Parses the DCP in the directory specified.''' self.directory = directory @@ -191,6 +206,7 @@ class DCP: (x, 'duration')]) except: self.duration = 'Unknown' + self._find_cpl () def copyAndVerify (self, destination): '''Copies the DCP to the destination directory and verifies during.''' -- GitLab