Commit e2924777 authored by OzzieIsaacs's avatar OzzieIsaacs

Bugfixes for uploading books to GDrive with new worker

parent b202ca56
...@@ -848,7 +848,7 @@ def upload(): ...@@ -848,7 +848,7 @@ def upload():
book_id = db_book.id book_id = db_book.id
title = db_book.title title = db_book.title
error = helper.update_dir_stucture(book_id, error = helper.update_dir_structure_file(book_id,
config.config_calibre_dir, config.config_calibre_dir,
input_authors[0], input_authors[0],
meta.file_path, meta.file_path,
...@@ -872,10 +872,7 @@ def upload(): ...@@ -872,10 +872,7 @@ def upload():
# save data to database, reread data # save data to database, reread data
calibre_db.session.commit() calibre_db.session.commit()
#calibre_db.setup_db(config, ub.app_DB_path)
# Reread book. It's important not to filter the result, as it could have language which hide it from
# current users view (tags are not stored/extracted from metadata and could also be limited)
#book = calibre_db.get_book(book_id)
if config.config_use_google_drive: if config.config_use_google_drive:
gdriveutils.updateGdriveCalibreFromLocal() gdriveutils.updateGdriveCalibreFromLocal()
if error: if error:
......
...@@ -213,7 +213,7 @@ def listRootFolders(): ...@@ -213,7 +213,7 @@ def listRootFolders():
def getEbooksFolder(drive): def getEbooksFolder(drive):
return getFolderInFolder('root',config.config_google_drive_folder,drive) return getFolderInFolder('root', config.config_google_drive_folder, drive)
def getFolderInFolder(parentId, folderName, drive): def getFolderInFolder(parentId, folderName, drive):
...@@ -243,7 +243,7 @@ def getEbooksFolderId(drive=None): ...@@ -243,7 +243,7 @@ def getEbooksFolderId(drive=None):
gDriveId.path = '/' gDriveId.path = '/'
session.merge(gDriveId) session.merge(gDriveId)
session.commit() session.commit()
return return gDriveId.gdrive_id
def getFile(pathId, fileName, drive): def getFile(pathId, fileName, drive):
......
...@@ -414,7 +414,7 @@ def update_dir_structure_file(book_id, calibrepath, first_author, orignal_filepa ...@@ -414,7 +414,7 @@ def update_dir_structure_file(book_id, calibrepath, first_author, orignal_filepa
src=new_path, dest=new_name, error=str(ex)) src=new_path, dest=new_name, error=str(ex))
return False return False
def update_dir_structure_gdrive(book_id, first_author, original_filepath): def update_dir_structure_gdrive(book_id, first_author):
error = False error = False
book = calibre_db.get_book(book_id) book = calibre_db.get_book(book_id)
path = book.path path = book.path
...@@ -518,7 +518,7 @@ def uniq(inpt): ...@@ -518,7 +518,7 @@ def uniq(inpt):
def update_dir_stucture(book_id, calibrepath, first_author=None, orignal_filepath=None, db_filename=None): def update_dir_stucture(book_id, calibrepath, first_author=None, orignal_filepath=None, db_filename=None):
if config.config_use_google_drive: if config.config_use_google_drive:
return update_dir_structure_gdrive(book_id, first_author, orignal_filepath, db_filename) return update_dir_structure_gdrive(book_id, first_author)
else: else:
return update_dir_structure_file(book_id, calibrepath, first_author, orignal_filepath, db_filename) return update_dir_structure_file(book_id, calibrepath, first_author, orignal_filepath, db_filename)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment