sitemap/resource: adding minus in path, adding video
[treecutter.git] / treecutter / docbook.py
index a143487f7c071a2d8ed23805f56797bcac88beaa..32cff722ed72211e414d265250a72ece77202da0 100644 (file)
@@ -11,6 +11,7 @@ from time import time
 
 import treecutter.constants as const
 from treecutter.image import Image
+from treecutter.tools import warning
 
 class Docbook():
     """Class representing a docbook document"""
@@ -82,7 +83,8 @@ class Docbook():
                 (stdout, stderr) = xml.communicate()
                 #print xml.returnvalue
                 if stderr:
-                    print " ".join(exe)+" ERROR : [ "+stderr+" ]"
+                    warning("%s : %s" % (" ".join(exe),stderr))
+                    warning(stdout)
                     exit
                 os.chdir(cwd)
                 te = time()
@@ -119,6 +121,16 @@ class Docbook():
                 print "WARNING: File "+im+" is missing!"
         return res
 
+    def collect_videos(self):
+        res = []
+        for i in self._doc.xpath(u"//db:videodata[@fileref]",namespaces=const.XPATH):
+            im = os.path.join(self._dirname,i.get('fileref'))
+            if os.path.isfile(im):
+                res.append(im)
+            else:
+                print "WARNING: File "+im+" is missing!"
+        return res
+
     def collect_forms(self):
         res = []
         for i in self._doc.xpath(u"//html:form[@action]",namespaces=const.XPATH):