From 2c3aca23e1e6ec773b5d9bc103b245231391c37e Mon Sep 17 00:00:00 2001 From: lonebyte <61915324+lonebyte@users.noreply.github.com> Date: Wed, 14 Jun 2023 20:25:18 +0200 Subject: [PATCH 1/2] Fix the sorting of fanart.tv covers fanart.tv uses a string to output the number of likes (see https://fanart.tv/api-docs/api-v3/). In order to sort numerically we need to convert the string into an int. --- beetsplug/fetchart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index b508a5f66..3259dfa53 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -590,7 +590,7 @@ class FanartTV(RemoteArtSource): self._log.debug('fanart.tv: unexpected mb_releasegroupid in ' 'response!') - matches.sort(key=lambda x: x['likes'], reverse=True) + matches.sort(key=lambda x: int(x['likes']), reverse=True) for item in matches: # fanart.tv has a strict size requirement for album art to be # uploaded From 8c6c2f00837e3f022e374e1a04694bcdc05bcbac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=BCller?= Date: Wed, 14 Jun 2023 23:01:48 +0200 Subject: [PATCH 2/2] Update changelog.rst --- docs/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index da8e23d32..6d1dc02bb 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -185,6 +185,8 @@ Bug fixes: * Fix updating "data_source" on re-imports and improve logging when flexible attributes are being re-imported. :bug:`4726` +* :doc:`/plugins/fetchart`: Correctly select the cover art from fanart.tv with + the highest number of likes For packagers: