Drewster727 9 years ago
commit 9f74d31f1d

@ -72,14 +72,12 @@ namespace PlexRequests.Services.Jobs
private IRepository<UsersToNotify> UserNotifyRepo { get; } private IRepository<UsersToNotify> UserNotifyRepo { get; }
public void CheckAndUpdateAll() public void CheckAndUpdateAll()
{ {
Log.Trace("Getting the settings");
var plexSettings = Plex.GetSettings(); var plexSettings = Plex.GetSettings();
var authSettings = Auth.GetSettings(); var authSettings = Auth.GetSettings();
Log.Trace("Getting all the requests");
if (!ValidateSettings(plexSettings, authSettings)) if (!ValidateSettings(plexSettings, authSettings))
{ {
Log.Info("Validation of the plex settings failed."); Log.Debug("Validation of the plex settings failed.");
return; return;
} }
@ -87,7 +85,7 @@ namespace PlexRequests.Services.Jobs
if (libraries == null || !libraries.Any()) if (libraries == null || !libraries.Any())
{ {
Log.Info("Did not find any libraries in Plex."); Log.Debug("Did not find any libraries in Plex.");
return; return;
} }
@ -97,21 +95,16 @@ namespace PlexRequests.Services.Jobs
var requests = RequestService.GetAll(); var requests = RequestService.GetAll();
var requestedModels = requests as RequestedModel[] ?? requests.Where(x => !x.Available).ToArray(); var requestedModels = requests as RequestedModel[] ?? requests.Where(x => !x.Available).ToArray();
Log.Trace("Requests Count {0}", requestedModels.Length);
if (!requestedModels.Any()) if (!requestedModels.Any())
{ {
Log.Info("There are no requests to check."); Log.Debug("There are no requests to check.");
return; return;
} }
var modifiedModel = new List<RequestedModel>(); var modifiedModel = new List<RequestedModel>();
foreach (var r in requestedModels) foreach (var r in requestedModels)
{ {
Log.Trace("We are going to see if Plex has the following title: {0}", r.Title);
Log.Trace("Search results from Plex for the following request: {0}", r.Title);
var releaseDate = r.ReleaseDate == DateTime.MinValue ? string.Empty : r.ReleaseDate.ToString("yyyy"); var releaseDate = r.ReleaseDate == DateTime.MinValue ? string.Empty : r.ReleaseDate.ToString("yyyy");
bool matchResult; bool matchResult;
@ -136,12 +129,10 @@ namespace PlexRequests.Services.Jobs
modifiedModel.Add(r); modifiedModel.Add(r);
continue; continue;
} }
Log.Trace("The result from Plex where the title's match was null, so that means the content is not yet in Plex.");
} }
Log.Trace("Updating the requests now"); Log.Debug("Requests that will be updated count {0}", modifiedModel.Count);
Log.Trace("Requests that will be updated count {0}", modifiedModel.Count);
if (modifiedModel.Any()) if (modifiedModel.Any())
{ {
@ -248,8 +239,6 @@ namespace PlexRequests.Services.Jobs
private List<PlexSearch> CachedLibraries(AuthenticationSettings authSettings, PlexSettings plexSettings, bool setCache) private List<PlexSearch> CachedLibraries(AuthenticationSettings authSettings, PlexSettings plexSettings, bool setCache)
{ {
Log.Trace("Obtaining library sections from Plex");
List<PlexSearch> results = new List<PlexSearch>(); List<PlexSearch> results = new List<PlexSearch>();
if (!ValidateSettings(plexSettings, authSettings)) if (!ValidateSettings(plexSettings, authSettings))
@ -262,10 +251,8 @@ namespace PlexRequests.Services.Jobs
{ {
if (setCache) if (setCache)
{ {
Log.Trace("Plex Lib API Call");
results = GetLibraries(authSettings, plexSettings); results = GetLibraries(authSettings, plexSettings);
Log.Trace("Plex Lib Cache Set Call");
if (results != null) if (results != null)
{ {
Cache.Set(CacheKeys.PlexLibaries, results, CacheKeys.TimeFrameMinutes.SchedulerCaching); Cache.Set(CacheKeys.PlexLibaries, results, CacheKeys.TimeFrameMinutes.SchedulerCaching);
@ -273,12 +260,8 @@ namespace PlexRequests.Services.Jobs
} }
else else
{ {
Log.Trace("Plex Lib GetSet Call");
results = Cache.GetOrSet(CacheKeys.PlexLibaries, () => results = Cache.GetOrSet(CacheKeys.PlexLibaries, () =>
{ GetLibraries(authSettings, plexSettings), CacheKeys.TimeFrameMinutes.SchedulerCaching);
Log.Trace("Plex Lib API Call (inside getset)");
return GetLibraries(authSettings, plexSettings);
}, CacheKeys.TimeFrameMinutes.SchedulerCaching);
} }
} }
catch (Exception ex) catch (Exception ex)
@ -298,7 +281,6 @@ namespace PlexRequests.Services.Jobs
{ {
foreach (var dir in sections.Directories) foreach (var dir in sections.Directories)
{ {
Log.Trace("Obtaining results from Plex for the following library section: {0}", dir.Title);
var lib = PlexApi.GetLibrary(authSettings.PlexAuthToken, plexSettings.FullUri, dir.Key); var lib = PlexApi.GetLibrary(authSettings.PlexAuthToken, plexSettings.FullUri, dir.Key);
if (lib != null) if (lib != null)
{ {
@ -306,8 +288,7 @@ namespace PlexRequests.Services.Jobs
} }
} }
} }
Log.Trace("Returning Plex Libs");
return libs; return libs;
} }
@ -335,7 +316,6 @@ namespace PlexRequests.Services.Jobs
foreach (var model in modelChanged) foreach (var model in modelChanged)
{ {
var selectedUsers = users.Select(x => x.Username).Intersect(model.RequestedUsers); var selectedUsers = users.Select(x => x.Username).Intersect(model.RequestedUsers);
Log.Debug("Selected Users {0}", selectedUsers.DumpJson());
foreach (var user in selectedUsers) foreach (var user in selectedUsers)
{ {
Log.Info("Notifying user {0}", user); Log.Info("Notifying user {0}", user);

@ -83,8 +83,6 @@ namespace PlexRequests.Store.Repository
public bool Update(T entity) public bool Update(T entity)
{ {
ResetCache(); ResetCache();
Log.Trace("Updating entity");
Log.Trace(entity.DumpJson());
using (var db = Config.DbConnection()) using (var db = Config.DbConnection())
{ {
db.Open(); db.Open();
@ -95,8 +93,6 @@ namespace PlexRequests.Store.Repository
public async Task<bool> UpdateAsync(T entity) public async Task<bool> UpdateAsync(T entity)
{ {
ResetCache(); ResetCache();
Log.Trace("Updating entity");
Log.Trace(entity.DumpJson());
using (var db = Config.DbConnection()) using (var db = Config.DbConnection())
{ {
db.Open(); db.Open();

@ -87,16 +87,11 @@ namespace PlexRequests.UI.Helpers
qualityId = sickRageSettings.QualityProfile; qualityId = sickRageSettings.QualityProfile;
} }
Log.Trace("Calling `AddSeries` with the following settings:");
Log.Trace(sickRageSettings.DumpJson());
Log.Trace("And the following `model`:");
Log.Trace(model.DumpJson());
var apiResult = SickrageApi.AddSeries(model.ProviderId, model.SeasonCount, model.SeasonList, qualityId, var apiResult = SickrageApi.AddSeries(model.ProviderId, model.SeasonCount, model.SeasonList, qualityId,
sickRageSettings.ApiKey, sickRageSettings.FullUri); sickRageSettings.ApiKey, sickRageSettings.FullUri);
var result = apiResult.Result; var result = apiResult.Result;
Log.Trace("SickRage Add Result: ");
Log.Trace(result.DumpJson());
return result; return result;
} }

@ -224,8 +224,6 @@ namespace PlexRequests.UI.Modules
private Negotiator Admin() private Negotiator Admin()
{ {
var settings = PrService.GetSettings(); var settings = PrService.GetSettings();
Log.Trace("Getting Settings:");
Log.Trace(settings.DumpJson());
return View["Settings", settings]; return View["Settings", settings];
} }
@ -542,7 +540,6 @@ namespace PlexRequests.UI.Modules
{ {
return Response.AsJson(valid.SendJsonError()); return Response.AsJson(valid.SendJsonError());
} }
Log.Trace(settings.DumpJson());
var result = PushbulletService.SaveSettings(settings); var result = PushbulletService.SaveSettings(settings);
if (settings.Enabled) if (settings.Enabled)
@ -605,7 +602,6 @@ namespace PlexRequests.UI.Modules
{ {
return Response.AsJson(valid.SendJsonError()); return Response.AsJson(valid.SendJsonError());
} }
Log.Trace(settings.DumpJson());
var result = PushoverService.SaveSettings(settings); var result = PushoverService.SaveSettings(settings);
if (settings.Enabled) if (settings.Enabled)
@ -731,7 +727,6 @@ namespace PlexRequests.UI.Modules
Log.Info("Error validating Headphones settings, message: {0}", error.Message); Log.Info("Error validating Headphones settings, message: {0}", error.Message);
return Response.AsJson(error); return Response.AsJson(error);
} }
Log.Trace(settings.DumpJson());
var result = HeadphonesService.SaveSettings(settings); var result = HeadphonesService.SaveSettings(settings);

@ -93,8 +93,6 @@ namespace PlexRequests.UI.Modules
var authenticated = false; var authenticated = false;
var settings = AuthService.GetSettings(); var settings = AuthService.GetSettings();
Log.Debug("Settings: ");
Log.Debug(settings.DumpJson());
if (IsUserInDeniedList(username, settings)) if (IsUserInDeniedList(username, settings))
{ {
@ -187,8 +185,6 @@ namespace PlexRequests.UI.Modules
private bool CheckIfUserIsInPlexFriends(string username, string authToken) private bool CheckIfUserIsInPlexFriends(string username, string authToken)
{ {
var users = Api.GetUsers(authToken); var users = Api.GetUsers(authToken);
Log.Trace("Plex Users: ");
Log.Trace(users.DumpJson());
var allUsers = users?.User?.Where(x => !string.IsNullOrEmpty(x.Title)); var allUsers = users?.User?.Where(x => !string.IsNullOrEmpty(x.Title));
return allUsers != null && allUsers.Any(x => x.Title.Equals(username, StringComparison.CurrentCultureIgnoreCase)); return allUsers != null && allUsers.Any(x => x.Title.Equals(username, StringComparison.CurrentCultureIgnoreCase));
} }

@ -1,11 +1,11 @@
version: 1.7.{build} version: 1.8.{build}
configuration: Release configuration: Release
assembly_info: assembly_info:
patch: true patch: true
file: '**\AssemblyInfo.*' file: '**\AssemblyInfo.*'
assembly_version: '1.7.5' assembly_version: '1.8.0'
assembly_file_version: '{version}' assembly_file_version: '{version}'
assembly_informational_version: '1.7.5' assembly_informational_version: '1.8.0'
before_build: before_build:
- cmd: appveyor-retry nuget restore - cmd: appveyor-retry nuget restore
build: build:

Loading…
Cancel
Save