enhanced: Optimized tag reader workflow.

Closes #93
This commit is contained in:
real-zony 2022-04-12 10:15:23 +08:00
parent 3705c6c8b5
commit ffd76f5f2b

View File

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -38,6 +39,8 @@ namespace ZonyLrcTools.Cli.Infrastructure.Tag
public virtual async ValueTask<MusicInfo> LoadTagAsync(string filePath)
{
foreach (var provider in _sortedTagInfoProviders)
{
try
{
var info = await provider.LoadAsync(filePath);
if (info != null)
@ -46,9 +49,13 @@ namespace ZonyLrcTools.Cli.Infrastructure.Tag
return info;
}
}
catch (Exception)
{
// ignored
}
}
Logger.LogWarning($"{filePath} 没有找到正确的标签信息,请考虑调整正则表达式。");
return null;
}
@ -62,7 +69,7 @@ namespace ZonyLrcTools.Cli.Infrastructure.Tag
return Options.Provider.Tag.Plugin
.Where(x => x.Priority != -1)
.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)