Fix for editing book cover with drive + fixed found bug that has_cover not set
This commit is contained in:
+11
-3
@@ -2382,9 +2382,17 @@ def edit_book(book_id):
|
||||
|
||||
if to_save["cover_url"] and os.path.splitext(to_save["cover_url"])[1].lower() == ".jpg":
|
||||
img = requests.get(to_save["cover_url"])
|
||||
f = open(os.path.join(config.config_calibre_dir, book.path, "cover.jpg"), "wb")
|
||||
f.write(img.content)
|
||||
f.close()
|
||||
if config.config_use_google_drive:
|
||||
tmpDir=tempfile.gettempdir()
|
||||
f = open(os.path.join(tmpDir, "uploaded_cover.jpg"), "wb")
|
||||
f.write(img.content)
|
||||
f.close()
|
||||
gdriveutils.uploadFileToEbooksFolder(Gdrive.Instance().drive, os.path.join(book.path, 'cover.jpg'), os.path.join(tmpDir, f.name))
|
||||
else:
|
||||
f = open(os.path.join(config.config_calibre_dir, book.path, "cover.jpg"), "wb")
|
||||
f.write(img.content)
|
||||
f.close()
|
||||
book.has_cover=1
|
||||
|
||||
if book.series_index != to_save["series_index"]:
|
||||
book.series_index = to_save["series_index"]
|
||||
|
||||
Reference in New Issue
Block a user