Fixed up issues with initial XEM implementation

pull/2/head
Mark McDowall 12 years ago
parent 1b2fe6e842
commit c693f90271

@ -1,24 +1,10 @@
{
"result": "success",
"data": {
"220571": [
"Is This a Zombie? Of the Dead",
"Kore wa Zombie Desuka?",
"Kore wa Zombie Desuka? Of the Dead",
"Kore wa Zombie Desuka Of the Dead",
"Kore wa Zombie Desu ka - Of the Dead",
"Kore wa Zombie Desu ka of the Dead"
],
"79151": [
"Fate Stay Night",
"Fate/Zero",
"Fate Zero",
"Fate/Zero (2012)",
"Fate Zero S2",
"Fate Zero"
]
},
"data": [
"73141",
"79886",
],
"message": ""
}

@ -0,0 +1,24 @@
{
"result": "success",
"data": {
"220571": [
"Is This a Zombie? Of the Dead",
"Kore wa Zombie Desuka?",
"Kore wa Zombie Desuka? Of the Dead",
"Kore wa Zombie Desuka Of the Dead",
"Kore wa Zombie Desu ka - Of the Dead",
"Kore wa Zombie Desu ka of the Dead"
],
"79151": [
"Fate Stay Night",
"Fate/Zero",
"Fate Zero",
"Fate/Zero (2012)",
"Fate Zero S2",
"Fate Zero"
]
},
"message": ""
}

@ -42,7 +42,6 @@ namespace NzbDrone.Core.Test.JobTests
.Setup(j => j.Start(notification, series[0].SeriesId, 0))
.Callback(() => series[0].LastDiskSync = DateTime.Now);
Mocker.GetMock<DiskScanJob>()
.Setup(j => j.Start(notification, series[1].SeriesId, 0))
.Callback(() => series[1].LastDiskSync = DateTime.Now);

@ -335,10 +335,13 @@
<SubType>Designer</SubType>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="Files\Xem\Ids.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Files\Xem\Failure.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Files\Xem\Ids.txt">
<Content Include="Files\Xem\Names.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Files\Xem\Mappings.txt">

@ -44,8 +44,13 @@ namespace NzbDrone.Core.Jobs
_logger.Trace("Starting XEM Update for all series");
_xemProvider.UpdateMappings();
}
_logger.Trace("Starting XEM Update for series: {0}", targetId);
_xemProvider.UpdateMappings(targetId);
else
{
_logger.Trace("Starting XEM Update for series: {0}", targetId);
_xemProvider.UpdateMappings(targetId);
}
_logger.Trace("XEM Update complete");
}
}

@ -32,14 +32,15 @@ namespace NzbDrone.Core.Providers
public virtual List<Int32> GetXemSeriesIds(string origin = "tvdb")
{
_logger.Trace("Fetching Series IDs from: {0}", origin);
var url = String.Format("{0}allNames?origin={1}", XEM_BASE_URL, origin);
var url = String.Format("{0}havemap?origin={1}", XEM_BASE_URL, origin);
var response =_httpProvider.DownloadString(url);
CheckForFailureResult(response);
var result = JsonConvert.DeserializeObject<Dictionary<int, List<String>>>(JObject.Parse(response).SelectToken("data").ToString());
var result = JsonConvert.DeserializeObject<XemResult<List<Int32>>>(response);
return result.Keys.ToList();
return result.Data.ToList();
}
public virtual List<XemSceneTvdbMapping> GetSceneTvdbMappings(int id)

@ -36,7 +36,7 @@ namespace NzbDrone.Core.Providers
{
var ids = _xemCommunicationProvider.GetXemSeriesIds();
var series = _seriesProvider.GetAllSeries();
var wantedSeries = series.Where(s => ids.Contains(s.SeriesId));
var wantedSeries = series.Where(s => ids.Contains(s.SeriesId)).ToList();
foreach(var ser in wantedSeries)
{
@ -80,11 +80,20 @@ namespace NzbDrone.Core.Providers
return;
}
var episodes = _episodeProvider.GetEpisodeBySeries(series.SeriesId);
foreach (var mapping in mappings)
{
_logger.Trace("Setting scene numbering mappings for {0} S{1:00}E{2:00}", series.Title, mapping.Tvdb.Season, mapping.Tvdb.Episode);
var episode = _episodeProvider.GetEpisode(series.SeriesId, mapping.Tvdb.Season, mapping.Tvdb.Episode);
var episode = episodes.SingleOrDefault(e => e.SeasonNumber == mapping.Tvdb.Season && e.EpisodeNumber == mapping.Tvdb.Episode);
if (episode == null)
{
_logger.Trace("Information hasn't been added to TheTVDB yet, skipping.");
continue;
}
episode.AbsoluteEpisodeNumber = mapping.Scene.Absolute;
episode.SceneSeasonNumber = mapping.Scene.Season;
episode.SceneEpisodeNumber = mapping.Scene.Episode;
@ -93,6 +102,10 @@ namespace NzbDrone.Core.Providers
_logger.Trace("Committing scene numbering mappings to database for: {0}", series.Title);
_episodeProvider.UpdateEpisodes(episodesToUpdate);
_logger.Trace("Setting UseSceneMapping for {0}", series.Title);
series.UseSceneNumbering = true;
_seriesProvider.UpdateSeries(series);
}
catch (Exception ex)

Loading…
Cancel
Save