Added some logging into the PlexCachers and set the log level to informational

pull/1614/head
tidusjar 7 years ago
parent 57f3297892
commit 6c07295a69

@ -68,6 +68,7 @@ namespace Ombi.Schedule.Jobs.Plex
} }
if (!ValidateSettings(plexSettings)) if (!ValidateSettings(plexSettings))
{ {
Logger.LogError("Plex Settings are not valid");
return; return;
} }
@ -76,6 +77,8 @@ namespace Ombi.Schedule.Jobs.Plex
{ {
await StartTheCache(plexSettings); await StartTheCache(plexSettings);
Logger.LogInformation("Starting EP Cacher");
BackgroundJob.Enqueue(() => EpisodeCacher.Start()); BackgroundJob.Enqueue(() => EpisodeCacher.Start());
} }
catch (Exception e) catch (Exception e)
@ -89,6 +92,7 @@ namespace Ombi.Schedule.Jobs.Plex
foreach (var servers in plexSettings.Servers ?? new List<PlexServers>()) foreach (var servers in plexSettings.Servers ?? new List<PlexServers>())
{ {
Logger.LogInformation("Getting all content from server {0}", servers.Name);
var allContent = GetAllContent(servers); var allContent = GetAllContent(servers);
// Let's now process this. // Let's now process this.
@ -98,6 +102,7 @@ namespace Ombi.Schedule.Jobs.Plex
if (content.viewGroup.Equals(Jobs.PlexContentCacher.PlexMediaType.Show.ToString(), StringComparison.CurrentCultureIgnoreCase)) if (content.viewGroup.Equals(Jobs.PlexContentCacher.PlexMediaType.Show.ToString(), StringComparison.CurrentCultureIgnoreCase))
{ {
// Process Shows // Process Shows
Logger.LogInformation("Processing TV Shows");
foreach (var show in content.Metadata) foreach (var show in content.Metadata)
{ {
var seasonList = await PlexApi.GetSeasons(servers.PlexAuthToken, servers.FullUri, var seasonList = await PlexApi.GetSeasons(servers.PlexAuthToken, servers.FullUri,
@ -118,6 +123,7 @@ namespace Ombi.Schedule.Jobs.Plex
var existingContent = await Repo.GetByKey(show.ratingKey); var existingContent = await Repo.GetByKey(show.ratingKey);
if (existingContent != null) if (existingContent != null)
{ {
Logger.LogInformation("We already have show {0} checking for new seasons", existingContent.Title);
// Ok so we have it, let's check if there are any new seasons // Ok so we have it, let's check if there are any new seasons
var itemAdded = false; var itemAdded = false;
foreach (var season in seasonsContent) foreach (var season in seasonsContent)
@ -139,6 +145,8 @@ namespace Ombi.Schedule.Jobs.Plex
else else
{ {
Logger.LogInformation("New show {0}, so add it", show.title);
// Get the show metadata... This sucks since the `metadata` var contains all information about the show // Get the show metadata... This sucks since the `metadata` var contains all information about the show
// But it does not contain the `guid` property that we need to pull out thetvdb id... // But it does not contain the `guid` property that we need to pull out thetvdb id...
var showMetadata = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri, var showMetadata = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri,
@ -165,6 +173,7 @@ namespace Ombi.Schedule.Jobs.Plex
} }
if (content.viewGroup.Equals(Jobs.PlexContentCacher.PlexMediaType.Movie.ToString(), StringComparison.CurrentCultureIgnoreCase)) if (content.viewGroup.Equals(Jobs.PlexContentCacher.PlexMediaType.Movie.ToString(), StringComparison.CurrentCultureIgnoreCase))
{ {
Logger.LogInformation("Processing Movies");
foreach (var movie in content?.Metadata ?? new Metadata[]{}) foreach (var movie in content?.Metadata ?? new Metadata[]{})
{ {
// Let's check if we have this movie // Let's check if we have this movie
@ -174,6 +183,7 @@ namespace Ombi.Schedule.Jobs.Plex
continue; continue;
} }
Logger.LogInformation("Adding movie {0}", movie.title);
var metaData = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri, var metaData = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri,
movie.ratingKey); movie.ratingKey);
var item = new PlexContent var item = new PlexContent
@ -229,6 +239,7 @@ namespace Ombi.Schedule.Jobs.Plex
.Select(x => x.Key.ToString()).ToList(); .Select(x => x.Key.ToString()).ToList();
if (!keys.Contains(dir.key)) if (!keys.Contains(dir.key))
{ {
Logger.LogInformation("Lib {0} is not monitored, so skipping", dir.key);
// We are not monitoring this lib // We are not monitoring this lib
continue; continue;
} }

@ -47,7 +47,6 @@ namespace Ombi.Schedule.Jobs.Plex
foreach (var server in s.Servers) foreach (var server in s.Servers)
{ {
await Cache(server); await Cache(server);
BackgroundJob.Enqueue(() => _availabilityChecker.Start()); BackgroundJob.Enqueue(() => _availabilityChecker.Start());
} }
@ -62,6 +61,8 @@ namespace Ombi.Schedule.Jobs.Plex
{ {
if (!Validate(settings)) if (!Validate(settings))
{ {
_log.LogWarning("Validation failed");
return; return;
} }

@ -55,19 +55,19 @@ namespace Ombi
if (string.IsNullOrEmpty(StoragePath.StoragePath)) if (string.IsNullOrEmpty(StoragePath.StoragePath))
{ {
config = new LoggerConfiguration() config = new LoggerConfiguration()
.MinimumLevel.Debug() .MinimumLevel.Information()
.WriteTo.RollingFile(Path.Combine(env.ContentRootPath, "Logs", "log-{Date}.txt")) .WriteTo.RollingFile(Path.Combine(env.ContentRootPath, "Logs", "log-{Date}.txt"))
.WriteTo.SQLite("Ombi.db", "Logs", LogEventLevel.Debug) .WriteTo.SQLite("Ombi.db", "Logs", LogEventLevel.Information)
.CreateLogger(); .CreateLogger();
} }
else else
{ {
config = new LoggerConfiguration() config = new LoggerConfiguration()
.MinimumLevel.Debug() .MinimumLevel.Information()
.WriteTo.RollingFile(Path.Combine(StoragePath.StoragePath, "Logs", "log-{Date}.txt")) .WriteTo.RollingFile(Path.Combine(StoragePath.StoragePath, "Logs", "log-{Date}.txt"))
.WriteTo.SQLite(Path.Combine(StoragePath.StoragePath, "Ombi.db"), "Logs", LogEventLevel.Debug) .WriteTo.SQLite(Path.Combine(StoragePath.StoragePath, "Ombi.db"), "Logs", LogEventLevel.Information)
.CreateLogger(); .CreateLogger();
} }
Log.Logger = config; Log.Logger = config;

@ -2,7 +2,9 @@
"Logging": { "Logging": {
"IncludeScopes": false, "IncludeScopes": false,
"LogLevel": { "LogLevel": {
"Default": "Warning" "Default": "Information",
"System": "Information",
"Microsoft": "None"
} }
}, },
"ApplicationSettings": { "ApplicationSettings": {

Loading…
Cancel
Save