Skip to content

Commit beecf7f

Browse files
committed
Fix proposal when search result is already a pseudo-release
1 parent ba346dd commit beecf7f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

beetsplug/mbpseudo.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def before_album_info_emitted(
118118
self,
119119
items: Iterable[Item],
120120
album_info: AlbumInfo,
121-
):
121+
) -> AlbumInfo:
122122
if isinstance(album_info, PseudoAlbumInfo):
123123
for item in items:
124124
# particularly relevant for reimport but could also happen during import
@@ -177,7 +177,11 @@ def album_info(self, release: JSONDict) -> AlbumInfo:
177177
official_release = super().album_info(release)
178178

179179
if release.get("status") == _STATUS_PSEUDO:
180-
return official_release
180+
# already pseudo-release, but wrap in our class for the other checks
181+
return PseudoAlbumInfo(
182+
pseudo_release=official_release,
183+
official_release=official_release,
184+
)
181185
elif pseudo_release_ids := self._intercept_mb_release(release):
182186
custom_tags_only = self.config["custom_tags_only"].get(bool)
183187
languages = list(config["import"]["languages"].as_str_seq())
@@ -387,7 +391,7 @@ def __init__(
387391
**kwargs,
388392
):
389393
super().__init__(pseudo_release.tracks, **kwargs)
390-
self.__dict__["_pseudo_source"] = True
394+
self.__dict__["_pseudo_source"] = False
391395
self.__dict__["_official_release"] = official_release
392396
for k, v in pseudo_release.items():
393397
if k not in kwargs:

test/plugins/test_mbpseudo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def test_album_info_for_pseudo_release(
164164
pseudo_release: JSONDict,
165165
):
166166
album_info = mbpseudo_plugin.album_info(pseudo_release["release"])
167-
assert not isinstance(album_info, PseudoAlbumInfo)
167+
assert isinstance(album_info, PseudoAlbumInfo)
168168
assert album_info.data_source == "MusicBrainzPseudoRelease"
169169
assert album_info.albumstatus == _STATUS_PSEUDO
170170

0 commit comments

Comments
 (0)