Repository navigation
add: standardized playlist metadata in /v4/loadtracks - #272
Conversation
|
All Contributors have signed the CLA. The PR is now allowed to be merged. |
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
1Lucas1apk
left a comment
There was a problem hiding this comment.
Thanks for putting this together. I reviewed the current diff and the playlist normalization/source changes are substantial, but this PR still introduces versioned test files in a repository that has no approved test layout or test runner. Please remove these four files from the PR: src/utils/loadTracksPlaylist.test.ts, src/utils/playlistNormalizer.test.ts, dist/src/utils/loadTracksPlaylist.test.js, and dist/src/utils/playlistNormalizer.test.js. Please don't move them into a newly created test directory or add a runner/CLI; keep any local reproduction outside the checkout. I have not changed your branch. The implementation/build still needs independent upstream validation after the cleanup.
1Lucas1apk
left a comment
There was a problem hiding this comment.
The four versioned test files from the existing review are still in this diff: src/utils/loadTracksPlaylist.test.ts, src/utils/playlistNormalizer.test.ts, dist/src/utils/loadTracksPlaylist.test.js and dist/src/utils/playlistNormalizer.test.js. Please remove them as previously requested. I also found two production issues in the current HEAD; the inline comments point to the exact code and the affected source adapters.
- remove test files from repository per maintainer request - preserve upstream total tracks and correctly detect partial playlists - fetch YouTube playlist metadata when authorUrl/description is missing
- remove description from NormalizedPlaylistInfo and PlaylistPluginInfo - strip description handling across all source adapters - clean description completely from normalizePlaylistData
|
Hi @1Lucas1apk, thank you for the feedback! I have pushed updates covering all requested changes across two clean commits: 1. Address Review Feedback (
|
1Lucas1apk
left a comment
There was a problem hiding this comment.
I rechecked the updated head 628d4fd across the changed source files and generated output. The four versioned test files are now gone, and the total-count changes address the earlier findings for Spotify, Apple Music, Bandcamp, Deezer, SoundCloud, Tidal and YouTube. I still found two data-integrity issues that prevent approval.
Qobuz is still affected by the exact partial-playlist bug from the previous review. src/sources/qobuz.ts:499-504 still calls capTotalTracks() on the upstream tracks_count / tracks.total before returning the playlist. With 1,200 upstream tracks, maxPlaylistLength=1,000 and 1,000 loaded tracks, that passes totalTracks=1,000 to this normalizer. The comparison at line 295 then reports a complete collection and the normalizer derives totalDuration from only the loaded tracks. I reproduced that result using the current Qobuz code path. Qobuz album resolution also still returns an empty pluginInfo object at src/sources/qobuz.ts:448-457; when the album is truncated, the normalizer has no upstream total to distinguish it from a complete album. Please preserve the upstream totals for both Qobuz playlists and albums.
The new isExplicit inference also treats a partial collection as definitively non-explicit when all returned tracks have isExplicit=false. The 1,000 loaded tracks may all be clean while one of the 200 omitted tracks is explicit. In that case data.info.isExplicit=false is not supported by the available data. Please only infer false when the collection is complete, unless the provider supplies an authoritative collection-level value; a partial collection with no explicit track in the loaded subset must remain unknown.
The current PR head has no associated upstream status checks or workflow runs. The author reports a successful type-check, but I could not independently run the repository build here because the checkout environment cannot resolve GitHub. These missing runtime checks are not the reason for this request; the two reproducible metadata issues above are.
- preserve upstream track totals in Qobuz playlist and album resolvers - populate collection metadata for Qobuz albums and propagate partial status - implement accurate three-state isExplicit inference for partial collections
|
Hi @1Lucas1apk, thank you for catching these edge cases! I have addressed both issues in the latest commit:
Everything has been recompiled into |
1Lucas1apk
left a comment
There was a problem hiding this comment.
The two issues from my previous review are fixed in this head: Qobuz now preserves upstream totals for both albums and playlists, and isExplicit remains unknown for partial collections unless an explicit track or an authoritative collection-level value establishes it.
One YouTube edge case remains. The current metadata fetch condition can skip _fetchPlaylistMeta() when author, artworkUrl and authorUrl are already present, even when totalTracks is missing. In that case meta.totalTracks is never populated and the fallback below uses playlist.tracks.length as the upstream total. A playlist truncated at maxPlaylistLength is then marked complete, which can make totalDuration incorrectly represent only the loaded tracks. Please also trigger the metadata fetch when the upstream total is unavailable, or retrieve that count independently.
I also rechecked the changed source adapters: there are no remaining capTotalTracks references in the modified adapters. The latest head has no associated GitHub status checks or PR workflow runs. I could not independently run the full build/type-check in this environment; those checks are reported by the author, not verified by me.
- fetch playlist metadata when current.totalTracks is missing or unverified - resolve rawTotalTracks and isPartial accurately without fabricating totals - enhance totalTracks extraction across YouTube and YouTube Music headers
|
Hi @1Lucas1apk, thank you for pointing out this case! I have addressed it in the latest commit: YouTube Playlist Metadata & Upstream Track Count Fix
The fix has been recompiled into |
1Lucas1apk
left a comment
There was a problem hiding this comment.
I noticed one compatibility issue in src/utils/playlistNormalizer.ts, in normalizePlaylistData(): the normalizer deletes description from both pluginInfo and info. pluginInfo is the source-specific extension object, so this removes metadata that existing clients may already consume, even though this PR is only trying to standardize info. Could you leave pluginInfo.description intact and omit/normalize the field only in the standardized info object? That keeps the new metadata contract without silently stripping existing source data.
- remove delete pluginInfo.description from normalizePlaylistData - ensure source-specific pluginInfo extension metadata remains intact - maintain strict exclusion of description from standardized data.info
|
Hi @1Lucas1apk, thank you for pointing this out! I have addressed this in the latest commit: Preserved Source-Specific
|
1Lucas1apk
left a comment
There was a problem hiding this comment.
I rechecked the latest head dc2ef22. The previous Qobuz fixes are present, the YouTube metadata request now also checks for a valid upstream total, and pluginInfo.description is preserved. The remaining blocker is how the normalizer handles an explicitly unknown total.
YouTubeSource._applyPlaylistMeta() now deliberately writes pluginInfo.totalTracks = null when the page request fails or no track count can be parsed (src/sources/youtube/YouTube.ts:1702-1726). But buildPlaylistInfo() ignores that null in candidateTotals and then falls back to loadedTracks whenever isPartial is not true (src/utils/playlistNormalizer.ts:287-301). Therefore, with 1,000 loaded tracks and no verifiable page total, the normalized response still says totalTracks=1000, omits isPartial, and sets totalDuration to the sum of the 1,000 loaded tracks. I reproduced this exact path against the current branch logic. That contradicts the new safe-fallback behavior described in the latest PR comment and can still report an incomplete YouTube collection as complete.
Please preserve the distinction between a known complete collection and an unknown upstream total. For example, an explicit totalTracks: null should not be converted into loadedTracks, and totalDuration should remain unknown when completeness cannot be established. The previous review findings are otherwise addressed. The current head still has no GitHub status checks or PR workflow runs, so I cannot independently verify the author's reported type-check/build here.
Preserve explicitly unknown upstream track totals (totalTracks: null) during playlist normalization instead of falling back to loadedTracks. Distinguish between confirmed complete, confirmed partial, and unknown completeness states. Prevent unverified collections from reporting loaded duration as full duration or inferring isExplicit: false.
|
Hi @1Lucas1apk, I have resolved the issue regarding unverified collection completeness and duration inference in commit What was resolved:
Also, could you please check your DMs on Discord from |
1Lucas1apk
left a comment
There was a problem hiding this comment.
I rechecked the latest head e89ae37. The explicit-unknown-total handling is now fixed: a totalTracks: null value remains unknown, totalDuration is not inferred from loaded tracks, and isExplicit: false is not inferred without confirmed completeness. The YouTube changes also preserve this state, and the generated dist normalizer contains the corresponding logic.
There is still a broader completeness bug in the new default at src/utils/playlistNormalizer.ts:305-313. When no total and no isPartial value are supplied, this branch treats the collection as confirmed complete. SourceManager now applies this normalizer to every playlist result (src/managers/sourceManager.ts:550-565), but several existing adapters intentionally cap or paginate their results without forwarding completeness metadata:
- Mixcloud stops loading when
tracks.lengthreachesmaxTrackseven if the last response still haspageInfo.hasNextPage === true(src/sources/mixcloud.ts:465-493; the user collection path does the same at:543-575). Both return a playlist withoutpluginInfo.totalTracksorisPartial. - Pandora truncates album annotations with
limitArray(..., getMaxPlaylistLength())(src/sources/pandora.ts:722-730) and requests playlist tracks withlimit/annotationLimitset to the configured maximum (:842-850), but neither result passes a total or partial flag to the normalizer (:732-738,:879-885). - Gaana slices the mapped tracks to
getLoadLimit(type)(src/sources/gaana.ts:844-851) and returns only type/URL/artwork/author metadata (:854-860), so the normalizer cannot tell when this slice discarded tracks.
For these cases, the new fallback reports totalTracks=loadedTracks and derives totalDuration from the loaded subset. This is the same false-completeness result the previous YouTube fixes were intended to prevent, just through other adapters. Please propagate upstream totals / isPartial where available, and explicitly preserve unknown completeness when an adapter has capped or paginated results but cannot establish the original total. Please audit the other limited adapters (including VK Music and JioSaavn) for the same pattern before treating metadata-free results as confirmed complete.
The latest head still has no associated status checks or PR workflow runs. I cannot independently confirm the claimed build/type-check in this environment; the current PR description also still lists a dist/src/utils/*.test.js command even though that directory contains no matching test files. The two earlier Qobuz and explicit-inference findings are fixed, but these remaining source paths still block approval.
|
Correction to my last review: I rechecked the exact glob in the current head. |
Remove unsafe completeness assumption for metadata-free collections in playlistNormalizer, treating them as unknown rather than complete. Update Mixcloud, Pandora, Gaana, VK Music, JioSaavn, Audius, Yandex Music, and Google Drive source adapters to accurately propagate upstream totals and explicit completeness indicators.
|
Hi @1Lucas1apk, I have comprehensively resolved the collection completeness issue across the repository in commit What was resolved:
|
1Lucas1apk
left a comment
There was a problem hiding this comment.
Revi o novo commit ed15012. A mudança no normalizador resolve o problema geral de coleções sem metadados: agora elas permanecem com total e duração desconhecidos, em vez de serem tratadas como completas. Também conferi as correções de Mixcloud, Pandora, Gaana, VK Music e JioSaavn, além da saída compilada.
Ainda encontrei um caminho que volta a fabricar completude: em src/sources/yandexmusic.ts:850-875, _getAlbum() usa tracks.length como albumTotal quando album.trackCount não existe e, em seguida, define isPartial como false quando as faixas carregadas correspondem a esse valor. A requisição é limitada por page-size, então a ausência de trackCount não prova que a resposta contém o álbum inteiro. Nesse cenário o adaptador envia totalTracks igual às faixas carregadas e isPartial: false, permitindo que o normalizador calcule totalDuration apenas com a parte recebida. Mantenha totalTracks como null e não envie isPartial: false quando o total não for conhecido, a menos que a resposta da API confirme que a coleção terminou.
O mesmo trecho está presente em dist/src/sources/yandexmusic.js:640-675. Não encontrei status checks nem workflow runs associados ao HEAD atual; as execuções de type-check/build descritas no comentário são do autor e não pude validá-las independentemente.
Replacing this review because it was posted in the wrong language.
1Lucas1apk
left a comment
There was a problem hiding this comment.
I reviewed the new commit ed15012. The normalizer change fixes the general case where collections have no metadata: their total and duration now remain unknown instead of being treated as complete. I also checked the adapter updates in Mixcloud, Pandora, Gaana, VK Music and JioSaavn, including the generated output.
There is still one path that incorrectly claims completeness. In src/sources/yandexmusic.ts:850-875, _getAlbum() falls back to tracks.length when album.trackCount is missing, then sets isPartial to false when the loaded count matches that fallback. The request is bounded by page-size, so a missing trackCount does not prove that the API returned the entire album. This sends totalTracks equal to the loaded tracks and isPartial: false, allowing the normalizer to calculate totalDuration from only the returned subset. Keep totalTracks as null and omit isPartial: false unless the API provides evidence that the collection is complete.
The same logic is present in dist/src/sources/yandexmusic.js:640-675. I found no status checks or workflow runs associated with the current HEAD. The successful type-check/build mentioned in the author's comment has not been independently verified here.
Avoid falling back to loaded track length when album.trackCount is missing in Yandex Music _getAlbum(). Ensure totalTracks resolves to null and isPartial is omitted when upstream album completeness cannot be verified.
|
Hi @1Lucas1apk, I have resolved the Yandex Music album completeness fallback in commit What was resolved:
|
1Lucas1apk
left a comment
There was a problem hiding this comment.
I rechecked the updated HEAD 9655b3d. The Yandex Music album resolver now preserves an unknown upstream total: src/sources/yandexmusic.ts:853-861 keeps albumTotal as null when trackCount is absent or invalid and omits isPartial; dist/src/sources/yandexmusic.js:669-677 contains the matching generated output. The playlist resolver applies the same unknown-total handling at src/sources/yandexmusic.ts:1019-1035.
The previous completeness findings are addressed in the current adapters and normalizer, and the removed test files are no longer part of the PR diff. I found no remaining code blocker in the reviewed changes.
There are no GitHub status checks or PR workflow runs associated with this HEAD. I could not independently run npm run type-check or npm run build in this environment; the author reports both passing, along with the targeted Yandex validation and git diff --check.
Changes
Centralized Playlist Normalization (
src/utils/playlistNormalizer.ts):/v4/loadtracksendpoint.data.info:name,selectedTrack,identifier,uri,artworkUrl,author,authorUrl,sourceName,totalTracks,loadedTracks,totalDuration,loadedDuration, andisAlbum.YouTube Music Album Metadata Enhancements (
src/sources/youtube/playlistMeta.ts):playlistHeaderRenderer.subtitleon YouTube Music album pages (OLAK...) whenownerTextis absent.Type Definitions & Source Cleanup (
src/typings/sources/source.types.ts,src/typings/index.types.ts):NormalizedPlaylistInfo,PlaylistInfo, andRawPlaylistInfointerfaces to reflect the omitted/optional fields while preserving protocol compatibility.Automated Tests & Build (
src/utils/*.test.ts,dist/):dist/.Why
Clients and bot developers currently have to fetch and aggregate individual tracks manually or send secondary API requests to obtain basic playlist details such as duration, cover art, author, album type, and upstream identifiers.
This enhancement delivers standardized playlist metadata directly inside
/v4/loadtrackswithout breaking Lavalink v4 client compatibility.Checkmarks
Additional information
OLAK5uy_...), Spotify playlists/albums, and local collections.npm run type-check: Passed with 0 errors.npm run build: Compiled cleanly intodist/.node --test dist/src/utils/*.test.js: All 28 / 28 unit tests passing with 0 failures.