Skip to content

Commit

Permalink
replaygain2: handle subclasses of supported file formats
Browse files Browse the repository at this point in the history
This fixes file format detection when using e.g. the
compatible_TXXX plugin.
  • Loading branch information
phw committed Oct 7, 2024
1 parent 0ec78c2 commit 437b7a6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugins/replaygain2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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..."

Expand Down

0 comments on commit 437b7a6

Please sign in to comment.