mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-07-01 20:30:41 +00:00
parent
3705c6c8b5
commit
ffd76f5f2b
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -19,7 +20,7 @@ namespace ZonyLrcTools.Cli.Infrastructure.Tag
|
|||||||
protected readonly ILogger<DefaultTagLoader> Logger;
|
protected readonly ILogger<DefaultTagLoader> Logger;
|
||||||
|
|
||||||
protected ToolOptions Options;
|
protected ToolOptions Options;
|
||||||
|
|
||||||
private readonly IEnumerable<ITagInfoProvider> _sortedTagInfoProviders;
|
private readonly IEnumerable<ITagInfoProvider> _sortedTagInfoProviders;
|
||||||
|
|
||||||
public DefaultTagLoader(IEnumerable<ITagInfoProvider> tagInfoProviders,
|
public DefaultTagLoader(IEnumerable<ITagInfoProvider> tagInfoProviders,
|
||||||
@ -39,16 +40,22 @@ namespace ZonyLrcTools.Cli.Infrastructure.Tag
|
|||||||
{
|
{
|
||||||
foreach (var provider in _sortedTagInfoProviders)
|
foreach (var provider in _sortedTagInfoProviders)
|
||||||
{
|
{
|
||||||
var info = await provider.LoadAsync(filePath);
|
try
|
||||||
if (info != null)
|
|
||||||
{
|
{
|
||||||
HandleBlockWord(info);
|
var info = await provider.LoadAsync(filePath);
|
||||||
return info;
|
if (info != null)
|
||||||
|
{
|
||||||
|
HandleBlockWord(info);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.LogWarning($"{filePath} 没有找到正确的标签信息,请考虑调整正则表达式。");
|
Logger.LogWarning($"{filePath} 没有找到正确的标签信息,请考虑调整正则表达式。");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,11 +65,11 @@ namespace ZonyLrcTools.Cli.Infrastructure.Tag
|
|||||||
{
|
{
|
||||||
throw new ErrorCodeException(ErrorCodes.LoadTagInfoProviderError);
|
throw new ErrorCodeException(ErrorCodes.LoadTagInfoProviderError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Options.Provider.Tag.Plugin
|
return Options.Provider.Tag.Plugin
|
||||||
.Where(x => x.Priority != -1)
|
.Where(x => x.Priority != -1)
|
||||||
.OrderBy(x => x.Priority)
|
.OrderBy(x => x.Priority)
|
||||||
.Join(TagInfoProviders,x=>x.Name,y=>y.Name,(x,y)=>y);
|
.Join(TagInfoProviders, x => x.Name, y => y.Name, (x, y) => y);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void HandleBlockWord(MusicInfo info)
|
protected void HandleBlockWord(MusicInfo info)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user