mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-12 10:54:55 +08:00
fix: add error parser placeholder
This commit is contained in:
@@ -131,25 +131,23 @@ namespace BetterLyrics.WinUI3.Models
|
||||
return result;
|
||||
}
|
||||
|
||||
public static LyricsData GetNotfoundPlaceholder(int durationMs)
|
||||
public static LyricsData GetNotfoundPlaceholder()
|
||||
{
|
||||
return new LyricsData([new LyricsLine
|
||||
{
|
||||
StartMs = 0,
|
||||
EndMs = durationMs,
|
||||
EndMs = (int)TimeSpan.FromMinutes(99).TotalMilliseconds,
|
||||
OriginalText = _resourceService.GetLocalizedString("LyricsNotFound"),
|
||||
LyricsChars = [],
|
||||
}]);
|
||||
}
|
||||
|
||||
public static LyricsData GetParseErrorPlaceholder(int durationMs)
|
||||
public static LyricsData GetParseErrorPlaceholder()
|
||||
{
|
||||
return new LyricsData([new LyricsLine
|
||||
{
|
||||
StartMs = 0,
|
||||
EndMs = durationMs,
|
||||
EndMs = (int)TimeSpan.FromMinutes(99).TotalMilliseconds,
|
||||
OriginalText = _resourceService.GetLocalizedString("LyricsParseError"),
|
||||
LyricsChars = [],
|
||||
}]);
|
||||
}
|
||||
|
||||
@@ -160,10 +158,7 @@ namespace BetterLyrics.WinUI3.Models
|
||||
{
|
||||
StartMs = 0,
|
||||
EndMs = (int)TimeSpan.FromMinutes(99).TotalMilliseconds,
|
||||
PhoneticText = "",
|
||||
OriginalText = "● ● ●",
|
||||
TranslatedText = "",
|
||||
LyricsChars = [],
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
LyricsDataArr = [];
|
||||
if (string.IsNullOrWhiteSpace(lyricsSearchResult?.Raw))
|
||||
{
|
||||
LyricsDataArr.Add(LyricsData.GetNotfoundPlaceholder((int)(songInfo?.DurationMs ?? 0)));
|
||||
LyricsDataArr.Add(LyricsData.GetNotfoundPlaceholder());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -46,6 +46,11 @@ namespace BetterLyrics.WinUI3.Parsers.LyricsParser
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (LyricsDataArr.Count == 0)
|
||||
{
|
||||
LyricsDataArr.Add(LyricsData.GetParseErrorPlaceholder());
|
||||
}
|
||||
}
|
||||
LoadTranslation(lyricsSearchResult);
|
||||
LoadTransliteration(lyricsSearchResult);
|
||||
|
||||
Reference in New Issue
Block a user