Fixed compose thumbnails folder and docker config and requirements updated

This commit is contained in:
Frederik Baerentsen 2024-01-29 05:34:17 -05:00
parent 04b2354d51
commit c55e0e97ad
4 changed files with 13 additions and 10 deletions

View File

@ -2,17 +2,17 @@ import os
from werkzeug.security import generate_password_hash from werkzeug.security import generate_password_hash
from sys import platform from sys import platform
#CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "/library") #docker CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "/library") #docker
if platform == "linux" or platform == "linux2": #if platform == "linux" or platform == "linux2":
CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "/home/drudoo/ComicsTest/Comics") #linux # CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "/home/drudoo/ComicsTest/Comics") #linux
elif platform == "win32": #elif platform == "win32":
CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "/Comics/ComicRack") #windows # CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "/Comics/ComicRack") #windows
#CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "testlibrary") #windows test library #CONTENT_BASE_DIR = os.getenv("CONTENT_BASE_DIR", "testlibrary") #windows test library
# Added folder for thumbnails. These are loaded as covers for the files. # Added folder for thumbnails. These are loaded as covers for the files.
THUMBNAIL_DIR = os.getenv("THUMBNAIL_DIR",'thumbnails') THUMBNAIL_DIR = os.getenv("THUMBNAIL_DIR",'/thumbnails')
# If using Windows, insert the drive letter of your comics here. # If using Windows, insert the drive letter of your comics here.
# Both the script and comics needs to be on the same drive. # Both the script and comics needs to be on the same drive.

View File

@ -1,12 +1,13 @@
version: '3.3' version: '3.3'
services: services:
comicopds: comicopds:
image: . image: comicopds
container_name: comicopds container_name: comicopds
restart: unless-stopped restart: unless-stopped
ports: ports:
- '5000:5000' - '5000:5000'
volumes: volumes:
#- '/opt/data/Comics/ComicRack:/library:ro' #- '/opt/data/Comics/ComicRack:/library:ro'
- '~/ComicsTest/Comics:/library:ro' - '/home/drudoo/Pi1/Comics/ComicRack:/library:ro'
- '${PWD}/thumbnails:/thumbnails:ro'
- '${PWD}/:/app' - '${PWD}/:/app'

View File

@ -144,7 +144,7 @@ def generate():
image = Image.open(BytesIO(cover)) image = Image.open(BytesIO(cover))
rgb_im = image.convert("RGB") rgb_im = image.convert("RGB")
image.thumbnail(config.MAXSIZE,Image.ANTIALIAS) image.thumbnail(config.MAXSIZE,Image.LANCZOS)
image.save(config.THUMBNAIL_DIR + "/" + str(CVDB) + ".jpg") image.save(config.THUMBNAIL_DIR + "/" + str(CVDB) + ".jpg")
# Old way of saving without resize # Old way of saving without resize
@ -163,7 +163,7 @@ def generate():
#xyz = [i for i, x in enumerate(filelist) if re.match('*\.py$',x)] #xyz = [i for i, x in enumerate(filelist) if re.match('*\.py$',x)]
#config._print(xyz) #config._print(xyz)
image = Image.open(BytesIO(cover)) image = Image.open(BytesIO(cover))
image.thumbnail(config.MAXSIZE,Image.ANTIALIAS) image.thumbnail(config.MAXSIZE,Image.LANCZOS)
image.save(config.THUMBNAIL_DIR + "/" + str(CVDB) + ".jpg") image.save(config.THUMBNAIL_DIR + "/" + str(CVDB) + ".jpg")
generated = generated + 1 generated = generated + 1
except Exception as e: except Exception as e:

View File

@ -1,4 +1,6 @@
Flask==2.0.2 Flask==2.0.2
Werkzeug==2.2.2
numpy
Jinja2==3.0.2 Jinja2==3.0.2
requests==2.26.0 requests==2.26.0
Flask-HTTPAuth==4.5.0 Flask-HTTPAuth==4.5.0