← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/main] Rev 627: Fixed a bug where the Preview.XML was being generated in the wrong encoding, and thus MLT would f...

 

------------------------------------------------------------
revno: 627
fixes bug: https://launchpad.net/bugs/924442
committer: Jonathan Thomas <Jonathan.Oomph@xxxxxxxxx>
branch nick: openshot
timestamp: Tue 2012-01-31 13:00:34 -0600
message:
  Fixed a bug where the Preview.XML was being generated in the wrong encoding, and thus MLT would fail to load certain clips, due to non-English characters.
modified:
  openshot/classes/clip.py


--
lp:openshot
https://code.launchpad.net/~openshot.code/openshot/main

Your team OpenShot Code is subscribed to branch lp:openshot.
To unsubscribe from this branch go to https://code.launchpad.net/~openshot.code/openshot/main/+edit-subscription
=== modified file 'openshot/classes/clip.py'
--- openshot/classes/clip.py	2012-01-16 05:58:35 +0000
+++ openshot/classes/clip.py	2012-01-31 19:00:34 +0000
@@ -20,6 +20,7 @@
 import os, locale, uuid
 import xml.dom.minidom as xml
 import gtk, goocanvas
+import re
 from classes.keyframe import keyframe
 
 ########################################################################
@@ -340,9 +341,14 @@
 			if self.parent == MyTrack:
 				self.GenerateXML(dom, playlist, current_frame=0, preview_mode=preview_mode, fps=fps)
 
+		# Pretty print using a Regular expression (I am using regex due to a bug in the minidom, with extra 
+		# whitespace in it's pretty print method.  This should fix the pretty print's white space issue.)
+		pretty_print = re.compile(r'((?<=>)(\n[\t]*)(?=[^<\t]))|((?<=[^>\t])(\n[\t]*)(?=<))')
+		pretty_print_output = re.sub(pretty_print, '', dom.toprettyxml())
+
 		# Save the XML dom
 		f = open(file_name, "w")
-		dom.writexml(f, encoding=encoding)
+		f.write(pretty_print_output)
 		f.close()