mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-17 15:59:36 +02:00
Fixed XBMC updating
This commit is contained in:
parent
66bce4b51e
commit
9722506aca
@ -72,7 +72,13 @@ public void ProcessDownloadedEpiosdesFolder()
|
||||
{
|
||||
try
|
||||
{
|
||||
var series = _parsingService.GetSeries(videoFile);
|
||||
var series = _parsingService.GetSeries(Path.GetFileNameWithoutExtension(videoFile));
|
||||
|
||||
if (series == null)
|
||||
{
|
||||
_logger.Trace("Unknown Series for file: {0}", videoFile);
|
||||
}
|
||||
|
||||
ProcessVideoFile(videoFile, series);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -10,6 +10,7 @@
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Tv;
|
||||
using Omu.ValueInjecter;
|
||||
|
||||
namespace NzbDrone.Core.Notifications
|
||||
@ -134,10 +135,10 @@ private INotification GetInstance(NotificationDefinition indexerDefinition)
|
||||
return instance;
|
||||
}
|
||||
|
||||
private string GetMessage(ParsedEpisodeInfo parsedEpisodeInfo)
|
||||
private string GetMessage(ParsedEpisodeInfo parsedEpisodeInfo, Series series)
|
||||
{
|
||||
return String.Format("{0} - {1}{2}",
|
||||
parsedEpisodeInfo.SeriesTitle,
|
||||
series.Title,
|
||||
parsedEpisodeInfo.SeasonNumber,
|
||||
String.Concat(parsedEpisodeInfo.EpisodeNumbers.Select(i => String.Format("x{0:00}", i))));
|
||||
}
|
||||
@ -148,7 +149,7 @@ public void Handle(EpisodeGrabbedEvent message)
|
||||
.ToList()
|
||||
.ForEach(notification =>
|
||||
notification.Instance
|
||||
.OnGrab(GetMessage(message.Episode.ParsedEpisodeInfo))
|
||||
.OnGrab(GetMessage(message.Episode.ParsedEpisodeInfo, message.Episode.Series))
|
||||
);
|
||||
}
|
||||
|
||||
@ -158,7 +159,7 @@ public void Handle(EpisodeDownloadedEvent message)
|
||||
.ToList()
|
||||
.ForEach(notification =>
|
||||
notification.Instance
|
||||
.OnDownload(GetMessage(message.ParsedEpisodeInfo), message.Series)
|
||||
.OnDownload(GetMessage(message.ParsedEpisodeInfo, message.Series), message.Series)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -39,19 +39,19 @@ public virtual void Update(XbmcSettings settings, Series series)
|
||||
|
||||
var username = settings.Username;
|
||||
var password = settings.Password;
|
||||
var host = settings.Host;
|
||||
var address = String.Format("{0}:{1}", settings.Host, settings.Port);
|
||||
|
||||
Logger.Trace("Determining version of XBMC Host: {0}", host);
|
||||
var version = GetJsonVersion(host, username, password);
|
||||
Logger.Trace("Determining version of XBMC Host: {0}", address);
|
||||
var version = GetJsonVersion(address, username, password);
|
||||
|
||||
//If Dharma
|
||||
//Dharma
|
||||
if (version == new XbmcVersion(2))
|
||||
{
|
||||
//Check for active player only when we should skip updates when playing
|
||||
if (!settings.AlwaysUpdate)
|
||||
{
|
||||
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
|
||||
var activePlayers = GetActivePlayersDharma(host, username, password);
|
||||
Logger.Trace("Determining if there are any active players on XBMC host: {0}", address);
|
||||
var activePlayers = GetActivePlayersDharma(address, username, password);
|
||||
|
||||
//If video is currently playing, then skip update
|
||||
if (activePlayers["video"])
|
||||
@ -60,17 +60,17 @@ public virtual void Update(XbmcSettings settings, Series series)
|
||||
return;
|
||||
}
|
||||
}
|
||||
UpdateWithHttp(series, host, username, password);
|
||||
UpdateWithHttp(series, address, username, password);
|
||||
}
|
||||
|
||||
//If Eden or newer (attempting to make it future compatible)
|
||||
//Eden
|
||||
else if (version == new XbmcVersion(3) || version == new XbmcVersion(4))
|
||||
{
|
||||
//Check for active player only when we should skip updates when playing
|
||||
if (!settings.AlwaysUpdate)
|
||||
{
|
||||
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
|
||||
var activePlayers = GetActivePlayersEden(host, username, password);
|
||||
Logger.Trace("Determining if there are any active players on XBMC host: {0}", address);
|
||||
var activePlayers = GetActivePlayersEden(address, username, password);
|
||||
|
||||
//If video is currently playing, then skip update
|
||||
if (activePlayers.Any(a => a.Type.Equals("video")))
|
||||
@ -80,16 +80,17 @@ public virtual void Update(XbmcSettings settings, Series series)
|
||||
}
|
||||
}
|
||||
|
||||
UpdateWithJsonExecBuiltIn(series, host, username, password);
|
||||
UpdateWithJsonExecBuiltIn(series, address, username, password);
|
||||
}
|
||||
|
||||
//Frodo or newer (attempting to make it future compatible)
|
||||
else if (version >= new XbmcVersion(5))
|
||||
{
|
||||
//Check for active player only when we should skip updates when playing
|
||||
if (!settings.AlwaysUpdate)
|
||||
{
|
||||
Logger.Trace("Determining if there are any active players on XBMC host: {0}", host);
|
||||
var activePlayers = GetActivePlayersEden(host, username, password);
|
||||
Logger.Trace("Determining if there are any active players on XBMC host: {0}", address);
|
||||
var activePlayers = GetActivePlayersEden(address, username, password);
|
||||
|
||||
//If video is currently playing, then skip update
|
||||
if (activePlayers.Any(a => a.Type.Equals("video")))
|
||||
@ -99,7 +100,7 @@ public virtual void Update(XbmcSettings settings, Series series)
|
||||
}
|
||||
}
|
||||
|
||||
UpdateWithJsonVideoLibraryScan(series, host, username, password);
|
||||
UpdateWithJsonVideoLibraryScan(series, address, username, password);
|
||||
}
|
||||
|
||||
//Log Version zero if check failed
|
||||
@ -163,7 +164,7 @@ public virtual bool UpdateWithJsonVideoLibraryScan(Series series, string host, s
|
||||
Logger.Trace("Failed to get TV Shows from XBMC");
|
||||
|
||||
else
|
||||
path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.Id || s.Label == series.Title);
|
||||
path = xbmcShows.FirstOrDefault(s => s.ImdbNumber == series.TvdbId || s.Label == series.Title);
|
||||
|
||||
var postJson = new JObject();
|
||||
postJson.Add(new JProperty("jsonrpc", "2.0"));
|
||||
|
Loading…
Reference in New Issue
Block a user