Code cosmetics
This commit is contained in:
parent
dc45b53b24
commit
699bd036e8
|
@ -201,7 +201,7 @@ def backupCalibreDbAndOptionalDownload(drive, f=None):
|
|||
metaDataFile="'%s' in parents and title = 'metadata.db' and trashed = false" % getEbooksFolderId()
|
||||
|
||||
fileList = drive.ListFile({'q': metaDataFile}).GetList()
|
||||
|
||||
|
||||
databaseFile=fileList[0]
|
||||
|
||||
if f:
|
||||
|
@ -353,7 +353,7 @@ def getChangeById (drive, change_id):
|
|||
if not drive:
|
||||
drive=getDrive()
|
||||
if drive.auth.access_token_expired:
|
||||
drive.auth.Refresh()
|
||||
drive.auth.Refresh()
|
||||
# Print a single Change resource information.
|
||||
#
|
||||
# Args:
|
||||
|
|
|
@ -81,7 +81,7 @@ def make_mobi(book_id, calibrepath):
|
|||
file_path = os.path.join(calibrepath, book.path, data.name)
|
||||
if os.path.exists(file_path + u".epub"):
|
||||
p = subprocess.Popen((kindlegen + " \"" + file_path + u".epub\" ").encode(sys.getfilesystemencoding()),
|
||||
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
# Poll process for new output until finished
|
||||
while True:
|
||||
nextline = p.stdout.readline()
|
||||
|
@ -252,7 +252,7 @@ def get_valid_filename(value, replace_whitespace=True):
|
|||
value=value.replace(u'ß',u'ss')
|
||||
value = unicodedata.normalize('NFKD', value)
|
||||
re_slugify = re.compile('[\W\s-]', re.UNICODE)
|
||||
if type(value) is str: #Python3 str, Python2 unicode
|
||||
if isinstance(value, str): #Python3 str, Python2 unicode
|
||||
value = re_slugify.sub('', value).strip()
|
||||
else:
|
||||
value = unicode(re_slugify.sub('', value).strip())
|
||||
|
@ -300,7 +300,7 @@ def update_dir_stucture(book_id, calibrepath):
|
|||
def update_dir_structure_gdrive(book_id):
|
||||
db.session.connection().connection.connection.create_function("title_sort", 1, db.title_sort)
|
||||
book = db.session.query(db.Books).filter(db.Books.id == book_id).first()
|
||||
|
||||
|
||||
authordir = book.path.split('/')[0]
|
||||
new_authordir = get_valid_filename(book.authors[0].name)
|
||||
titledir = book.path.split('/')[1]
|
||||
|
|
|
@ -13,7 +13,7 @@ $(function() {
|
|||
$.ajax({
|
||||
dataType: "json",
|
||||
url: window.location.pathname+"/../../get_updater_status",
|
||||
success: function(data) {
|
||||
success(data) {
|
||||
// console.log(data.status);
|
||||
$("#UpdateprogressDialog #Updatecontent").html(updateText[data.status]);
|
||||
if (data.status >6){
|
||||
|
|
12
cps/web.py
12
cps/web.py
|
@ -272,14 +272,9 @@ def load_user_from_header(header_val):
|
|||
return user
|
||||
return
|
||||
|
||||
|
||||
def check_auth(username, password):
|
||||
user = ub.session.query(ub.User).filter(ub.User.nickname == username).first()
|
||||
if user and check_password_hash(user.password, password):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
return bool(user and check_password_hash(user.password, password))
|
||||
|
||||
def authenticate():
|
||||
return Response(
|
||||
|
@ -1239,11 +1234,10 @@ def stats():
|
|||
kindlegen = os.path.join(vendorpath, u"kindlegen")
|
||||
versions['KindlegenVersion'] = _('not installed')
|
||||
if os.path.exists(kindlegen):
|
||||
p = subprocess.Popen(kindlegen, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
stdin=subprocess.PIPE)
|
||||
p = subprocess.Popen(kindlegen, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p.wait()
|
||||
for lines in p.stdout.readlines():
|
||||
if type(lines) is bytes:
|
||||
if isinstance(lines, bytes):
|
||||
lines = lines.decode('utf-8')
|
||||
if re.search('Amazon kindlegen\(', lines):
|
||||
versions['KindlegenVersion'] = lines
|
||||
|
|
Loading…
Reference in New Issue
Block a user