Skip to content

Commit

Permalink
Add user likes reslover
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry08 committed Jun 23, 2024
1 parent 59d0009 commit 18cf475
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SoundCloudDownloader.Core/Resolving/QueryResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ public async Task<QueryResult> ResolveAsync(
);
}

// User likes
if (_soundcloud.Users.IsLikesUrlValid(query))
{
var user = await _soundcloud.Users.GetAsync(query, cancellationToken);
var tracks = await _soundcloud.Users.GetLikedTracksAsync(query, cancellationToken);

foreach (var track in tracks)
track.ArtworkUrl ??= track.User?.AvatarUrl;

return new QueryResult(QueryResultKind.Playlist, $"Likes By {user.Username}", tracks);
}

// Track
if (await _soundcloud.Tracks.IsUrlValidAsync(query, cancellationToken))
{
Expand Down

0 comments on commit 18cf475

Please sign in to comment.