feat: Stream Now instant-play of a random track from the nav button
This commit is contained in:
@@ -62,6 +62,22 @@ public class TrackManager
|
||||
}
|
||||
}
|
||||
|
||||
// No base-name conflict, so this is a plain public method. Mirrors the nullable-on-empty
|
||||
// shape of GetById: pass with null when the library has no tracks.
|
||||
public async Task<ResultContainer<TrackDto?>> GetRandom(CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
var entity = await Repository.GetRandomAsync(cancellationToken);
|
||||
return ResultContainer<TrackDto?>.CreatePassResult(
|
||||
entity is null ? null : TrackConverter.Convert(entity));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return ResultContainer<TrackDto?>.CreateFailResult(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResultContainer<List<TrackDto>>> GetAll()
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user