From 764389ea2a027a087fbbdcd5264fd57d5c276a70 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Tue, 8 Feb 2022 20:15:01 +0100 Subject: [PATCH] small change --- cps/tasks/thumbnail.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cps/tasks/thumbnail.py b/cps/tasks/thumbnail.py index d147f10d..c0887e0a 100644 --- a/cps/tasks/thumbnail.py +++ b/cps/tasks/thumbnail.py @@ -18,6 +18,7 @@ from __future__ import division, print_function, unicode_literals import os +from urllib.request import urlopen from .. import constants from cps import config, db, fs, gdriveutils, logger, ub @@ -25,10 +26,6 @@ from cps.services.worker import CalibreTask, STAT_CANCELLED, STAT_ENDED from datetime import datetime from sqlalchemy import func, text, or_ -try: - from urllib.request import urlopen -except ImportError as e: - from urllib2 import urlopen try: from wand.image import Image @@ -372,7 +369,8 @@ class TaskGenerateSeriesThumbnails(CalibreTask): dimensions = get_best_fit(width, height, img.width, img.height) # resize and crop the image - img.resize(width=int(dimensions['width']), height=int(dimensions['height']), filter='lanczos') + img.resize(width=int(dimensions['width']), height=int(dimensions['height']), + filter='lanczos') img.crop(width=int(width / 2.0), height=int(height / 2.0), gravity='center') # add the image to the canvas