[dots: 2/3] Invoke antiword only if the input file is of type 'application/msword'
- From: Eitan Isaacson <eitani src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [dots: 2/3] Invoke antiword only if the input file is of type 'application/msword'
- Date: Tue, 25 Aug 2009 20:15:59 +0000 (UTC)
commit 8f3eb138d2d9ae59ae8cea717eb15cd1ed94cc56
Author: Christian Egli <christian egli sbszh ch>
Date: Tue Aug 25 15:12:10 2009 +0200
Invoke antiword only if the input file is of type 'application/msword'
dots/dots_project.py | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/dots/dots_project.py b/dots/dots_project.py
index 33fcd44..59ec31c 100644
--- a/dots/dots_project.py
+++ b/dots/dots_project.py
@@ -17,6 +17,7 @@
import os, tempfile, host_settings, sys, gtk
import ascii_braille
import gtksourceview, pango
+import mimetypes
class DotsProject(gtk.ScrolledWindow):
def __init__(self, input_file, name):
@@ -67,9 +68,15 @@ class DotsProject(gtk.ScrolledWindow):
# Create a temporary out file.
outfile = tempfile.mktemp('.brl', 'dots_')
- argv = '%s -x db "%s" | %s -f %s > "%s"' % \
- (host_settings.antiword, self.input_file,
- host_settings.xml2brl, config_fn, outfile)
+ mimetype, ignore = mimetypes.guess_type(self.input_file)
+ if mimetype == 'application/msword':
+ argv = '%s -x db "%s" | %s -f %s > "%s"' % \
+ (host_settings.antiword, self.input_file,
+ host_settings.xml2brl, config_fn, outfile)
+ else:
+ argv = '%s -f %s < %s > "%s"' % \
+ (host_settings.xml2brl, config_fn, self.input_file, outfile)
+
os.system(argv)
# Write braille output to text buffer.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]