Change requested track loading behavior

now TrackSearchMode.None will be used only if the local track has been found, otherwise TrackSearchMode.YouTube will be used.

thanks for the great idea @Yahton (even if he stole my project)

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2024-01-10 16:46:47 +03:00
parent 6e72646e2a
commit 63005eafc9
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1

View file

@ -40,7 +40,13 @@ public sealed class ControlsCommandGroup(
return Result.FromSuccess(); return Result.FromSuccess();
} }
var loadResult = await audioService.Tracks.LoadTracksAsync(query, TrackSearchMode.None); if (File.Exists(query))
{
var track = await audioService.Tracks.LoadTrackAsync(Path.GetFullPath(query), TrackSearchMode.None);
return await PlayTrackResultAsync(player, track);
}
var loadResult = await audioService.Tracks.LoadTracksAsync(query, TrackSearchMode.YouTube);
if (!loadResult.IsSuccess) if (!loadResult.IsSuccess)
{ {
return await feedbackService.SendContextualMessageResult( return await feedbackService.SendContextualMessageResult(