You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
623 B
28 lines
623 B
using Recyclarr.Common.Extensions;
|
|
using Recyclarr.ServarrApi.Tag;
|
|
|
|
namespace Recyclarr.Cli.Pipelines.Tags;
|
|
|
|
public class ServiceTagCache : IPipelineCache
|
|
{
|
|
private readonly HashSet<SonarrTag> _serviceTags = new();
|
|
|
|
public IEnumerable<SonarrTag> Tags => _serviceTags;
|
|
|
|
public void AddTags(IEnumerable<SonarrTag> tags)
|
|
{
|
|
_serviceTags.AddRange(tags);
|
|
}
|
|
|
|
public int? GetTagIdByName(string name)
|
|
{
|
|
var foundTag = _serviceTags.FirstOrDefault(x => x.Label.EqualsIgnoreCase(name));
|
|
return foundTag?.Id;
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
_serviceTags.Clear();
|
|
}
|
|
}
|