From 551b84b4f2b57c28b8dcdea904034a5bb1c0abf2 Mon Sep 17 00:00:00 2001 From: Winterbird Date: Thu, 31 Aug 2023 16:39:12 +0200 Subject: [PATCH] fix variable re-use --- adbb/jellyfin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adbb/jellyfin.py b/adbb/jellyfin.py index 8e0a468..c9cc7d3 100644 --- a/adbb/jellyfin.py +++ b/adbb/jellyfin.py @@ -247,14 +247,14 @@ def write_nfo(obj, nfo_path, fetch_fanart=True, dry_run=False): os.rename(tmpart, os.path.join(art_dir, fname)) if not all_arts['poster']: fname = 'poster.jpg' - tmpfile = os.path.join(art_dir, f'.{fname}.tmp') + tmpart = os.path.join(art_dir, f'.{fname}.tmp') try: - with open(tmpfile, 'wb') as f: + with open(tmpart, 'wb') as f: adbb.download_image(f, anime) - os.rename(tmpfile, os.path.join(art_dir, fname)) + os.rename(tmpart, os.path.join(art_dir, fname)) except urllib.error.HTTPError as e: adbb.log.error(f'Failed to download anidb image for {anime}: {e}') - os.remove(tmpfile) + os.remove(tmpart) os.rename(tmpfile, nfo_path)