mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-12 10:54:55 +08:00
chores: rollback UpdateLyrics
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<Identity
|
||||
Name="37412.BetterLyrics"
|
||||
Publisher="CN=E1428B0E-DC1D-4EA4-ACB1-4556569D5BA9"
|
||||
Version="1.2.241.0" />
|
||||
Version="1.2.242.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="ca4a4830-fc19-40d9-b823-53e2bff3d816" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ namespace BetterLyrics.WinUI3.Services.GSMTCService
|
||||
{
|
||||
public partial class GSMTCService : IGSMTCService
|
||||
{
|
||||
private readonly DispatcherQueueTimer _refreshLyricsTimer;
|
||||
private LatestOnlyTaskRunner _refreshLyricsRunner = new();
|
||||
|
||||
[ObservableProperty][NotifyPropertyChangedRecipients] public partial LyricsData? CurrentLyricsData { get; private set; }
|
||||
|
||||
[ObservableProperty] public partial LyricsSearchResult? CurrentLyricsSearchResult { get; private set; }
|
||||
|
||||
private async Task RefreshLyricsAsync()
|
||||
private async Task RefreshLyricsAsync(CancellationToken token)
|
||||
{
|
||||
_logger.LogInformation("RefreshLyricsAsync");
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BetterLyrics.WinUI3.Services.GSMTCService
|
||||
if (CurrentSongInfo != SongInfoExtensions.Placeholder)
|
||||
{
|
||||
CurrentLyricsSearchResult = await Task.Run(async () => await _lyrcsSearchService.SearchSmartlyAsync(
|
||||
CurrentSongInfo, true, CurrentMediaSourceProviderInfo?.LyricsSearchType, CancellationToken.None));
|
||||
CurrentSongInfo, true, CurrentMediaSourceProviderInfo?.LyricsSearchType, token), token);
|
||||
|
||||
if (CurrentLyricsSearchResult != null)
|
||||
{
|
||||
@@ -37,8 +37,7 @@ namespace BetterLyrics.WinUI3.Services.GSMTCService
|
||||
|
||||
(CurrentLyricsData, CurrentLyricsSearchResult.TransliterationProvider, CurrentLyricsSearchResult.TranslationProvider) =
|
||||
await Task.Run(async () => await lyricsParser.Parse(
|
||||
_translationService, _transliterationService, _settingsService.AppSettings.TranslationSettings, CurrentLyricsSearchResult,
|
||||
CancellationToken.None));
|
||||
_translationService, _transliterationService, _settingsService.AppSettings.TranslationSettings, CurrentLyricsSearchResult, token), token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,10 +49,10 @@ namespace BetterLyrics.WinUI3.Services.GSMTCService
|
||||
|
||||
public async void UpdateLyrics()
|
||||
{
|
||||
_refreshLyricsTimer.Debounce(async () =>
|
||||
await _refreshLyricsRunner.RunAsync(async (token) =>
|
||||
{
|
||||
await RefreshLyricsAsync();
|
||||
}, Constants.Time.DebounceTimeout);
|
||||
await RefreshLyricsAsync(token);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -105,7 +105,6 @@ namespace BetterLyrics.WinUI3.Services.GSMTCService
|
||||
_scrobbleTimer.Tick += ScrobbleTimer_Tick;
|
||||
|
||||
_onMediaPropsChangedTimer = _dispatcherQueue.CreateTimer();
|
||||
_refreshLyricsTimer = _dispatcherQueue.CreateTimer();
|
||||
|
||||
_settingsService.AppSettings.MediaSourceProvidersInfo.ItemPropertyChanged += MediaSourceProvidersInfo_ItemPropertyChanged;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user