1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-25 01:11:43 +00:00

Renamed image is in effect.

Series Detail by series will now store episodeFileId.
This commit is contained in:
Mark McDowall 2011-06-05 15:19:07 -07:00
parent 723882ea48
commit 381d67e56b
3 changed files with 39 additions and 25 deletions

View file

@ -123,20 +123,7 @@ public ActionResult _DeleteAjaxSeriesEditing(int id)
[GridAction]
public ActionResult _AjaxSeasonGrid(int seriesId, int seasonNumber)
{
var episodes = _episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber).Select(c => new EpisodeModel
{
EpisodeId = c.EpisodeId,
EpisodeNumber = c.EpisodeNumber,
SeasonNumber = c.SeasonNumber,
Title = c.Title,
Overview = c.Overview,
AirDate = c.AirDate,
Path = GetEpisodePath(c.EpisodeFile),
Status = c.Status.ToString(),
Quality = c.EpisodeFile == null
? String.Empty
: c.EpisodeFile.Quality.ToString()
});
var episodes = GetEpisodeModels(_episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber));
return View(new GridModel(episodes));
}
@ -151,16 +138,6 @@ public JsonResult GetEpisodeCount(int seriesId)
}, JsonRequestBehavior.AllowGet);
}
//Local Helpers
private string GetEpisodePath(EpisodeFile file)
{
if (file == null)
return String.Empty;
//Return the path relative to the Series' Folder
return file.Path;
}
public ActionResult SearchForSeries(string seriesName)
{
var model = new List<SeriesSearchResultModel>();
@ -281,6 +258,42 @@ private List<SeriesModel> GetSeriesModels(List<Series> seriesInDb)
return series;
}
private List<EpisodeModel> GetEpisodeModels(IList<Episode> episodesInDb)
{
var episodes = new List<EpisodeModel>();
foreach (var e in episodesInDb)
{
var episodeFile = e.EpisodeFile;
var episodePath = String.Empty;
var episodeFileId = 0;
if (episodeFile != null)
{
episodePath = episodeFile.Path;
episodeFileId = episodeFile.EpisodeFileId;
}
episodes.Add(new EpisodeModel
{
EpisodeId = e.EpisodeId,
EpisodeNumber = e.EpisodeNumber,
SeasonNumber = e.SeasonNumber,
Title = e.Title,
Overview = e.Overview,
AirDate = e.AirDate,
Path = episodePath,
EpisodeFileId = episodeFileId,
Status = e.Status.ToString(),
Quality = e.EpisodeFile == null
? String.Empty
: e.EpisodeFile.Quality.ToString()
});
}
return episodes;
}
private string GetSeasonString(int seasonNumber)
{
if (seasonNumber == 0)

View file

@ -7,6 +7,7 @@ public class EpisodeModel
{
public string Title { get; set; }
public int EpisodeId { get; set; }
public int EpisodeFileId { get; set; }
public int EpisodeNumber { get; set; }
public int SeasonNumber { get; set; }
public string Overview { get; set; }

View file

@ -606,7 +606,7 @@
<Content Include="Content\Images\Indexers\NzbMatrix.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Images\Indexers\NzbsOrg.png">
<Content Include="Content\Images\Indexers\Nzbs.org.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Images\Indexers\NzbsRus.png">