From 437b7a6cb1f97f5c2b4ec3f23d52824b5e163cff Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Sun, 6 Oct 2024 15:00:44 +0530 Subject: [PATCH] replaygain2: handle subclasses of supported file formats This fixes file format detection when using e.g. the compatible_TXXX plugin. --- plugins/replaygain2/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/replaygain2/__init__.py b/plugins/replaygain2/__init__.py index e84cb4d4..de2df13a 100755 --- a/plugins/replaygain2/__init__.py +++ b/plugins/replaygain2/__init__.py @@ -30,7 +30,7 @@ This plugin is based on the original ReplayGain plugin by Philipp Wolfer and Sophist. ''' -PLUGIN_VERSION = "1.7" +PLUGIN_VERSION = "1.7.1" PLUGIN_API_VERSIONS = ["2.0"] PLUGIN_LICENSE = "GPL-2.0" PLUGIN_LICENSE_URL = "https://www.gnu.org/licenses/gpl-2.0.html" @@ -199,7 +199,7 @@ def calculate_replaygain(tracks, options): if not track.files: continue file = track.files[0] - if not type(file) in SUPPORTED_FORMATS: + if not isinstanceany(file, SUPPORTED_FORMATS): raise Exception(f"ReplayGain 2.0: File '{file.filename}' is of unsupported format") files.append(file.filename) valid_tracks.append(track) @@ -272,6 +272,10 @@ def calculate_replaygain(tracks, options): ) +def isinstanceany(obj, types): + return any(isinstance(obj, t) for t in types) + + class ScanTracks(BaseAction): NAME = "Calculate Replay&Gain..."