mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-24 16:51:58 +00:00
Added some logging and error handling to XbmcProvider.
Increased Json timeout to 20 seconds.
This commit is contained in:
parent
62da0568c0
commit
a3f2ef6ec6
2 changed files with 12 additions and 4 deletions
|
@ -89,7 +89,7 @@ public virtual string PostCommand(string address, string username, string passwo
|
||||||
request.Method = "POST";
|
request.Method = "POST";
|
||||||
request.Credentials = new NetworkCredential(username, password);
|
request.Credentials = new NetworkCredential(username, password);
|
||||||
request.ContentType = "application/json";
|
request.ContentType = "application/json";
|
||||||
request.Timeout = 10000;
|
request.Timeout = 20000;
|
||||||
request.KeepAlive = false;
|
request.KeepAlive = false;
|
||||||
|
|
||||||
//Used to hold the JSON response
|
//Used to hold the JSON response
|
||||||
|
|
|
@ -110,14 +110,22 @@ public virtual bool UpdateWithJson(Series series, string host, string username,
|
||||||
{
|
{
|
||||||
//Use Json!
|
//Use Json!
|
||||||
var xbmcShows = GetTvShowsJson(host, username, password);
|
var xbmcShows = GetTvShowsJson(host, username, password);
|
||||||
var path = xbmcShows.Where(s => s.ImdbNumber == series.SeriesId || s.Label == series.Title).FirstOrDefault();
|
|
||||||
|
TvShow path = null;
|
||||||
|
|
||||||
|
//Log if response is null, otherwise try to find XBMC's path for series
|
||||||
|
if (xbmcShows == null)
|
||||||
|
Logger.Trace("Failed to get TV Shows from XBMC");
|
||||||
|
|
||||||
|
else
|
||||||
|
path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.SeriesId || s.Label == series.Title);
|
||||||
|
|
||||||
var hostOnly = GetHostWithoutPort(host);
|
var hostOnly = GetHostWithoutPort(host);
|
||||||
|
|
||||||
if (path != null)
|
if (path != null)
|
||||||
{
|
{
|
||||||
Logger.Trace("Updating series [{0}] on XBMC host: {1}", series.Title, host);
|
Logger.Trace("Updating series [{0}] (Path: {1}) on XBMC host: {2}", series.Title, path.File, host);
|
||||||
var command = String.Format("ExecBuiltIn(UpdateLibrary(video,{0}))", path.File);
|
var command = String.Format("ExecBuiltIn(UpdateLibrary(video, {0}))", path.File);
|
||||||
_eventClientProvider.SendAction(hostOnly, ActionType.ExecBuiltin, command);
|
_eventClientProvider.SendAction(hostOnly, ActionType.ExecBuiltin, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue