This commit is contained in:
Kovid Goyal 2012-02-14 19:58:50 +05:30
parent dd0dc01b7e
commit 20e46a53c6
2 changed files with 8 additions and 11 deletions

View File

@ -5,7 +5,7 @@ __license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import os, re, subprocess, hashlib, shutil, glob, stat, sys, time import os, subprocess, hashlib, shutil, glob, stat, sys, time
from subprocess import check_call from subprocess import check_call
from tempfile import NamedTemporaryFile, mkdtemp from tempfile import NamedTemporaryFile, mkdtemp
from zipfile import ZipFile from zipfile import ZipFile
@ -64,15 +64,11 @@ class ReUpload(Command): # {{{
# Data {{{ # Data {{{
def get_google_data(): def get_google_data():
PASSWORD_FILE = os.path.expanduser('~/.googlecodecalibre') with open(os.path.expanduser('~/.googlecodecalibre'), 'rb') as f:
OFFLINEIMAP = os.path.expanduser('~/work/kde/conf/offlineimap/rc') gc_password, ga_un, pw = f.read().strip().split('|')
gc_password = open(PASSWORD_FILE).read().strip()
raw = open(OFFLINEIMAP).read()
pw = re.search(r'(?s)remoteuser = .*@gmail.com.*?remotepass = (\S+)',
raw).group(1).strip()
return { return {
'username':'kovidgoyal@gmail.com', 'password':pw, 'gc_password':gc_password, 'username':ga_un, 'password':pw, 'gc_password':gc_password,
'path_map_server':'root@kovidgoyal.net', 'path_map_server':'root@kovidgoyal.net',
'path_map_location':'/var/www/status.calibre-ebook.com/googlepaths', 'path_map_location':'/var/www/status.calibre-ebook.com/googlepaths',
# If you change this remember to change it in the # If you change this remember to change it in the

View File

@ -69,9 +69,10 @@ def pdftohtml(output_dir, pdf_path, no_images):
raise raise
logf.flush() logf.flush()
logf.close() logf.close()
out = open(logf.name, 'rb').read() out = open(logf.name, 'rb').read().strip()
if ret != 0: if ret != 0:
raise ConversionError(out) raise ConversionError(out)
if out:
print "pdftohtml log:" print "pdftohtml log:"
print out print out
if not os.path.exists(index) or os.stat(index).st_size < 100: if not os.path.exists(index) or os.stat(index).st_size < 100: