Adding more logging into the Plex Cacher

This commit is contained in:
Jamie.Rees 2017-03-14 08:07:08 +00:00
commit 87b2272bdf
2 changed files with 15 additions and 7 deletions

View file

@ -201,6 +201,8 @@ namespace Ombi.Services.Jobs
results = GetLibraries(plexSettings); results = GetLibraries(plexSettings);
if (plexSettings.AdvancedSearch) if (plexSettings.AdvancedSearch)
{ {
Log.Debug("Going through all the items now");
Log.Debug($"Item count {results.Count}");
foreach (PlexSearch t in results) foreach (PlexSearch t in results)
{ {
foreach (Directory1 t1 in t.Directory) foreach (Directory1 t1 in t.Directory)
@ -236,7 +238,7 @@ namespace Ombi.Services.Jobs
} }
if (results != null) if (results != null)
{ {
Log.Debug("done all that, moving onto the DB now");
var movies = GetPlexMovies(results); var movies = GetPlexMovies(results);
// Time to destroy the plex movies from the DB // Time to destroy the plex movies from the DB
@ -279,6 +281,7 @@ namespace Ombi.Services.Jobs
} }
} }
Log.Debug("Done movies");
var tv = GetPlexTvShows(results); var tv = GetPlexTvShows(results);
// Time to destroy the plex tv from the DB // Time to destroy the plex tv from the DB
PlexContent.Custom(connection => PlexContent.Custom(connection =>
@ -319,7 +322,7 @@ namespace Ombi.Services.Jobs
}); });
} }
} }
Log.Debug("Done TV");
var albums = GetPlexAlbums(results); var albums = GetPlexAlbums(results);
// Time to destroy the plex movies from the DB // Time to destroy the plex movies from the DB
PlexContent.Custom(connection => PlexContent.Custom(connection =>
@ -360,10 +363,13 @@ namespace Ombi.Services.Jobs
}); });
} }
} }
Log.Debug("Done albums");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Debug("Exception:");
Log.Debug(ex);
Log.Error(ex, "Failed to obtain Plex libraries"); Log.Error(ex, "Failed to obtain Plex libraries");
} }
@ -372,8 +378,10 @@ namespace Ombi.Services.Jobs
private List<PlexSearch> GetLibraries(PlexSettings plexSettings) private List<PlexSearch> GetLibraries(PlexSettings plexSettings)
{ {
Log.Debug("Getting Lib sections");
var sections = PlexApi.GetLibrarySections(plexSettings.PlexAuthToken, plexSettings.FullUri); var sections = PlexApi.GetLibrarySections(plexSettings.PlexAuthToken, plexSettings.FullUri);
Log.Debug("Going through sections now");
var libs = new List<PlexSearch>(); var libs = new List<PlexSearch>();
if (sections != null) if (sections != null)
{ {
@ -382,6 +390,7 @@ namespace Ombi.Services.Jobs
var lib = PlexApi.GetLibrary(plexSettings.PlexAuthToken, plexSettings.FullUri, dir.Key); var lib = PlexApi.GetLibrary(plexSettings.PlexAuthToken, plexSettings.FullUri, dir.Key);
if (lib != null) if (lib != null)
{ {
Log.Debug("adding lib");
libs.Add(lib); libs.Add(lib);
} }
} }

View file

@ -185,14 +185,13 @@ namespace Ombi.UI.Modules
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
private long _plexMovieCacheTime = 0; private long _plexMovieCacheTime = 0;
private IEnumerable<PlexContent> _plexMovies = null; private IEnumerable<PlexContent> _plexMovies;
private long _embyMovieCacheTime = 0; private long _embyMovieCacheTime = 0;
private IEnumerable<EmbyContent> _embyMovies = null; private IEnumerable<EmbyContent> _embyMovies;
private long _dbMovieCacheTime = 0; private long _dbMovieCacheTime = 0;
private Dictionary<int, RequestedModel> _dbMovies = null; private Dictionary<int, RequestedModel> _dbMovies;
private async Task<Negotiator> RequestLoad() private async Task<Negotiator> RequestLoad()
{ {