[106] update images remaining open

pull/1329/head
meisnate12 2 years ago
parent 368221176b
commit ae266cc11d

@ -1 +1 @@
1.18.3-develop105
1.18.3-develop106

@ -774,9 +774,9 @@ class ConfigFile:
else:
logger.error("Config Error: operations must be a dictionary")
def error_check(attr, service):
logger.error(f"Config Error: Operation {attr} cannot be {params[attr]} without a successful {service} Connection")
params[attr] = None
def error_check(err_attr, service):
logger.error(f"Config Error: Operation {err_attr} cannot be {params[err_attr]} without a successful {service} Connection")
params[err_attr] = None
for mass_key in operations.meta_operations:
if params[mass_key] == "omdb" and self.OMDb is None:

@ -189,8 +189,7 @@ class Overlays:
elif self.library.reapply_overlays or changed_image or overlay_change:
try:
canvas_width, canvas_height = overlay.get_canvas_size(item)
new_poster = Image.open(poster.location if poster else has_original)
with Image.open(poster.location if poster else has_original) as new_poster:
exif_tags = new_poster.getexif()
exif_tags[0x04bc] = "overlay"
new_poster = new_poster.convert("RGB").resize((canvas_width, canvas_height), Image.LANCZOS)
@ -359,6 +358,9 @@ class Overlays:
logger.error("")
logger.error(f"Overlays Attempted on {item_title}: {', '.join(over_names)}")
logger.exorcise()
for _, over in properties.items():
if over.image:
over.image.close()
overlay_run_time = str(datetime.now() - overlay_start).split('.')[0]
logger.info("")
logger.separator(f"Finished {self.library.name} Library Overlays\nOverlays Run Time: {overlay_run_time}")

@ -1367,9 +1367,8 @@ class Plex(Library):
for file in util.glob_filter(os.path.join(item_asset_directory, "*.*")):
if file.lower().endswith((".png", ".jpg", ".jpeg", "webp")) and not re.match(r"s\d+e\d+|season\d+", file.lower()):
try:
image = Image.open(file)
with Image.open(file) as image:
_w, _h = image.size
image.close()
if not poster and _h >= _w:
new_path = os.path.join(os.path.dirname(file), f"poster{os.path.splitext(file)[1].lower()}")
os.rename(file, new_path)

Loading…
Cancel
Save