From 63005eafc9ab695627f9dd9494b274d866a0605a Mon Sep 17 00:00:00 2001 From: mctaylors Date: Wed, 10 Jan 2024 16:46:47 +0300 Subject: [PATCH] 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 --- Cassette/Commands/ControlsCommandGroup.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Cassette/Commands/ControlsCommandGroup.cs b/Cassette/Commands/ControlsCommandGroup.cs index 4a79fcb..46b1b85 100644 --- a/Cassette/Commands/ControlsCommandGroup.cs +++ b/Cassette/Commands/ControlsCommandGroup.cs @@ -40,7 +40,13 @@ public sealed class ControlsCommandGroup( 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) { return await feedbackService.SendContextualMessageResult(