XbmcProvider will use the HTTP API when updating the library for Eden clients (EventServer was failing).
This commit is contained in:
parent
8415d4a440
commit
b52585d62a
|
@ -1,7 +1,6 @@
|
||||||
// ReSharper disable RedundantUsingDirective
|
// ReSharper disable RedundantUsingDirective
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Model.Xbmc;
|
using NzbDrone.Core.Model.Xbmc;
|
||||||
|
|
|
@ -510,8 +510,13 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
fakeHttp.Setup(s => s.PostCommand(host, username, password, It.Is<string>(e => e.Replace(" ", "").Replace("\r\n", "").Replace("\t", "") == expectedJson.Replace(" ", ""))))
|
fakeHttp.Setup(s => s.PostCommand(host, username, password, It.Is<string>(e => e.Replace(" ", "").Replace("\r\n", "").Replace("\t", "") == expectedJson.Replace(" ", ""))))
|
||||||
.Returns(tvshows);
|
.Returns(tvshows);
|
||||||
|
|
||||||
var fakeEventClient = Mocker.GetMock<EventClientProvider>();
|
var command = "ExecBuiltIn(UpdateLibrary(video,smb://HOMESERVER/TV/30 Rock/))";
|
||||||
fakeEventClient.Setup(s => s.SendAction("localhost", ActionType.ExecBuiltin, "ExecBuiltIn(UpdateLibrary(video,smb://HOMESERVER/TV/30 Rock/))"));
|
var url = String.Format("http://{0}/xbmcCmds/xbmcHttp?command={1}", host, command);
|
||||||
|
|
||||||
|
fakeHttp.Setup(s => s.DownloadString(url, username, password)).Returns("<html><li>OK</html>");
|
||||||
|
|
||||||
|
//var fakeEventClient = Mocker.GetMock<EventClientProvider>();
|
||||||
|
//fakeEventClient.Setup(s => s.SendAction("localhost", ActionType.ExecBuiltin, "ExecBuiltIn(UpdateLibrary(video,smb://HOMESERVER/TV/30 Rock/))"));
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var result = Mocker.Resolve<XbmcProvider>().UpdateWithJson(fakeSeries, host, username, password);
|
var result = Mocker.Resolve<XbmcProvider>().UpdateWithJson(fakeSeries, host, username, password);
|
||||||
|
@ -541,8 +546,13 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
fakeHttp.Setup(s => s.PostCommand(host, username, password, It.Is<string>(e => e.Replace(" ", "").Replace("\r\n", "").Replace("\t", "") == expectedJson.Replace(" ", ""))))
|
fakeHttp.Setup(s => s.PostCommand(host, username, password, It.Is<string>(e => e.Replace(" ", "").Replace("\r\n", "").Replace("\t", "") == expectedJson.Replace(" ", ""))))
|
||||||
.Returns(tvshows);
|
.Returns(tvshows);
|
||||||
|
|
||||||
var fakeEventClient = Mocker.GetMock<EventClientProvider>();
|
var command = "ExecBuiltIn(UpdateLibrary(video))";
|
||||||
fakeEventClient.Setup(s => s.SendAction("localhost", ActionType.ExecBuiltin, "ExecBuiltIn(UpdateLibrary(video))"));
|
var url = String.Format("http://{0}/xbmcCmds/xbmcHttp?command={1}", host, command);
|
||||||
|
|
||||||
|
fakeHttp.Setup(s => s.DownloadString(url, username, password)).Returns("<html><li>OK</html>");
|
||||||
|
|
||||||
|
//var fakeEventClient = Mocker.GetMock<EventClientProvider>();
|
||||||
|
//fakeEventClient.Setup(s => s.SendAction("localhost", ActionType.ExecBuiltin, "ExecBuiltIn(UpdateLibrary(video))"));
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var result = Mocker.Resolve<XbmcProvider>().UpdateWithJson(fakeSeries, host, username, password);
|
var result = Mocker.Resolve<XbmcProvider>().UpdateWithJson(fakeSeries, host, username, password);
|
||||||
|
|
|
@ -120,20 +120,23 @@ namespace NzbDrone.Core.Providers
|
||||||
else
|
else
|
||||||
path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.SeriesId || s.Label == series.Title);
|
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}] (Path: {1}) on XBMC host: {2}", series.Title, path.File, 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);
|
||||||
|
var command = String.Format("ExecBuiltIn(UpdateLibrary(video,{0}))", path.File);
|
||||||
|
SendCommand(host, command, username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Trace("Series [{0}] doesn't exist on XBMC host: {1}, Updating Entire Library", series.Title, host);
|
Logger.Trace("Series [{0}] doesn't exist on XBMC host: {1}, Updating Entire Library", series.Title, host);
|
||||||
var command = String.Format("ExecBuiltIn(UpdateLibrary(video))");
|
var command = String.Format("ExecBuiltIn(UpdateLibrary(video))");
|
||||||
_eventClientProvider.SendAction(hostOnly, ActionType.ExecBuiltin, command);
|
//_eventClientProvider.SendAction(hostOnly, ActionType.ExecBuiltin, command);
|
||||||
|
SendCommand(host, "ExecBuiltIn(UpdateLibrary(video))", username, password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue