mirror of https://github.com/Nezreka/SoulSync.git
#918: iTunes album fetch no longer truncates albums >50 tracks
iTunes get_album_tracks called _lookup(id, entity='song') with no limit. The iTunes Lookup API returns only 50 related entities unless limit is passed (max 200), so albums over 50 tracks showed only the first 50 in the download window. Pass limit=200 on the main lookup AND the fallback- storefront request. Proven against the live iTunes API on the reporter's exact album (Frieren OST, id 1739445636, 70 tracks): no limit -> 50 songs, limit=200 -> 70 songs. Spotify already paginates; Deezer uses limit=500 — iTunes was the only truncating source. Regression test asserts limit=200 is requested.pull/919/head
parent
600a744f7f
commit
cce7df4f3d
@ -0,0 +1,46 @@
|
||||
"""iTunes album-track fetch must request the full album, not the 50-entity default (#918).
|
||||
|
||||
The iTunes Lookup API returns only 50 related entities unless `limit` is passed (max 200),
|
||||
so albums >50 tracks were truncated to the first 50 in the download window. get_album_tracks
|
||||
must pass limit=200.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from core import itunes_client as ic
|
||||
|
||||
|
||||
class _Cache:
|
||||
"""Cache stub: always a miss; any write method is a no-op."""
|
||||
def get_entity(self, *a, **k):
|
||||
return None
|
||||
|
||||
def __getattr__(self, _name):
|
||||
return lambda *a, **k: None
|
||||
|
||||
|
||||
_RESULTS = [
|
||||
{'wrapperType': 'collection', 'collectionId': 123, 'collectionName': 'Big OST',
|
||||
'artistName': 'Composer', 'trackCount': 70, 'artworkUrl100': 'http://x/100x100bb.jpg'},
|
||||
{'wrapperType': 'track', 'kind': 'song', 'trackId': 1, 'trackName': 'Track 1',
|
||||
'trackNumber': 1, 'discNumber': 1, 'artistName': 'Composer', 'trackTimeMillis': 1000},
|
||||
]
|
||||
|
||||
|
||||
def test_get_album_tracks_requests_limit_200(monkeypatch):
|
||||
client = ic.iTunesClient(country='US')
|
||||
captured = {}
|
||||
|
||||
def fake_lookup(**params):
|
||||
captured.update(params)
|
||||
return _RESULTS
|
||||
|
||||
monkeypatch.setattr(client, '_lookup', fake_lookup)
|
||||
monkeypatch.setattr(ic, 'get_metadata_cache', lambda: _Cache())
|
||||
|
||||
result = client.get_album_tracks('123')
|
||||
|
||||
assert captured.get('limit') == 200 # #918: full album, not the iTunes 50 default
|
||||
assert captured.get('entity') == 'song'
|
||||
assert captured.get('id') == '123'
|
||||
assert result is not None
|
||||
Loading…
Reference in new issue