mirror of
https://gitlab.com/LazyLibrarian/LazyLibrarian.git
synced 2026-02-06 10:47:15 +00:00
Fix more missing imports
This commit is contained in:
parent
73a0da3d69
commit
d2d0a3f822
@ -26,23 +26,34 @@ Key Functions:
|
||||
- send_to_calibre: Generic function to send any media type to Calibre
|
||||
"""
|
||||
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import traceback
|
||||
|
||||
import lazylibrarian
|
||||
from lazylibrarian import database
|
||||
from lazylibrarian.cache import cache_img, ImageType
|
||||
from lazylibrarian.calibre import calibredb, get_calibre_id
|
||||
from lazylibrarian.images import create_mag_cover
|
||||
from lazylibrarian.magazinescan import format_issue_filename, get_dateparts, create_id
|
||||
from lazylibrarian.metadata_opf import create_opf, create_comic_opf, create_mag_opf
|
||||
from lazylibrarian.config2 import CONFIG
|
||||
from lazylibrarian.filesystem import (
|
||||
book_file,
|
||||
get_directory,
|
||||
listdir,
|
||||
path_isdir,
|
||||
path_isfile,
|
||||
remove_file,
|
||||
safe_move,
|
||||
safe_copy,
|
||||
setperm,
|
||||
syspath,
|
||||
)
|
||||
from lazylibrarian.formatter import unaccented
|
||||
from lazylibrarian.formatter import unaccented, make_unicode
|
||||
|
||||
|
||||
def send_to_calibre(booktype, global_name, folder, data):
|
||||
@ -249,14 +260,14 @@ def send_to_calibre(booktype, global_name, folder, data):
|
||||
else:
|
||||
opfpath = ""
|
||||
if booktype in ["ebook", "audiobook"]:
|
||||
process_img(
|
||||
lazylibrarian.postprocess.process_img(
|
||||
folder, bookid, data["BookImg"], global_name, ImageType.BOOK
|
||||
)
|
||||
opfpath, our_opf = create_opf(folder, data, global_name, True)
|
||||
# if we send an opf, does calibre update the book-meta as well?
|
||||
elif booktype == "comic":
|
||||
if data.get("Cover"):
|
||||
process_img(
|
||||
lazylibrarian.postprocess.process_img(
|
||||
folder, bookid, data["Cover"], global_name, ImageType.COMIC
|
||||
)
|
||||
if not CONFIG.get_bool("IMP_COMICOPF"):
|
||||
@ -450,7 +461,7 @@ def send_to_calibre(booktype, global_name, folder, data):
|
||||
if booktype == "ebook":
|
||||
remv = CONFIG.get_bool("FULL_SCAN")
|
||||
logger.debug(f"Scanning directory [{target_dir}]")
|
||||
_ = library_scan(target_dir, remove=remv)
|
||||
_ = lazylibrarian.librarysync.library_scan(target_dir, remove=remv)
|
||||
|
||||
newbookfile = book_file(target_dir, booktype=booktype, config=CONFIG)
|
||||
# should we be setting permissions on calibres directories and files?
|
||||
|
||||
@ -133,7 +133,7 @@ class EmailNotifier:
|
||||
if 'title' not in metadata or 'creator' not in metadata:
|
||||
basename, _ = splitext(f)
|
||||
if os.path.exists(f"{basename}.opf"):
|
||||
lazylibrarian.postprocess.write_meta(os.path.dirname(f), f"{basename}.opf")
|
||||
lazylibrarian.metadata_opf.write_meta(os.path.dirname(f), f"{basename}.opf")
|
||||
subtype = mime_type(syspath(f)).split('/')[1]
|
||||
logger.debug(f'Attaching {subtype} {title}')
|
||||
with open(syspath(f), "rb") as fil:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user