From 1b94baca63f67578b2b869cf103aa08857542bf1 Mon Sep 17 00:00:00 2001 From: "Dr.Blank" <64108942+Dr-Blank@users.noreply.github.com> Date: Tue, 4 Feb 2025 21:16:06 +0530 Subject: [PATCH 1/6] Handle potential OSError when unlinking temporary files in ArtResizer --- beets/util/artresizer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/beets/util/artresizer.py b/beets/util/artresizer.py index 09cc29e0d..898ffeab8 100644 --- a/beets/util/artresizer.py +++ b/beets/util/artresizer.py @@ -655,7 +655,10 @@ class ArtResizer(metaclass=Shareable): ) finally: if result_path != path_in: - os.unlink(path_in) + try: + os.unlink(path_in) + except OSError: + pass return result_path @property From 01d61c722bf12cb8895cd403b0b50eb114f9209a Mon Sep 17 00:00:00 2001 From: "Dr.Blank" <64108942+Dr-Blank@users.noreply.github.com> Date: Wed, 12 Mar 2025 15:07:14 +0530 Subject: [PATCH 2/6] add changelog --- docs/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 62cd0c4cc..ec7861f98 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -70,6 +70,8 @@ Bug fixes: * :doc:`plugins/lyrics`: Fix plugin crash when ``genius`` backend returns empty lyrics. :bug:`5583` +* Handle potential OSError when unlinking temporary files in ArtResizer. + :bug:`5615` For packagers: From e85f67ac7b91be7792bfbc610adcfed0d1cf3b0c Mon Sep 17 00:00:00 2001 From: "Dr.Blank" <64108942+Dr-Blank@users.noreply.github.com> Date: Fri, 16 Jan 2026 15:43:01 +0530 Subject: [PATCH 3/6] refactor: suppress OSError when unlinking temporary files in ArtResizer --- beets/util/artresizer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/beets/util/artresizer.py b/beets/util/artresizer.py index 23dce3c9f..b9401cca8 100644 --- a/beets/util/artresizer.py +++ b/beets/util/artresizer.py @@ -21,6 +21,7 @@ import os.path import platform import re import subprocess +from contextlib import suppress from itertools import chain from urllib.parse import urlencode @@ -660,10 +661,8 @@ class ArtResizer(metaclass=Shareable): ) finally: if result_path != path_in: - try: + with suppress(OSError): os.unlink(path_in) - except OSError: - pass return result_path @property From b0bce805189dbcc84a4421108ca0c340d8adcf4c Mon Sep 17 00:00:00 2001 From: "Dr.Blank" <64108942+Dr-Blank@users.noreply.github.com> Date: Fri, 16 Jan 2026 15:50:09 +0530 Subject: [PATCH 4/6] remove changelog not related to pr --- docs/changelog.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 881b9faa2..097e3bc3b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -474,15 +474,8 @@ Bug fixes: result. Update the default ``sources`` configuration to prioritize ``lrclib`` over other sources since it returns reliable results quicker than others. :bug:`5102` -* :doc:`plugins/lyrics`: Fix the issue with ``genius`` backend not being able - to match lyrics when there is a slight variation in the artist name. - :bug:`4791` -* :doc:`plugins/lyrics`: Fix plugin crash when ``genius`` backend returns empty - lyrics. - :bug:`5583` * Handle potential OSError when unlinking temporary files in ArtResizer. :bug:`5615` -* ImageMagick 7.1.1-44 is now supported. - :doc:`plugins/lyrics`: Fix the issue with ``genius`` backend not being able to match lyrics when there is a slight variation in the artist name. :bug:`4791` - :doc:`plugins/lyrics`: Fix plugin crash when ``genius`` backend returns empty From 4ad5871ef020633d9f438d9112288b9b3d6f54f6 Mon Sep 17 00:00:00 2001 From: "Dr.Blank" <64108942+Dr-Blank@users.noreply.github.com> Date: Fri, 16 Jan 2026 15:53:34 +0530 Subject: [PATCH 5/6] fix: sort imports --- beets/util/artresizer.py | 2 +- docs/changelog.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/beets/util/artresizer.py b/beets/util/artresizer.py index 6f6a7b99e..ae1476101 100644 --- a/beets/util/artresizer.py +++ b/beets/util/artresizer.py @@ -24,8 +24,8 @@ import platform import re import subprocess from abc import ABC, abstractmethod -from enum import Enum from contextlib import suppress +from enum import Enum from itertools import chain from typing import TYPE_CHECKING, Any, ClassVar from urllib.parse import urlencode diff --git a/docs/changelog.rst b/docs/changelog.rst index 097e3bc3b..f7a6f9d48 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -474,7 +474,7 @@ Bug fixes: result. Update the default ``sources`` configuration to prioritize ``lrclib`` over other sources since it returns reliable results quicker than others. :bug:`5102` -* Handle potential OSError when unlinking temporary files in ArtResizer. +- Handle potential OSError when unlinking temporary files in ArtResizer. :bug:`5615` - :doc:`plugins/lyrics`: Fix the issue with ``genius`` backend not being able to match lyrics when there is a slight variation in the artist name. :bug:`4791` From 52284ff7ed9ae38a25c9c5e76c697e47e7c6d4a5 Mon Sep 17 00:00:00 2001 From: "Dr.Blank" <64108942+Dr-Blank@users.noreply.github.com> Date: Sat, 17 Jan 2026 14:30:22 +0530 Subject: [PATCH 6/6] fix: changelog entry --- docs/changelog.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f7a6f9d48..5408d2a5c 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -48,6 +48,8 @@ New features: Bug fixes: +- Handle potential OSError when unlinking temporary files in ArtResizer. + :bug:`5615` - :doc:`/plugins/spotify`: Updated Spotify API credentials. :bug:`6270` - :doc:`/plugins/smartplaylist`: Fixed an issue where multiple queries in a playlist configuration were not preserving their order, causing items to @@ -474,8 +476,6 @@ Bug fixes: result. Update the default ``sources`` configuration to prioritize ``lrclib`` over other sources since it returns reliable results quicker than others. :bug:`5102` -- Handle potential OSError when unlinking temporary files in ArtResizer. - :bug:`5615` - :doc:`plugins/lyrics`: Fix the issue with ``genius`` backend not being able to match lyrics when there is a slight variation in the artist name. :bug:`4791` - :doc:`plugins/lyrics`: Fix plugin crash when ``genius`` backend returns empty