old_contents: 
  
  __author__ = 'scribblemaniac'
  
  from renderchan.module import RenderChanModule
  import subprocess
  import gzip
  import os
  import re
  
  class RenderChanInkscapeModule(RenderChanModule):
      def __init__(self):
          RenderChanModule.__init__(self)
          if os.name == 'nt':
              self.conf['binary']=os.path.join(os.path.dirname(__file__),"..\\..\\..\\inkscape\\inkscape.exe")
          else:
              self.conf['binary']="inkscape"
          self.conf["packetSize"]=0
  
      def getInputFormats(self):
          return ["svg", "svgz", "ai", "cdr", "vsd"]
  
      def getOutputFormats(self):
          return ["png", "ps", "eps", "pdf", "emf", "wmf"]
  
      def analyze(self, filename):
          info={"dependencies":[]}
  
          if filename.endswith(".svgz"):
              f=gzip.open(filename, 'rb')
          else:
              f=open(filename, 'rb')
  
          linkPattern = re.compile(".*sodipodi:absref=\"(.*?)\".*")
          for line in f:
              line = line.decode("utf-8")
              pat=linkPattern.search(line)
              if pat:
                  info["dependencies"].append(pat.group(1).strip())
          f.close
  
          return info
  
      def render(self, filename, outputPath, startFrame, endFrame, format, updateCompletion, extraParams={}):
  
          comp = 0.0
          updateCompletion(comp)
  
          commandline=[self.conf['binary'], "--file=" + filename, "--without-gui", "--export-width=" + extraParams["width"], "--export-height=" + extraParams["height"], "--export-%s=%s" % (format, outputPath)]
          subprocess.check_call(commandline)
  
          updateCompletion(1.0)
  
new_contents: 
  
  __author__ = 'scribblemaniac'
  
  from renderchan.module import RenderChanModule
  import subprocess
  import gzip
  import os
  import os.path
  from xml.etree import ElementTree
  
  class RenderChanInkscapeModule(RenderChanModule):
      def __init__(self):
          RenderChanModule.__init__(self)
          if os.name == 'nt':
              self.conf['binary']=os.path.join(os.path.dirname(__file__),"..\\..\\..\\inkscape\\inkscape.exe")
          else:
              self.conf['binary']="inkscape"
          self.conf["packetSize"]=0
          
          self.extraParams['use_own_dimensions']='1'
          self.extraParams['proxy_scale']='1.0'
  
      def getInputFormats(self):
          return ["svg", "svgz", "ai", "cdr", "vsd"]
  
      def getOutputFormats(self):
          return ["png", "ps", "eps", "pdf", "emf", "wmf"]
  
      def analyze(self, filename):
          info={ "dependencies":[], 'width': 0, 'height': 0 }
  
          if filename.endswith(".svgz"):
              f=gzip.open(filename, 'rb')
          else:
              f=open(filename, 'rb')
          
          tree = ElementTree.parse(f)
          root = tree.getroot()
          
          info["width"] = root.get("width")
          info["height"] = root.get("height")
  
          for element in root.iter("{http://www.w3.org/2000/svg}image"):
              info["dependencies"].append(os.path.join(os.path.dirname(filename), element.get("{http://www.w3.org/1999/xlink}href")))
          
          f.close()
  
          return info
  
      def render(self, filename, outputPath, startFrame, endFrame, format, updateCompletion, extraParams={}):
  
          comp = 0.0
          updateCompletion(comp)
  
          commandline=[self.conf['binary'], "--file=" + filename, "--without-gui", "--export-width=" + extraParams["width"], "--export-height=" + extraParams["height"], "--export-%s=%s" % (format, outputPath)]
          subprocess.check_call(commandline)
  
          updateCompletion(1.0)
  
subject: Use ElementTree to parse Inkscape dependencies