using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using MySql.Data.MySqlClient; using Roadie.Library.Caching; using Roadie.Library.Configuration; using Roadie.Library.Data; using Roadie.Library.Encoding; using Roadie.Library.Extensions; using Roadie.Library.SearchEngines.MetaData; using Roadie.Library.Utility; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using discogs = Roadie.Library.SearchEngines.MetaData.Discogs; namespace Roadie.Library.Engines { public class LabelLookupEngine : LookupEngineBase, ILabelLookupEngine { private ILabelSearchEngine DiscogsLabelSearchEngine { get; } public LabelLookupEngine(IRoadieSettings configuration, IHttpEncoder httpEncoder, IRoadieDbContext context, ICacheManager cacheManager, ILogger logger) : base(configuration, httpEncoder, context, cacheManager, logger) { this.DiscogsLabelSearchEngine = new discogs.DiscogsHelper(this.Configuration, this.CacheManager, this.Logger); } public async Task> Add(Label label) { SimpleContract.Requires(label != null, "Invalid Label"); try { var now = DateTime.UtcNow; label.AlternateNames = label.AlternateNames.AddToDelimitedList(new string[] { label.Name.ToAlphanumericName() }); if (!label.IsValid) { return new OperationResult