GET /tracks now merges the local catalog page with a live YouTube Music search (deduplicated against tracks already provisioned locally) whenever a name filter is given, appending the YouTube hits after the local matches and carrying a continuation token for further pages. Each item is tagged with its source via the new TrackSearchItemResponse/TracksSearchResponse shapes, wrapping the existing TrackApplicationResponse or a raw YouTubeSongResult so neither type had to change. GET /youtube/search is removed along with its now-unused handler; the web-player's explore page, its /api/tracks proxy, and the YouTube filler helper are updated to call the combined endpoint instead of hitting the two separately.
23 lines
1.0 KiB
C#
23 lines
1.0 KiB
C#
namespace Musify.Application.Tracks.Responses
|
|
{
|
|
/// <summary>Result of a combined tracks listing/search: a page of local catalog tracks
|
|
/// (uploads and previously provisioned YouTube tracks), plus, when a search term was given,
|
|
/// live YouTube Music hits appended after them. Pagination metadata (<see cref="PageNumber"/>,
|
|
/// <see cref="PageSize"/>, <see cref="PageCount"/>, <see cref="TotalItemCount"/>) describes only
|
|
/// the local page — YouTube has no stable total, so its continuation is tracked separately via
|
|
/// <see cref="NextYoutubeContinuationToken"/>.</summary>
|
|
public record TracksSearchResponse(
|
|
IReadOnlyList<TrackSearchItemResponse> Items,
|
|
int PageNumber,
|
|
int PageSize,
|
|
int PageCount,
|
|
int TotalItemCount,
|
|
bool HasPreviousPage,
|
|
bool HasNextLocalPage,
|
|
string? NextYoutubeContinuationToken,
|
|
bool YoutubeUnavailable)
|
|
{
|
|
public bool HasNextPage => HasNextLocalPage || !string.IsNullOrEmpty(NextYoutubeContinuationToken);
|
|
}
|
|
}
|