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