mirror of
https://github.com/sphildreth/roadie
synced 2025-02-19 14:38:28 +00:00
WIP
This commit is contained in:
parent
c3656625ae
commit
151b035c34
31 changed files with 269 additions and 345 deletions
RoadieApi/Services
RoadieLibrary
Caching
Extensions
Factories
FilePlugins
Logging
Processors
SearchEngines
Imaging
BingImageSearchEngine.csIImageSearchManager.csITunesSearchEngine.csImageSearchEngineBase.csImageSearchManager.cs
MetaData
|
@ -10,8 +10,10 @@ using Roadie.Library.Identity;
|
|||
using Roadie.Library.Imaging;
|
||||
using Roadie.Library.Models;
|
||||
using Roadie.Library.Models.Users;
|
||||
using Roadie.Library.SearchEngines.Imaging;
|
||||
using Roadie.Library.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -451,5 +453,33 @@ namespace Roadie.Api.Services
|
|||
OperationTime = sw.ElapsedMilliseconds
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<OperationResult<IEnumerable<ImageSearchResult>>> ImageProvidersSearch(string query)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
//var sw = new Stopwatch();
|
||||
//sw.Start();
|
||||
//var errors = new List<string>();
|
||||
//IEnumerable<ImageSearchResult> searchResults = null;
|
||||
//try
|
||||
//{
|
||||
// var manager = new ImageSearchManager(this.Configuration, this.CacheManager, this.Logger);
|
||||
// searchResults = await manager.ImageSearch(query);
|
||||
//}
|
||||
//catch (System.Exception ex)
|
||||
//{
|
||||
// this._logger.Error(ex);
|
||||
// errors.Add(ex.ToString());
|
||||
//}
|
||||
//sw.Stop();
|
||||
//return new ImageSearchResultModel
|
||||
//{
|
||||
// IsSuccess = true,
|
||||
// OperationTime = sw.ElapsedMilliseconds,
|
||||
// Errors = errors,
|
||||
// SearchResults = searchResults
|
||||
//};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -64,7 +64,7 @@ namespace Roadie.Library.Caching
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.LogError(ex, null, null);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return default(TOut);
|
||||
}
|
||||
|
|
14
RoadieLibrary/Extensions/LoggerExt.cs
Normal file
14
RoadieLibrary/Extensions/LoggerExt.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Extensions.Logging
|
||||
{
|
||||
public static class LoggerExtensions
|
||||
{
|
||||
public static void LogError(this ILogger logger, Exception ex)
|
||||
{
|
||||
logger.LogError(default(EventId), ex, null, null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MySql.Data.MySqlClient;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
|
@ -7,7 +8,6 @@ using Roadie.Library.Encoding;
|
|||
using Roadie.Library.Enums;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Imaging;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData.Audio;
|
||||
using Roadie.Library.Processors;
|
||||
using Roadie.Library.Utility;
|
||||
|
@ -119,7 +119,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.Error(ex, "Sql [" + sql + "] Exception [" + ex.Serialize() + "]");
|
||||
this._logger.LogError(ex, "Sql [" + sql + "] Exception [" + ex.Serialize() + "]");
|
||||
}
|
||||
}
|
||||
if (ArtistImages != null && ArtistImages.Any(x => x.Status == Statuses.New))
|
||||
|
@ -136,12 +136,12 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
inserted = await this.DbContext.SaveChangesAsync();
|
||||
}
|
||||
this.Logger.Info("Added New Artist: [{0}]", artist.ToString());
|
||||
this.Logger.LogInformation("Added New Artist: [{0}]", artist.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
return new OperationResult<Artist>
|
||||
{
|
||||
|
@ -174,13 +174,13 @@ namespace Roadie.Library.Factories
|
|||
this.DbContext.Artists.Remove(Artist);
|
||||
await this.DbContext.SaveChangesAsync();
|
||||
this._cacheManager.ClearRegion(Artist.CacheRegion);
|
||||
this.Logger.Info(string.Format("x DeleteArtist [{0}]", Artist.Id));
|
||||
this.Logger.LogInformation(string.Format("x DeleteArtist [{0}]", Artist.Id));
|
||||
isSuccess = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
return new OperationResult<bool>
|
||||
{
|
||||
Errors = new Exception[1] { ex }
|
||||
|
@ -206,7 +206,7 @@ namespace Roadie.Library.Factories
|
|||
sw.Stop();
|
||||
if (Artist == null || !Artist.IsValid)
|
||||
{
|
||||
this._logger.Trace("ArtistFactory: Artist Not Found By External Ids: MusicbrainzId [{0}], iTunesIs [{1}], AmgId [{2}], SpotifyId [{3}]", musicBrainzId, iTunesId, amgId, spotifyId);
|
||||
this._logger.LogTrace("ArtistFactory: Artist Not Found By External Ids: MusicbrainzId [{0}], iTunesIs [{1}], AmgId [{2}], SpotifyId [{3}]", musicBrainzId, iTunesId, amgId, spotifyId);
|
||||
}
|
||||
return new OperationResult<Artist>
|
||||
{
|
||||
|
@ -240,7 +240,7 @@ namespace Roadie.Library.Factories
|
|||
sw.Stop();
|
||||
if (Artist == null || !Artist.IsValid)
|
||||
{
|
||||
this._logger.Info("ArtistFactory: Artist Not Found By Name [{0}]", ArtistName);
|
||||
this._logger.LogInformation("ArtistFactory: Artist Not Found By Name [{0}]", ArtistName);
|
||||
if (doFindIfNotInDatabase)
|
||||
{
|
||||
OperationResult<Artist> ArtistSearch = null;
|
||||
|
@ -250,7 +250,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
if (ArtistSearch.IsSuccess)
|
||||
{
|
||||
|
@ -263,7 +263,7 @@ namespace Roadie.Library.Factories
|
|||
if (!addResult.IsSuccess)
|
||||
{
|
||||
sw.Stop();
|
||||
this.Logger.Fatal("Unable To Add Artist For MetaData [{0}]", metaData.ToString());
|
||||
this.Logger.LogWarning("Unable To Add Artist For MetaData [{0}]", metaData.ToString());
|
||||
return new OperationResult<Artist>
|
||||
{
|
||||
OperationTime = sw.ElapsedMilliseconds,
|
||||
|
@ -292,7 +292,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
return new OperationResult<Artist>();
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.Warning(ex.ToString());
|
||||
this._logger.LogWarning(ex.ToString());
|
||||
}
|
||||
var artistFolder = ArtistToMerge.ArtistFileFolder(this.Configuration, this.Configuration.LibraryFolder);
|
||||
foreach (var release in this.DbContext.Releases.Include("Artist").Where(x => x.ArtistId == ArtistToMerge.Id).ToArray())
|
||||
|
@ -452,7 +452,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, "iTunesArtistSearch: " + ex.Serialize());
|
||||
this.Logger.LogError(ex, "iTunesArtistSearch: " + ex.Serialize());
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -511,7 +511,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, "MusicBrainzArtistSearch: " + ex.Serialize());
|
||||
this.Logger.LogError(ex, "MusicBrainzArtistSearch: " + ex.Serialize());
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -570,7 +570,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, "LastFMArtistSearch: " + ex.Serialize());
|
||||
this.Logger.LogError(ex, "LastFMArtistSearch: " + ex.Serialize());
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -621,7 +621,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, "SpotifyArtistSearch: " + ex.Serialize());
|
||||
this.Logger.LogError(ex, "SpotifyArtistSearch: " + ex.Serialize());
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -665,7 +665,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, "DiscogsArtistSearch: " + ex.Serialize());
|
||||
this.Logger.LogError(ex, "DiscogsArtistSearch: " + ex.Serialize());
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -697,7 +697,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, "WikipediaArtistSearch: " + ex.Serialize());
|
||||
this.Logger.LogError(ex, "WikipediaArtistSearch: " + ex.Serialize());
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -757,7 +757,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, "CombiningResults: " + ex.Serialize());
|
||||
this.Logger.LogError(ex, "CombiningResults: " + ex.Serialize());
|
||||
}
|
||||
result.SortName = result.SortName.ToTitleCase();
|
||||
if (!string.IsNullOrEmpty(result.ArtistType))
|
||||
|
@ -801,7 +801,7 @@ namespace Roadie.Library.Factories
|
|||
break;
|
||||
|
||||
default:
|
||||
this.Logger.Warning(string.Format("Unknown Artist Type [{0}]", result.ArtistType));
|
||||
this.Logger.LogWarning(string.Format("Unknown Artist Type [{0}]", result.ArtistType));
|
||||
result.ArtistType = "Other";
|
||||
break;
|
||||
}
|
||||
|
@ -834,7 +834,7 @@ namespace Roadie.Library.Factories
|
|||
var Artist = this.DbContext.Artists.FirstOrDefault(x => x.RoadieId == ArtistId);
|
||||
if (Artist == null)
|
||||
{
|
||||
this.Logger.Fatal("Unable To Find Artist [{0}]", ArtistId);
|
||||
this.Logger.LogWarning("Unable To Find Artist [{0}]", ArtistId);
|
||||
return new OperationResult<bool>();
|
||||
}
|
||||
|
||||
|
@ -848,7 +848,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
if (ArtistSearch.IsSuccess)
|
||||
{
|
||||
|
@ -860,7 +860,7 @@ namespace Roadie.Library.Factories
|
|||
await this.DbContext.SaveChangesAsync();
|
||||
sw.Stop();
|
||||
this.CacheManager.ClearRegion(Artist.CacheRegion);
|
||||
this.Logger.Info("Scanned RefreshArtistMetadata [{0}], OperationTime [{1}]", Artist.ToString(), sw.ElapsedMilliseconds);
|
||||
this.Logger.LogInformation("Scanned RefreshArtistMetadata [{0}], OperationTime [{1}]", Artist.ToString(), sw.ElapsedMilliseconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -870,7 +870,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
resultErrors.Add(ex);
|
||||
}
|
||||
return new OperationResult<bool>
|
||||
|
@ -895,7 +895,7 @@ namespace Roadie.Library.Factories
|
|||
var Artist = this.DbContext.Artists.Include("releases").FirstOrDefault(x => x.RoadieId == artistId);
|
||||
if (Artist == null)
|
||||
{
|
||||
this.Logger.Fatal("Unable To Find Artist [{0}]", artistId);
|
||||
this.Logger.LogWarning("Unable To Find Artist [{0}]", artistId);
|
||||
return new OperationResult<bool>();
|
||||
}
|
||||
var releaseScannedCount = 0;
|
||||
|
@ -914,7 +914,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -934,11 +934,11 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
sw.Stop();
|
||||
this.CacheManager.ClearRegion(Artist.CacheRegion);
|
||||
this.Logger.Info("Scanned Artist [{0}], Releases Scanned [{1}], OperationTime [{2}]", Artist.ToString(), releaseScannedCount, sw.ElapsedMilliseconds);
|
||||
this.Logger.LogInformation("Scanned Artist [{0}], Releases Scanned [{1}], OperationTime [{2}]", Artist.ToString(), releaseScannedCount, sw.ElapsedMilliseconds);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
resultErrors.Add(ex);
|
||||
}
|
||||
return new OperationResult<bool>
|
||||
|
@ -999,14 +999,14 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
}
|
||||
|
||||
var newArtistFolder = Artist.ArtistFileFolder(this.Configuration, destinationFolder ?? this.Configuration.LibraryFolder);
|
||||
if (!originalArtistFolder.Equals(newArtistFolder, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
this.Logger.Trace("Moving Artist From Folder [{0}] To [{1}]", originalArtistFolder, newArtistFolder);
|
||||
this.Logger.LogTrace("Moving Artist From Folder [{0}] To [{1}]", originalArtistFolder, newArtistFolder);
|
||||
// Directory.Move(originalArtistFolder, Artist.ArtistFileFolder(destinationFolder ?? SettingsHelper.Instance.LibraryFolder));
|
||||
// TODO if name changed then update Artist track files to have new Artist name
|
||||
}
|
||||
|
@ -1057,7 +1057,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Data;
|
||||
using Roadie.Library.Encoding;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData.LastFm;
|
||||
using Roadie.Library.MetaData.MusicBrainz;
|
||||
using Roadie.Library.SearchEngines.Imaging;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Data;
|
||||
using Roadie.Library.Encoding;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Imaging;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData.Audio;
|
||||
using Roadie.Library.Processors;
|
||||
using Roadie.Library.Utility;
|
||||
|
@ -103,7 +103,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
return imageMetaData;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
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.Logging;
|
||||
using Roadie.Library.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -45,12 +45,12 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return new OperationResult<Label>
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ namespace Roadie.Library.Factories
|
|||
sw.Stop();
|
||||
if (Label == null || !Label.IsValid)
|
||||
{
|
||||
this._logger.Info("LabelFactory: Label Not Found By Name [{0}]", LabelName);
|
||||
this._logger.LogInformation("LabelFactory: Label Not Found By Name [{0}]", LabelName);
|
||||
if (doFindIfNotInDatabase)
|
||||
{
|
||||
OperationResult<Label> LabelSearch = null;
|
||||
|
@ -106,7 +106,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
if (LabelSearch.IsSuccess)
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return new OperationResult<Label>();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Data;
|
||||
using Roadie.Library.Encoding;
|
||||
using Roadie.Library.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MySql.Data.MySqlClient;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
|
@ -7,7 +8,6 @@ using Roadie.Library.Encoding;
|
|||
using Roadie.Library.Enums;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Imaging;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData.Audio;
|
||||
using Roadie.Library.MetaData.LastFm;
|
||||
using Roadie.Library.MetaData.MusicBrainz;
|
||||
|
@ -85,7 +85,8 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
}
|
||||
|
||||
public ReleaseFactory(IRoadieSettings configuration, IHttpEncoder httpEncoder, IRoadieDbContext context, ICacheManager cacheManager, ILogger logger, LabelFactory labelFactory = null, ArtistFactory artistFactory = null) : base(configuration, context, cacheManager, logger, httpEncoder)
|
||||
public ReleaseFactory(IRoadieSettings configuration, IHttpEncoder httpEncoder, IRoadieDbContext context, ICacheManager cacheManager, ILogger logger, LabelFactory labelFactory = null, ArtistFactory artistFactory = null)
|
||||
: base(configuration, context, cacheManager, logger, httpEncoder)
|
||||
{
|
||||
this._labelFactory = labelFactory ?? new LabelFactory(configuration, httpEncoder, context, CacheManager, logger);
|
||||
this._artistFactory = artistFactory ?? new ArtistFactory(configuration, httpEncoder, context, CacheManager, logger);
|
||||
|
@ -123,7 +124,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
if (inserted > 0 && release.Id > 0)
|
||||
{
|
||||
|
@ -157,7 +158,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.Error(ex, "Sql [" + sql + "]");
|
||||
this._logger.LogError(ex, "Sql [" + sql + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +181,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,7 +208,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
}
|
||||
if (doAddTracksInDatabase)
|
||||
|
@ -274,17 +275,17 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.Logger.Info("Added New Release: [{0}]", release.ToString());
|
||||
this.Logger.LogInformation("Added New Release: [{0}]", release.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
return new OperationResult<Data.Release>
|
||||
{
|
||||
|
@ -315,7 +316,7 @@ namespace Roadie.Library.Factories
|
|||
var newReleaseFolder = release.ReleaseFileFolder(artistFolder);
|
||||
if (!oldReleaseFolder.Equals(newReleaseFolder, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
this.Logger.Trace("Moving Release From Folder [{0}] To [{1}]", oldReleaseFolder, newReleaseFolder);
|
||||
this.Logger.LogTrace("Moving Release From Folder [{0}] To [{1}]", oldReleaseFolder, newReleaseFolder);
|
||||
|
||||
// Create the new release folder
|
||||
if (!Directory.Exists(newReleaseFolder))
|
||||
|
@ -402,12 +403,12 @@ namespace Roadie.Library.Factories
|
|||
if (File.Exists(trackPath))
|
||||
{
|
||||
File.Delete(trackPath);
|
||||
this.Logger.Warning("x For Release [{0}], Deleted File [{1}]", release.Id, trackPath);
|
||||
this.Logger.LogWarning("x For Release [{0}], Deleted File [{1}]", release.Id, trackPath);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, string.Format("Error Deleting File [{0}] For Track [{1}] Exception [{2}]", trackPath, track.Id, ex.Serialize()));
|
||||
this.Logger.LogError(ex, string.Format("Error Deleting File [{0}] For Track [{1}] Exception [{2}]", trackPath, track.Id, ex.Serialize()));
|
||||
}
|
||||
}
|
||||
try
|
||||
|
@ -416,7 +417,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
}
|
||||
this.DbContext.Releases.Remove(release);
|
||||
|
@ -429,7 +430,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, string.Format("Error Clearing Cache For Release [{0}] Exception [{1}]", release.Id, ex.Serialize()));
|
||||
this.Logger.LogError(ex, string.Format("Error Clearing Cache For Release [{0}] Exception [{1}]", release.Id, ex.Serialize()));
|
||||
}
|
||||
sw.Stop();
|
||||
return new OperationResult<bool>
|
||||
|
@ -520,7 +521,7 @@ namespace Roadie.Library.Factories
|
|||
sw.Stop();
|
||||
if (release == null || !release.IsValid)
|
||||
{
|
||||
this._logger.Info("ReleaseFactory: Release Not Found For Artist [{0}] MetaData [{1}]", artist.ToString(), metaData.ToString());
|
||||
this._logger.LogInformation("ReleaseFactory: Release Not Found For Artist [{0}] MetaData [{1}]", artist.ToString(), metaData.ToString());
|
||||
if (doFindIfNotInDatabase)
|
||||
{
|
||||
OperationResult<Data.Release> releaseSearch = new OperationResult<Data.Release>();
|
||||
|
@ -531,7 +532,7 @@ namespace Roadie.Library.Factories
|
|||
catch (Exception ex)
|
||||
{
|
||||
sw.Stop();
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
return new OperationResult<Data.Release>
|
||||
{
|
||||
OperationTime = sw.ElapsedMilliseconds,
|
||||
|
@ -568,7 +569,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return new OperationResult<Data.Release>();
|
||||
}
|
||||
|
@ -792,7 +793,7 @@ namespace Roadie.Library.Factories
|
|||
if (File.Exists(mergedFileToDelete))
|
||||
{
|
||||
File.Delete(mergedFileToDelete);
|
||||
this.Logger.Warning("x Deleted Merged File [{0}]", mergedFileToDelete);
|
||||
this.Logger.LogWarning("x Deleted Merged File [{0}]", mergedFileToDelete);
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
@ -855,7 +856,7 @@ namespace Roadie.Library.Factories
|
|||
|
||||
if (this.ITunesReleaseSearchEngine.IsEnabled)
|
||||
{
|
||||
this.Logger.Trace("ITunesReleaseSearchEngine Release Search for ArtistName [{0}], ReleaseTitle [{1}]", metaData.Artist, result.Title);
|
||||
this.Logger.LogTrace("ITunesReleaseSearchEngine Release Search for ArtistName [{0}], ReleaseTitle [{1}]", metaData.Artist, result.Title);
|
||||
var iTunesResult = await this.ITunesReleaseSearchEngine.PerformReleaseSearch(metaData.Artist, result.Title, 1);
|
||||
if (iTunesResult.IsSuccess)
|
||||
{
|
||||
|
@ -911,7 +912,7 @@ namespace Roadie.Library.Factories
|
|||
|
||||
if (this.MusicBrainzReleaseSearchEngine.IsEnabled)
|
||||
{
|
||||
this.Logger.Trace("MusicBrainzReleaseSearchEngine Release Search for ArtistName [{0}], ReleaseTitle [{1}]", metaData.Artist, result.Title);
|
||||
this.Logger.LogTrace("MusicBrainzReleaseSearchEngine Release Search for ArtistName [{0}], ReleaseTitle [{1}]", metaData.Artist, result.Title);
|
||||
var mbResult = await this.MusicBrainzReleaseSearchEngine.PerformReleaseSearch(metaData.Artist, result.Title, 1);
|
||||
if (mbResult.IsSuccess)
|
||||
{
|
||||
|
@ -972,7 +973,7 @@ namespace Roadie.Library.Factories
|
|||
|
||||
if (this.LastFmReleaseSearchEngine.IsEnabled)
|
||||
{
|
||||
this.Logger.Trace("LastFmReleaseSearchEngine Release Search for ArtistName [{0}], ReleaseTitle [{1}]", metaData.Artist, result.Title);
|
||||
this.Logger.LogTrace("LastFmReleaseSearchEngine Release Search for ArtistName [{0}], ReleaseTitle [{1}]", metaData.Artist, result.Title);
|
||||
var lastFmResult = await this.LastFmReleaseSearchEngine.PerformReleaseSearch(metaData.Artist, result.Title, 1);
|
||||
if (lastFmResult.IsSuccess)
|
||||
{
|
||||
|
@ -1035,7 +1036,7 @@ namespace Roadie.Library.Factories
|
|||
|
||||
if (this.SpotifyReleaseSearchEngine.IsEnabled)
|
||||
{
|
||||
this.Logger.Trace("SpotifyReleaseSearchEngine Release Search for ArtistName [{0}], ReleaseTitle [{1}]", metaData.Artist, result.Title);
|
||||
this.Logger.LogTrace("SpotifyReleaseSearchEngine Release Search for ArtistName [{0}], ReleaseTitle [{1}]", metaData.Artist, result.Title);
|
||||
var spotifyResult = await this.SpotifyReleaseSearchEngine.PerformReleaseSearch(metaData.Artist, result.Title, 1);
|
||||
if (spotifyResult.IsSuccess)
|
||||
{
|
||||
|
@ -1093,7 +1094,7 @@ namespace Roadie.Library.Factories
|
|||
|
||||
if (this.DiscogsReleaseSearchEngine.IsEnabled)
|
||||
{
|
||||
this.Logger.Trace("DiscogsReleaseSearchEngine Release Search for ArtistName [{0}], ReleaseTitle [{1}]", metaData.Artist, result.Title);
|
||||
this.Logger.LogTrace("DiscogsReleaseSearchEngine Release Search for ArtistName [{0}], ReleaseTitle [{1}]", metaData.Artist, result.Title);
|
||||
var discogsResult = await this.DiscogsReleaseSearchEngine.PerformReleaseSearch(metaData.Artist, result.Title, 1);
|
||||
if (discogsResult.IsSuccess)
|
||||
{
|
||||
|
@ -1141,14 +1142,14 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._logger.Error(ex);
|
||||
this._logger.LogError(ex);
|
||||
}
|
||||
|
||||
this.Logger.Trace("Metadata Providers Search Complete. [{0}]", sw.ElapsedMilliseconds);
|
||||
this.Logger.LogTrace("Metadata Providers Search Complete. [{0}]", sw.ElapsedMilliseconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Logger.Trace("Skipped Metadata Providers Search, DontDoMetaDataProvidersSearchArtists set for Artist [{0}].", metaData.Artist);
|
||||
this.Logger.LogTrace("Skipped Metadata Providers Search, DontDoMetaDataProvidersSearchArtists set for Artist [{0}].", metaData.Artist);
|
||||
}
|
||||
|
||||
if (result.AlternateNames != null)
|
||||
|
@ -1318,7 +1319,7 @@ namespace Roadie.Library.Factories
|
|||
{
|
||||
// Read image and convert to jpeg
|
||||
result.Thumbnail = File.ReadAllBytes(coverFileName);
|
||||
this.Logger.Debug("Using Release Cover File [{0}]", coverFileName);
|
||||
this.Logger.LogDebug("Using Release Cover File [{0}]", coverFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1356,7 +1357,7 @@ namespace Roadie.Library.Factories
|
|||
var release = releaseToScan ?? this.DbContext.Releases.Include(x => x.Artist).FirstOrDefault(x => x.RoadieId == releaseId);
|
||||
if (release == null)
|
||||
{
|
||||
this.Logger.Fatal("Unable To Find Release [{0}]", releaseId);
|
||||
this.Logger.LogCritical("Unable To Find Release [{0}]", releaseId);
|
||||
return new OperationResult<bool>();
|
||||
}
|
||||
// This is recorded from metadata and if set then used to gauage if the release is complete
|
||||
|
@ -1366,7 +1367,7 @@ namespace Roadie.Library.Factories
|
|||
var releaseDirectory = new DirectoryInfo(releasePath);
|
||||
if (!Directory.Exists(releasePath))
|
||||
{
|
||||
this.Logger.Warning("Unable To Find Release Folder [{0}] For Release [{1}]", releasePath, release.ToString());
|
||||
this.Logger.LogWarning("Unable To Find Release Folder [{0}] For Release [{1}]", releasePath, release.ToString());
|
||||
}
|
||||
var now = DateTime.UtcNow;
|
||||
|
||||
|
@ -1381,7 +1382,7 @@ namespace Roadie.Library.Factories
|
|||
|
||||
if (!File.Exists(trackPath))
|
||||
{
|
||||
this.Logger.Warning("Track [{0}], File [{1}] Not Found.", existingTrack.ToString(), trackPath);
|
||||
this.Logger.LogWarning("Track [{0}], File [{1}] Not Found.", existingTrack.ToString(), trackPath);
|
||||
if (!doJustInfo)
|
||||
{
|
||||
existingTrack.UpdateTrackMissingFile(now);
|
||||
|
@ -1560,13 +1561,13 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
else
|
||||
{
|
||||
this.Logger.Fatal("Release Track File Has Invalid MetaData [{0}]", audioMetaData.ToString());
|
||||
this.Logger.LogWarning("Release Track File Has Invalid MetaData [{0}]", audioMetaData.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Logger.Warning("Unable To Find Releaes Path [{0}] For Release [{1}]", releasePath, release.ToString());
|
||||
this.Logger.LogWarning("Unable To Find Releaes Path [{0}] For Release [{1}]", releasePath, release.ToString());
|
||||
}
|
||||
var releaseMediaNumbersFound = new List<short?>();
|
||||
foreach (var kp in releaseMediaTracksFound)
|
||||
|
@ -1582,7 +1583,7 @@ namespace Roadie.Library.Factories
|
|||
var areTracksForRelaseMediaSequential = releaseMediaFoundInFolderTrackNumbers.Zip(releaseMediaFoundInFolderTrackNumbers.Skip(1), (a, b) => (a + 1) == b).All(x => x);
|
||||
if (!areTracksForRelaseMediaSequential)
|
||||
{
|
||||
this.Logger.Debug("ReleaseMedia [{0}] Track Numbers Are Not Sequential", releaseMedia.Id);
|
||||
this.Logger.LogDebug("ReleaseMedia [{0}] Track Numbers Are Not Sequential", releaseMedia.Id);
|
||||
}
|
||||
releaseMedia.TrackCount = kp.Value;
|
||||
releaseMedia.LastUpdated = now;
|
||||
|
@ -1627,17 +1628,17 @@ namespace Roadie.Library.Factories
|
|||
await this.DbContext.SaveChangesAsync();
|
||||
this.CacheManager.ClearRegion(release.Artist.CacheRegion);
|
||||
this.CacheManager.ClearRegion(release.CacheRegion);
|
||||
this.Logger.Info("Update Thumbnail using Release Cover File [{0}]", coverFileName);
|
||||
this.Logger.LogInformation("Update Thumbnail using Release Cover File [{0}]", coverFileName);
|
||||
}
|
||||
}
|
||||
|
||||
sw.Stop();
|
||||
this.Logger.Info("Scanned Release [{0}] Folder [{1}], Modified Release [{2}], OperationTime [{3}]", release.ToString(), releasePath, modifiedRelease, sw.ElapsedMilliseconds);
|
||||
this.Logger.LogInformation("Scanned Release [{0}] Folder [{1}], Modified Release [{2}], OperationTime [{3}]", release.ToString(), releasePath, modifiedRelease, sw.ElapsedMilliseconds);
|
||||
result = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, "ReleasePath [" + releasePath + "] " + ex.Serialize());
|
||||
this.Logger.LogError(ex, "ReleasePath [" + releasePath + "] " + ex.Serialize());
|
||||
resultErrors.Add(ex);
|
||||
}
|
||||
return new OperationResult<bool>
|
||||
|
@ -1716,7 +1717,7 @@ namespace Roadie.Library.Factories
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Encoding;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Factories;
|
||||
using Roadie.Library.Imaging;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData.Audio;
|
||||
using Roadie.Library.MetaData.LastFm;
|
||||
using Roadie.Library.MetaData.MusicBrainz;
|
||||
|
@ -75,7 +75,8 @@ namespace Roadie.Library.FilePlugins
|
|||
ReleaseFactory releaseFactory,
|
||||
ImageFactory imageFactory,
|
||||
ICacheManager cacheManager,
|
||||
ILogger logger) : base(configuration, httpEncoder, artistFactory, releaseFactory, imageFactory, cacheManager, logger)
|
||||
ILogger logger)
|
||||
: base(configuration, httpEncoder, artistFactory, releaseFactory, imageFactory, cacheManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -92,7 +93,7 @@ namespace Roadie.Library.FilePlugins
|
|||
var minWeight = this.MinWeightToDelete;
|
||||
if (metaData.ValidWeight < minWeight && minWeight > 0)
|
||||
{
|
||||
this.Logger.Trace("Invalid File{3}: ValidWeight [{0}], Under MinWeightToDelete [{1}]. Deleting File [{2}]", metaData.ValidWeight, minWeight, fileInfo.FullName, doJustInfo ? " [Read Only Mode] " : string.Empty);
|
||||
this.Logger.LogTrace("Invalid File{3}: ValidWeight [{0}], Under MinWeightToDelete [{1}]. Deleting File [{2}]", metaData.ValidWeight, minWeight, fileInfo.FullName, doJustInfo ? " [Read Only Mode] " : string.Empty);
|
||||
if (!doJustInfo)
|
||||
{
|
||||
fileInfo.Delete();
|
||||
|
@ -118,17 +119,17 @@ namespace Roadie.Library.FilePlugins
|
|||
var artistFolder = await this.DetermineArtistFolder(dr, metaData, doJustInfo);
|
||||
if (string.IsNullOrEmpty(artistFolder))
|
||||
{
|
||||
this.Logger.Warning("Unable To Find ArtistFolder [{0}] For MetaData [{1}]", artistFolder, metaData.ToString());
|
||||
this.Logger.LogWarning("Unable To Find ArtistFolder [{0}] For MetaData [{1}]", artistFolder, metaData.ToString());
|
||||
return new OperationResult<bool>("Unable To Find Artist Folder");
|
||||
}
|
||||
var releaseFolder = await this.DetermineReleaseFolder(artistFolder, metaData, doJustInfo, submissionId);
|
||||
if (string.IsNullOrEmpty(releaseFolder))
|
||||
{
|
||||
this.Logger.Warning("Unable To Find ReleaseFolder For MetaData [{0}]", metaData.ToString());
|
||||
this.Logger.LogWarning("Unable To Find ReleaseFolder For MetaData [{0}]", metaData.ToString());
|
||||
return new OperationResult<bool>("Unable To Find Release Folder");
|
||||
}
|
||||
destinationName = FolderPathHelper.TrackFullPath(this.Configuration, metaData, dr, artistFolder);
|
||||
this.Logger.Trace("Info: FileInfo [{0}], Artist Folder [{1}], Destination Name [{2}]", fileInfo.FullName, artistFolder, destinationName);
|
||||
this.Logger.LogTrace("Info: FileInfo [{0}], Artist Folder [{1}], Destination Name [{2}]", fileInfo.FullName, artistFolder, destinationName);
|
||||
|
||||
if (doJustInfo)
|
||||
{
|
||||
|
@ -147,7 +148,7 @@ namespace Roadie.Library.FilePlugins
|
|||
{
|
||||
var i = new FileInfo(imageFile);
|
||||
var iName = i.Name.ToLower().Trim();
|
||||
this.Logger.Debug("Found Image File [{0}] [{1}]", imageFile, iName);
|
||||
this.Logger.LogDebug("Found Image File [{0}] [{1}]", imageFile, iName);
|
||||
var isCoverArtType = iName.StartsWith("cover") || iName.StartsWith("folder") || iName.StartsWith("front") || iName.StartsWith("release") || iName.StartsWith("album");
|
||||
if (isCoverArtType)
|
||||
{
|
||||
|
@ -164,7 +165,7 @@ namespace Roadie.Library.FilePlugins
|
|||
File.WriteAllBytes(coverFileName, imageBytes);
|
||||
i.Delete();
|
||||
}
|
||||
this.Logger.Debug("Found Image File [{0}], Moved to release folder", i.Name);
|
||||
this.Logger.LogDebug("Found Image File [{0}], Moved to release folder", i.Name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +188,7 @@ namespace Roadie.Library.FilePlugins
|
|||
{
|
||||
if (!existingMetaData.IsValid || (currentBitRate > existingBitRate))
|
||||
{
|
||||
this.Logger.Trace("Newer Is Better: Deleting Existing File [{0}]", existing);
|
||||
this.Logger.LogTrace("Newer Is Better: Deleting Existing File [{0}]", existing);
|
||||
if (!doJustInfo)
|
||||
{
|
||||
existing.Delete();
|
||||
|
@ -196,7 +197,7 @@ namespace Roadie.Library.FilePlugins
|
|||
}
|
||||
else
|
||||
{
|
||||
this.Logger.Trace("Existing [{0}] Is Better or Equal: Deleting Found File [{1}]", existing, fileInfo.FullName);
|
||||
this.Logger.LogTrace("Existing [{0}] Is Better or Equal: Deleting Found File [{1}]", existing, fileInfo.FullName);
|
||||
if (!doJustInfo)
|
||||
{
|
||||
fileInfo.Delete();
|
||||
|
@ -206,7 +207,7 @@ namespace Roadie.Library.FilePlugins
|
|||
}
|
||||
else
|
||||
{
|
||||
this.Logger.Trace("Moving File To [{0}]", destinationName);
|
||||
this.Logger.LogTrace("Moving File To [{0}]", destinationName);
|
||||
if (!doJustInfo)
|
||||
{
|
||||
fileInfo.MoveTo(destinationName);
|
||||
|
@ -240,7 +241,7 @@ namespace Roadie.Library.FilePlugins
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this._loggingService.Error(ex, ex.Serialize());
|
||||
this._logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Encoding;
|
||||
using Roadie.Library.Factories;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData.ID3Tags;
|
||||
using Roadie.Library.Utility;
|
||||
using System;
|
||||
|
@ -19,7 +19,7 @@ namespace Roadie.Library.FilePlugins
|
|||
protected readonly IRoadieSettings _configuration = null;
|
||||
protected readonly IHttpEncoder _httpEncoder = null;
|
||||
protected readonly ImageFactory _imageFactory = null;
|
||||
protected readonly ILogger _loggingService = null;
|
||||
protected readonly ILogger _logger = null;
|
||||
protected readonly ReleaseFactory _releaseFactory = null;
|
||||
protected Audio _audioPlugin = null;
|
||||
protected ID3TagsHelper _id3TagsHelper = null;
|
||||
|
@ -101,7 +101,7 @@ namespace Roadie.Library.FilePlugins
|
|||
{
|
||||
get
|
||||
{
|
||||
return this._loggingService;
|
||||
return this._logger;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ namespace Roadie.Library.FilePlugins
|
|||
this._releaseFactory = releaseFactory;
|
||||
this._imageFactory = imageFactory;
|
||||
this._cacheManager = cacheManager;
|
||||
this._loggingService = logger;
|
||||
this._logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Roadie.Library.Logging
|
||||
{
|
||||
public interface ILogger
|
||||
{
|
||||
string Name { get; }
|
||||
|
||||
void Debug(string message);
|
||||
|
||||
void Debug(string message, params object[] args);
|
||||
|
||||
void Error(string message);
|
||||
|
||||
void Error(string message, params object[] args);
|
||||
|
||||
void Error(Exception exception, string message = null, bool isStackTraceIncluded = true);
|
||||
|
||||
void Fatal(string message);
|
||||
|
||||
void Fatal(string message, params object[] args);
|
||||
|
||||
void Fatal(Exception exception, string message = null, bool isStackTraceIncluded = true);
|
||||
|
||||
void Info(string message);
|
||||
|
||||
void Info(string message, params object[] args);
|
||||
|
||||
void Trace(string message);
|
||||
|
||||
void Trace(string message, params object[] args);
|
||||
|
||||
void Warning(string message);
|
||||
|
||||
void Warning(string message, params object[] args);
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
using Serilog;
|
||||
using Serilog.Sinks.SystemConsole.Themes;
|
||||
using System;
|
||||
|
||||
namespace Roadie.Library.Logging
|
||||
{
|
||||
public sealed class Logger : ILogger
|
||||
{
|
||||
private Serilog.Core.Logger _log = null;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Roadie Serilog Logger";
|
||||
}
|
||||
}
|
||||
|
||||
public Logger()
|
||||
{
|
||||
this._log = new LoggerConfiguration()
|
||||
.MinimumLevel.Verbose()
|
||||
.WriteTo.Console(theme: AnsiConsoleTheme.Literate)
|
||||
.WriteTo.File("logs//log-.txt", Serilog.Events.LogEventLevel.Debug)
|
||||
.WriteTo.File("logs//errors-.txt", Serilog.Events.LogEventLevel.Error)
|
||||
.CreateLogger();
|
||||
}
|
||||
|
||||
public void Debug(string message)
|
||||
{
|
||||
this._log.Debug(message);
|
||||
}
|
||||
|
||||
public void Debug(string message, params object[] args)
|
||||
{
|
||||
this._log.Debug(message, args);
|
||||
}
|
||||
|
||||
public void Error(string message)
|
||||
{
|
||||
this._log.Error(message);
|
||||
}
|
||||
|
||||
public void Error(string message, params object[] args)
|
||||
{
|
||||
this._log.Error(message, args);
|
||||
}
|
||||
|
||||
public void Error(Exception exception, string message = null, bool isStackTraceIncluded = true)
|
||||
{
|
||||
this._log.Error(exception, message);
|
||||
}
|
||||
|
||||
public void Fatal(string message)
|
||||
{
|
||||
this._log.Fatal(message);
|
||||
}
|
||||
|
||||
public void Fatal(string message, params object[] args)
|
||||
{
|
||||
this._log.Fatal(message, args);
|
||||
}
|
||||
|
||||
public void Fatal(Exception exception, string message = null, bool isStackTraceIncluded = true)
|
||||
{
|
||||
this._log.Fatal(exception, message);
|
||||
}
|
||||
|
||||
public void Info(string message)
|
||||
{
|
||||
this._log.Information(message);
|
||||
}
|
||||
|
||||
public void Info(string message, params object[] args)
|
||||
{
|
||||
this._log.Information(message, args);
|
||||
}
|
||||
|
||||
public void Trace(string message)
|
||||
{
|
||||
this._log.Verbose(message);
|
||||
}
|
||||
|
||||
public void Trace(string message, params object[] args)
|
||||
{
|
||||
this._log.Verbose(message, args);
|
||||
}
|
||||
|
||||
public void Warning(string message)
|
||||
{
|
||||
this._log.Warning(message);
|
||||
}
|
||||
|
||||
public void Warning(string message, params object[] args)
|
||||
{
|
||||
this._log.Warning(message, args);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Data;
|
||||
using Roadie.Library.Encoding;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.FilePlugins;
|
||||
using Roadie.Library.Logging;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
@ -35,7 +36,7 @@ namespace Roadie.Library.Processors
|
|||
{
|
||||
if (t.GetInterface("IFilePlugin") != null && !t.IsAbstract && !t.IsInterface)
|
||||
{
|
||||
IFilePlugin plugin = Activator.CreateInstance(t, new object[] { this.ArtistFactory, this.ReleaseFactory, this.ImageFactory, this.CacheManager, this.LoggingService }) as IFilePlugin;
|
||||
IFilePlugin plugin = Activator.CreateInstance(t, new object[] { this.ArtistFactory, this.ReleaseFactory, this.ImageFactory, this.CacheManager, this.Logger }) as IFilePlugin;
|
||||
plugins.Add(plugin);
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +115,7 @@ namespace Roadie.Library.Processors
|
|||
if (File.Exists(fileInfo.FullName))
|
||||
{
|
||||
var df = Path.Combine(this.UnknownFolder, string.Format("{0}~{1}~{2}", Guid.NewGuid(), fileInfo.Directory.Name, fileInfo.Name));
|
||||
this.LoggingService.Debug("Moving Unknown/Invalid File [{0}] -> [{1}] to UnknownFolder", fileInfo.FullName, df);
|
||||
this.Logger.LogDebug("Moving Unknown/Invalid File [{0}] -> [{1}] to UnknownFolder", fileInfo.FullName, df);
|
||||
fileInfo.MoveTo(df);
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +126,7 @@ namespace Roadie.Library.Processors
|
|||
}
|
||||
catch (System.IO.PathTooLongException ex)
|
||||
{
|
||||
this.LoggingService.Error(ex, string.Format("Error Processing File. File Name Too Long. Deleting."));
|
||||
this.Logger.LogError(ex, string.Format("Error Processing File. File Name Too Long. Deleting."));
|
||||
if (!doJustInfo)
|
||||
{
|
||||
fileInfo.Delete();
|
||||
|
@ -134,7 +135,7 @@ namespace Roadie.Library.Processors
|
|||
catch (Exception ex)
|
||||
{
|
||||
var willMove = !fileInfo.DirectoryName.Equals(this.UnknownFolder);
|
||||
this.LoggingService.Error(ex, string.Format("Error Processing File [{0}], WillMove [{1}]\n{2}", fileInfo.FullName, willMove, ex.Serialize()));
|
||||
this.Logger.LogError(ex, string.Format("Error Processing File [{0}], WillMove [{1}]\n{2}", fileInfo.FullName, willMove, ex.Serialize()));
|
||||
string newPath = null;
|
||||
try
|
||||
{
|
||||
|
@ -151,7 +152,7 @@ namespace Roadie.Library.Processors
|
|||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
this.LoggingService.Error(ex1, string.Format("Unable to move file [{0}] to [{1}]", fileInfo.FullName, newPath));
|
||||
this.Logger.LogError(ex1, string.Format("Unable to move file [{0}] to [{1}]", fileInfo.FullName, newPath));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Data;
|
||||
using Roadie.Library.Encoding;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.FilePlugins;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -28,11 +28,11 @@ namespace Roadie.Library.Processors
|
|||
}
|
||||
}
|
||||
|
||||
public FolderProcessor(IRoadieSettings configuration, IHttpEncoder httpEncoder, string destinationRoot, IRoadieDbContext context, ICacheManager cacheManager, ILogger loggingService)
|
||||
: base(configuration, httpEncoder, destinationRoot, context, cacheManager, loggingService)
|
||||
public FolderProcessor(IRoadieSettings configuration, IHttpEncoder httpEncoder, string destinationRoot, IRoadieDbContext context, ICacheManager cacheManager, ILogger logger)
|
||||
: base(configuration, httpEncoder, destinationRoot, context, cacheManager, logger)
|
||||
{
|
||||
SimpleContract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(destinationRoot), "Invalid Destination Folder");
|
||||
this._fileProcessor = new FileProcessor(configuration, httpEncoder, destinationRoot, context, cacheManager, loggingService);
|
||||
this._fileProcessor = new FileProcessor(configuration, httpEncoder, destinationRoot, context, cacheManager, logger);
|
||||
}
|
||||
|
||||
public OperationResult<bool> DeleteEmptyFolders(DirectoryInfo processingFolder)
|
||||
|
@ -44,7 +44,7 @@ namespace Roadie.Library.Processors
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LoggingService.Error(ex, string.Format("Error Deleting Empty Folder [{0}] Error [{1}]", processingFolder.FullName, ex.Serialize()));
|
||||
this.Logger.LogError(ex, string.Format("Error Deleting Empty Folder [{0}] Error [{1}]", processingFolder.FullName, ex.Serialize()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ namespace Roadie.Library.Processors
|
|||
if (!Path.GetFileNameWithoutExtension(file).ToLower().Equals("cover"))
|
||||
{
|
||||
File.Delete(file);
|
||||
this.LoggingService.Info("x Deleted File [{0}], Was foud in in FileExtensionsToDelete", file);
|
||||
this.Logger.LogInformation("x Deleted File [{0}], Was foud in in FileExtensionsToDelete", file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace Roadie.Library.Processors
|
|||
}
|
||||
await this.PostProcessFolder(inboundFolder, pluginResultInfos, doJustInfo);
|
||||
sw.Stop();
|
||||
this.LoggingService.Info("** Completed! Processed Folder [{0}]: Processed Files [{1}] : Elapsed Time [{2}]", inboundFolder.FullName.ToString(), processedFiles, sw.Elapsed);
|
||||
this.Logger.LogInformation("** Completed! Processed Folder [{0}]: Processed Files [{1}] : Elapsed Time [{2}]", inboundFolder.FullName.ToString(), processedFiles, sw.Elapsed);
|
||||
return new OperationResult<bool>
|
||||
{
|
||||
IsSuccess = !errors.Any(),
|
||||
|
@ -137,7 +137,7 @@ namespace Roadie.Library.Processors
|
|||
if (this.Configuration.Processing.DoFolderArtistNameSet && inboundFolder.Name.StartsWith("~"))
|
||||
{
|
||||
var artist = inboundFolder.Name.Replace("~", "");
|
||||
this.LoggingService.Info("Setting Folder File Tags To [{0}]", artist);
|
||||
this.Logger.LogInformation("Setting Folder File Tags To [{0}]", artist);
|
||||
if (!doJustInfo)
|
||||
{
|
||||
foreach (var file in inboundFolder.GetFiles("*.*", SearchOption.AllDirectories))
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Data;
|
||||
using Roadie.Library.Encoding;
|
||||
using Roadie.Library.Factories;
|
||||
using Roadie.Library.Logging;
|
||||
|
||||
|
||||
namespace Roadie.Library.Processors
|
||||
{
|
||||
|
@ -33,7 +34,7 @@ namespace Roadie.Library.Processors
|
|||
{
|
||||
get
|
||||
{
|
||||
return this._artistFactory ?? (this._artistFactory = new ArtistFactory(this.Configuration, this.HttpEncoder, this.DbContext, this.CacheManager, this.LoggingService));
|
||||
return this._artistFactory ?? (this._artistFactory = new ArtistFactory(this.Configuration, this.HttpEncoder, this.DbContext, this.CacheManager, this.Logger));
|
||||
}
|
||||
set
|
||||
{
|
||||
|
@ -93,7 +94,7 @@ namespace Roadie.Library.Processors
|
|||
{
|
||||
get
|
||||
{
|
||||
return this._imageFactory ?? (this._imageFactory = new ImageFactory(this.Configuration, this.HttpEncoder, this.DbContext, this.CacheManager, this.LoggingService));
|
||||
return this._imageFactory ?? (this._imageFactory = new ImageFactory(this.Configuration, this.HttpEncoder, this.DbContext, this.CacheManager, this.Logger));
|
||||
}
|
||||
set
|
||||
{
|
||||
|
@ -101,7 +102,7 @@ namespace Roadie.Library.Processors
|
|||
}
|
||||
}
|
||||
|
||||
protected ILogger LoggingService
|
||||
protected ILogger Logger
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -113,7 +114,7 @@ namespace Roadie.Library.Processors
|
|||
{
|
||||
get
|
||||
{
|
||||
return this._releaseFactory ?? (this._releaseFactory = new ReleaseFactory(this.Configuration, this.HttpEncoder, this.DbContext, this.CacheManager, this.LoggingService));
|
||||
return this._releaseFactory ?? (this._releaseFactory = new ReleaseFactory(this.Configuration, this.HttpEncoder, this.DbContext, this.CacheManager, this.Logger));
|
||||
}
|
||||
set
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using RestSharp;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RestSharp;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.SearchEngines.Imaging.BingModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -16,8 +16,8 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
/// </summary>
|
||||
public class BingImageSearchEngine : ImageSearchEngineBase
|
||||
{
|
||||
public BingImageSearchEngine(IRoadieSettings configuration, ILogger loggingService, string requestIp = null, string referrer = null)
|
||||
: base(configuration, loggingService, "https://api.cognitive.microsoft.com", requestIp, referrer)
|
||||
public BingImageSearchEngine(IRoadieSettings configuration, ILogger logger, string requestIp = null, string referrer = null)
|
||||
: base(configuration, logger, "https://api.cognitive.microsoft.com", requestIp, referrer)
|
||||
{
|
||||
this._apiKey = configuration.Integrations.ApiKeys.FirstOrDefault(x => x.ApiName == "BingImageSearch") ?? new ApiKey();
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
}
|
||||
if (response.Data == null || response.Data.value == null)
|
||||
{
|
||||
this.LoggingService.Warning("Response Is Null on PerformImageSearch [" + Newtonsoft.Json.JsonConvert.SerializeObject(response) + "]");
|
||||
this.Logger.LogWarning("Response Is Null on PerformImageSearch [" + Newtonsoft.Json.JsonConvert.SerializeObject(response) + "]");
|
||||
return null;
|
||||
}
|
||||
return response.Data.value.Select(x => new ImageSearchResult
|
||||
|
|
10
RoadieLibrary/SearchEngines/Imaging/IImageSearchManager.cs
Normal file
10
RoadieLibrary/SearchEngines/Imaging/IImageSearchManager.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Roadie.Library.SearchEngines.Imaging
|
||||
{
|
||||
public interface IImageSearchManager
|
||||
{
|
||||
Task<IEnumerable<ImageSearchResult>> ImageSearch(string query, int? resultsCount = null);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
using RestSharp;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RestSharp;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.SearchEngines.MetaData;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -91,7 +91,7 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LoggingService.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return new OperationResult<IEnumerable<ArtistSearchResult>>
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LoggingService.Error(ex.Serialize());
|
||||
this.Logger.LogError(ex.Serialize());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LoggingService.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return new OperationResult<IEnumerable<ReleaseSearchResult>>
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using RestSharp;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RestSharp;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -16,7 +16,7 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
protected readonly string _referrer = null;
|
||||
protected readonly string _requestIp = null;
|
||||
protected ApiKey _apiKey = null;
|
||||
protected ILogger _loggingService = null;
|
||||
protected ILogger _logger = null;
|
||||
|
||||
protected ApiKey ApiKey
|
||||
{
|
||||
|
@ -34,15 +34,15 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
}
|
||||
}
|
||||
|
||||
protected ILogger LoggingService
|
||||
protected ILogger Logger
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._loggingService;
|
||||
return this._logger;
|
||||
}
|
||||
}
|
||||
|
||||
public ImageSearchEngineBase(IRoadieSettings configuration, ILogger loggingService, string baseUrl, string requestIp = null, string referrer = null)
|
||||
public ImageSearchEngineBase(IRoadieSettings configuration, ILogger logger, string baseUrl, string requestIp = null, string referrer = null)
|
||||
{
|
||||
this._configuratio = configuration;
|
||||
if (string.IsNullOrEmpty(referrer) || referrer.StartsWith("http://localhost"))
|
||||
|
@ -55,7 +55,7 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
requestIp = "192.30.252.128";
|
||||
}
|
||||
this._requestIp = requestIp;
|
||||
this._loggingService = loggingService;
|
||||
this._logger = logger;
|
||||
|
||||
this._client = new RestClient(baseUrl);
|
||||
this._client.UserAgent = WebHelper.UserAgent;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Imaging;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.Utility;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Roadie.Library.SearchEngines.Imaging
|
||||
{
|
||||
public class ImageSearchManager
|
||||
public class ImageSearchManager : IImageSearchManager
|
||||
{
|
||||
private readonly IImageSearchEngine _bingSearchEngine = null;
|
||||
private readonly IImageSearchEngine _itunesSearchEngine = null;
|
||||
|
@ -21,10 +21,10 @@ namespace Roadie.Library.SearchEngines.Imaging
|
|||
}
|
||||
}
|
||||
|
||||
public ImageSearchManager(IRoadieSettings configuration, ICacheManager cacheManager, ILogger loggingService, string requestIp = null, string referrer = null)
|
||||
public ImageSearchManager(IRoadieSettings configuration, ICacheManager cacheManager, ILogger logger, string requestIp = null, string referrer = null)
|
||||
{
|
||||
this._bingSearchEngine = new BingImageSearchEngine(configuration, loggingService, requestIp, referrer);
|
||||
this._itunesSearchEngine = new ITunesSearchEngine(configuration, cacheManager, loggingService, requestIp, referrer);
|
||||
this._bingSearchEngine = new BingImageSearchEngine(configuration, logger, requestIp, referrer);
|
||||
this._itunesSearchEngine = new ITunesSearchEngine(configuration, cacheManager, logger, requestIp, referrer);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ImageSearchResult>> ImageSearch(string query, int? resultsCount = null)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Data;
|
||||
using Roadie.Library.Encoding;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Factories;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData.FileName;
|
||||
using Roadie.Library.MetaData.ID3Tags;
|
||||
using Roadie.Library.MetaData.LastFm;
|
||||
|
@ -209,7 +209,7 @@ namespace Roadie.Library.MetaData.Audio
|
|||
{
|
||||
if (string.IsNullOrEmpty(result.Artist) || string.IsNullOrEmpty(result.Release))
|
||||
{
|
||||
this.Logger.Warning("File [{0}] MetaData [{1}]: Unable to Determine Artist and Release; aborting getting info.", fileInfo.FullName, result.ToString());
|
||||
this.Logger.LogWarning("File [{0}] MetaData [{1}]: Unable to Determine Artist and Release; aborting getting info.", fileInfo.FullName, result.ToString());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ namespace Roadie.Library.MetaData.Audio
|
|||
}
|
||||
if (!result.IsValid)
|
||||
{
|
||||
this.Logger.Warning("File [{0}] MetaData Invalid, TagSources [{1}] MetaData [{2}]", fileInfo.FullName, string.Join(",", tagSources), result.ToString());
|
||||
this.Logger.LogWarning("File [{0}] MetaData Invalid, TagSources [{1}] MetaData [{2}]", fileInfo.FullName, string.Join(",", tagSources), result.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ namespace Roadie.Library.MetaData.Audio
|
|||
result.Images = tagImages != null && tagImages.Any() ? tagImages : null;
|
||||
if (result.Images == null || !result.Images.Any())
|
||||
{
|
||||
this.Logger.Trace("File [{0} No Images Set and Unable to Find Images", fileInfo.FullName);
|
||||
this.Logger.LogTrace("File [{0} No Images Set and Unable to Find Images", fileInfo.FullName);
|
||||
}
|
||||
}
|
||||
this.WriteTags(result, fileInfo);
|
||||
|
@ -257,7 +257,7 @@ namespace Roadie.Library.MetaData.Audio
|
|||
result.SetArtistName(artistNameReplaceKp.Key);
|
||||
}
|
||||
}
|
||||
this.Logger.Info("File [{0}], TagSources [{1}] MetaData [{2}]", fileInfo.Name, string.Join(",", tagSources), result.ToString());
|
||||
this.Logger.LogInformation("File [{0}], TagSources [{1}] MetaData [{2}]", fileInfo.Name, string.Join(",", tagSources), result.ToString());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ namespace Roadie.Library.MetaData.Audio
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, string.Format("Error With ID3TagsHelper.MetaDataForFile From File [{0}]", fileInfo.FullName));
|
||||
this.Logger.LogError(ex, string.Format("Error With ID3TagsHelper.MetaDataForFile From File [{0}]", fileInfo.FullName));
|
||||
}
|
||||
return new AudioMetaData
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using RestSharp;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RestSharp;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData;
|
||||
using Roadie.Library.Utility;
|
||||
using System;
|
||||
|
@ -27,7 +27,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
}
|
||||
}
|
||||
|
||||
public DiscogsHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger loggingService) : base(configuration, cacheManager, loggingService)
|
||||
public DiscogsHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger logger) : base(configuration, cacheManager, logger)
|
||||
{
|
||||
this._apiKey = configuration.Integrations.ApiKeys.FirstOrDefault(x => x.ApiName == "DiscogsConsumerKey") ?? new ApiKey();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
ArtistSearchResult data = null;
|
||||
try
|
||||
{
|
||||
this.Logger.Trace("DiscogsHelper:PerformArtistSearch:{0}", query);
|
||||
this.Logger.LogTrace("DiscogsHelper:PerformArtistSearch:{0}", query);
|
||||
var request = this.BuildSearchRequest(query, 1, "artist");
|
||||
|
||||
var client = new RestClient("https://api.discogs.com/database");
|
||||
|
@ -105,7 +105,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return new OperationResult<IEnumerable<ArtistSearchResult>>
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return new OperationResult<IEnumerable<LabelSearchResult>>
|
||||
{
|
||||
|
@ -308,7 +308,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Discogs
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return new OperationResult<IEnumerable<ReleaseSearchResult>>
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Logging;
|
||||
|
||||
using Roadie.Library.MetaData.Audio;
|
||||
using Roadie.Library.Utility;
|
||||
using System.IO;
|
||||
|
@ -12,8 +13,8 @@ namespace Roadie.Library.MetaData.FileName
|
|||
{
|
||||
public class FileNameHelper : MetaDataProviderBase
|
||||
{
|
||||
public FileNameHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger loggingService)
|
||||
: base(configuration, cacheManager, loggingService)
|
||||
public FileNameHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger logger)
|
||||
: base(configuration, cacheManager, logger)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using Orthogonal.NTagLite;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Orthogonal.NTagLite;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData.Audio;
|
||||
using Roadie.Library.Utility;
|
||||
using System;
|
||||
|
@ -15,8 +15,8 @@ namespace Roadie.Library.MetaData.ID3Tags
|
|||
{
|
||||
public class ID3TagsHelper : MetaDataProviderBase
|
||||
{
|
||||
public ID3TagsHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger loggingService)
|
||||
: base(configuration, cacheManager, loggingService)
|
||||
public ID3TagsHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger logger)
|
||||
: base(configuration, cacheManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ namespace Roadie.Library.MetaData.ID3Tags
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, string.Format("MetaData [{0}], Filename [{1}]", metaData.ToString(), filename));
|
||||
this.Logger.LogError(ex, string.Format("MetaData [{0}], Filename [{1}]", metaData.ToString(), filename));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ namespace Roadie.Library.MetaData.ID3Tags
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, "MetaDataForFileFromTagLib Filename [" + fileName + "] Error [" + ex.Serialize() + "]");
|
||||
this.Logger.LogError(ex, "MetaDataForFileFromTagLib Filename [" + fileName + "] Error [" + ex.Serialize() + "]");
|
||||
}
|
||||
sw.Stop();
|
||||
return new OperationResult<AudioMetaData>
|
||||
|
@ -184,7 +184,7 @@ namespace Roadie.Library.MetaData.ID3Tags
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, "MetaDataForFileFromTagLib Filename [" + fileName + "] Error [" + ex.Serialize() + "]");
|
||||
this.Logger.LogError(ex, "MetaDataForFileFromTagLib Filename [" + fileName + "] Error [" + ex.Serialize() + "]");
|
||||
}
|
||||
sw.Stop();
|
||||
return new OperationResult<AudioMetaData>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using IF.Lastfm.Core.Api;
|
||||
using IF.Lastfm.Core.Objects;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RestSharp;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData.Audio;
|
||||
using Roadie.Library.SearchEngines.MetaData;
|
||||
using Roadie.Library.SearchEngines.MetaData.LastFm;
|
||||
|
@ -29,7 +29,7 @@ namespace Roadie.Library.MetaData.LastFm
|
|||
}
|
||||
}
|
||||
|
||||
public LastFmHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger loggingService) : base(configuration, cacheManager, loggingService)
|
||||
public LastFmHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger logger) : base(configuration, cacheManager, logger)
|
||||
{
|
||||
this._apiKey = configuration.Integrations.ApiKeys.FirstOrDefault(x => x.ApiName == "LastFMApiKey") ?? new ApiKey();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace Roadie.Library.MetaData.LastFm
|
|||
{
|
||||
try
|
||||
{
|
||||
this.Logger.Trace("LastFmHelper:PerformArtistSearch:{0}", query);
|
||||
this.Logger.LogTrace("LastFmHelper:PerformArtistSearch:{0}", query);
|
||||
var auth = new LastAuth(this.ApiKey.Key, this.ApiKey.KeySecret);
|
||||
var albumApi = new ArtistApi(auth);
|
||||
var response = await albumApi.GetInfoAsync(query);
|
||||
|
@ -74,7 +74,7 @@ namespace Roadie.Library.MetaData.LastFm
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
return new OperationResult<IEnumerable<ArtistSearchResult>>();
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ namespace Roadie.Library.MetaData.LastFm
|
|||
}
|
||||
catch
|
||||
{
|
||||
this.Logger.Warning("LastFmAPI: Error Getting Tracks For Artist [{0}], Release [{1}]", artist, Release);
|
||||
this.Logger.LogWarning("LastFmAPI: Error Getting Tracks For Artist [{0}], Release [{1}]", artist, Release);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ namespace Roadie.Library.MetaData.LastFm
|
|||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, string.Format("LastFm: Error Getting Tracks For Artist [{0}], Release [{1}]", artist, Release));
|
||||
this.Logger.LogError(ex, string.Format("LastFm: Error Getting Tracks For Artist [{0}], Release [{1}]", artist, Release));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Logging;
|
||||
|
||||
namespace Roadie.Library.MetaData
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace Roadie.Library.MetaData
|
|||
{
|
||||
protected readonly ICacheManager _cacheManager = null;
|
||||
protected readonly IRoadieSettings _configuration = null;
|
||||
protected readonly ILogger _loggingService = null;
|
||||
protected readonly ILogger _logger = null;
|
||||
|
||||
protected ApiKey _apiKey = null;
|
||||
|
||||
|
@ -48,15 +48,15 @@ namespace Roadie.Library.MetaData
|
|||
{
|
||||
get
|
||||
{
|
||||
return this._loggingService;
|
||||
return this._logger;
|
||||
}
|
||||
}
|
||||
|
||||
public MetaDataProviderBase(IRoadieSettings configuration, ICacheManager cacheManager, ILogger loggingService)
|
||||
public MetaDataProviderBase(IRoadieSettings configuration, ICacheManager cacheManager, ILogger logger)
|
||||
{
|
||||
this._configuration = configuration;
|
||||
this._cacheManager = cacheManager;
|
||||
this._loggingService = loggingService;
|
||||
this._logger = logger;
|
||||
|
||||
System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate (object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
|
||||
System.Security.Cryptography.X509Certificates.X509Chain chain,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Data;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData.Audio;
|
||||
using Roadie.Library.SearchEngines.MetaData;
|
||||
using Roadie.Library.Utility;
|
||||
|
@ -25,7 +25,8 @@ namespace Roadie.Library.MetaData.MusicBrainz
|
|||
}
|
||||
}
|
||||
|
||||
public MusicBrainzProvider(IRoadieSettings configuration, ICacheManager cacheManager, ILogger logger) : base(configuration, cacheManager, logger)
|
||||
public MusicBrainzProvider(IRoadieSettings configuration, ICacheManager cacheManager, ILogger logger)
|
||||
: base(configuration, cacheManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -70,7 +71,7 @@ namespace Roadie.Library.MetaData.MusicBrainz
|
|||
}
|
||||
if (release == null)
|
||||
{
|
||||
this.Logger.Warning("MusicBrainzReleaseById: MusicBrainzId [{0}], No MusicBrainz Release Found", musicBrainzId);
|
||||
this.Logger.LogWarning("MusicBrainzReleaseById: MusicBrainzId [{0}], No MusicBrainz Release Found", musicBrainzId);
|
||||
}
|
||||
return release;
|
||||
}
|
||||
|
@ -181,7 +182,7 @@ namespace Roadie.Library.MetaData.MusicBrainz
|
|||
ArtistSearchResult result = null;
|
||||
try
|
||||
{
|
||||
this.Logger.Trace("MusicBrainzProvider:PerformArtistSearch:{0}", query);
|
||||
this.Logger.LogTrace("MusicBrainzProvider:PerformArtistSearch:{0}", query);
|
||||
// Find the Artist
|
||||
var artistCacheKey = string.Format("uri:musicbrainz:ArtistSearchResult:{0}", query);
|
||||
result = this.CacheManager.Get<ArtistSearchResult>(artistCacheKey);
|
||||
|
@ -194,7 +195,7 @@ namespace Roadie.Library.MetaData.MusicBrainz
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
if (artistResult == null || artistResult.artists == null || artistResult.count < 1)
|
||||
{
|
||||
|
@ -301,15 +302,15 @@ namespace Roadie.Library.MetaData.MusicBrainz
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
this.Logger.Warning("MusicBrainzArtist: ArtistName [{0}], No MusicBrainz Artist Found", query);
|
||||
this.Logger.LogWarning("MusicBrainzArtist: ArtistName [{0}], No MusicBrainz Artist Found", query);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Logger.Trace("MusicBrainzArtist: Result [{0}]", query, result.ToString());
|
||||
this.Logger.LogTrace("MusicBrainzArtist: Result [{0}]", query, result.ToString());
|
||||
}
|
||||
return new OperationResult<IEnumerable<ArtistSearchResult>>
|
||||
{
|
||||
|
@ -393,15 +394,15 @@ namespace Roadie.Library.MetaData.MusicBrainz
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
this.Logger.Warning("MusicBrainzArtist: ArtistName [{0}], ReleaseTitle [{0}], No MusicBrainz Release Found", artistName, query);
|
||||
this.Logger.LogWarning("MusicBrainzArtist: ArtistName [{0}], ReleaseTitle [{0}], No MusicBrainz Release Found", artistName, query);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Logger.Trace("MusicBrainzArtist: Result [{0}]", query, result.ToString());
|
||||
this.Logger.LogTrace("MusicBrainzArtist: Result [{0}]", query, result.ToString());
|
||||
}
|
||||
return new OperationResult<IEnumerable<ReleaseSearchResult>>
|
||||
{
|
||||
|
@ -491,7 +492,7 @@ namespace Roadie.Library.MetaData.MusicBrainz
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using RestSharp;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RestSharp;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Extensions;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData;
|
||||
using Roadie.Library.Utility;
|
||||
using System;
|
||||
|
@ -24,8 +24,8 @@ namespace Roadie.Library.SearchEngines.MetaData.Spotify
|
|||
}
|
||||
}
|
||||
|
||||
public SpotifyHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger loggingService)
|
||||
: base(configuration, cacheManager, loggingService)
|
||||
public SpotifyHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger logger)
|
||||
: base(configuration, cacheManager, logger)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Spotify
|
|||
ArtistSearchResult data = null;
|
||||
try
|
||||
{
|
||||
this.Logger.Trace("SpotifyHelper:PerformArtistSearch:{0}", query);
|
||||
this.Logger.LogTrace("SpotifyHelper:PerformArtistSearch:{0}", query);
|
||||
var request = this.BuildSearchRequest(query, 1, "artist");
|
||||
|
||||
var client = new RestClient("http://api.spotify.com/v1");
|
||||
|
@ -80,7 +80,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Spotify
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex);
|
||||
this.Logger.LogError(ex);
|
||||
}
|
||||
return new OperationResult<IEnumerable<ArtistSearchResult>>
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ namespace Roadie.Library.SearchEngines.MetaData.Spotify
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.Error(ex, ex.Serialize());
|
||||
this.Logger.LogError(ex, ex.Serialize());
|
||||
}
|
||||
return new OperationResult<IEnumerable<ReleaseSearchResult>>();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using RestSharp;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RestSharp;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Encoding;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using Roadie.Library.Caching;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Roadie.Library.Caching;
|
||||
using Roadie.Library.Configuration;
|
||||
using Roadie.Library.Logging;
|
||||
using Roadie.Library.MetaData;
|
||||
using Roadie.Library.SearchEngines.Imaging;
|
||||
using System.Linq;
|
||||
|
@ -20,10 +20,10 @@ namespace Roadie.Library.SearchEngines.MetaData.iTunes
|
|||
}
|
||||
}
|
||||
|
||||
public iTunesHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger loggingService)
|
||||
: base(configuration, cacheManager, loggingService)
|
||||
public iTunesHelper(IRoadieSettings configuration, ICacheManager cacheManager, ILogger logger)
|
||||
: base(configuration, cacheManager, logger)
|
||||
{
|
||||
this._iTunesSearchEngine = new ITunesSearchEngine(configuration, cacheManager, loggingService);
|
||||
this._iTunesSearchEngine = new ITunesSearchEngine(configuration, cacheManager, logger);
|
||||
}
|
||||
|
||||
public async Task<OperationResult<ArtistSearchResult>> SearchForArtist(string artistName)
|
||||
|
|
Loading…
Add table
Reference in a new issue