1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-24 22:35:49 -04:00

Added: A Huge Cleanup of old Series Code. (Let's pray nothing breaks :P) (#2589)

This commit is contained in:
Qstick
2018-03-14 16:41:36 -04:00
committed by Leonardo Galli
parent 8a6d67a6d7
commit 25e10e26e3
551 changed files with 2835 additions and 18867 deletions
@@ -1,40 +0,0 @@
using System.Linq;
using System.Collections.Generic;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Core.MediaFiles.MediaInfo;
namespace NzbDrone.Core.Parser.Model
{
public class LocalEpisode
{
public LocalEpisode()
{
Episodes = new List<Episode>();
}
public string Path { get; set; }
public long Size { get; set; }
public ParsedEpisodeInfo ParsedEpisodeInfo { get; set; }
public Series Series { get; set; }
public List<Episode> Episodes { get; set; }
public QualityModel Quality { get; set; }
public MediaInfoModel MediaInfo { get; set; }
public bool ExistingFile { get; set; }
public int SeasonNumber
{
get
{
return Episodes.Select(c => c.SeasonNumber).Distinct().Single();
}
}
public bool IsSpecial => SeasonNumber == 0;
public override string ToString()
{
return Path;
}
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
using System.Linq;
using System.Collections.Generic;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Movies;
using NzbDrone.Core.MediaFiles.MediaInfo;
namespace NzbDrone.Core.Parser.Model
@@ -1,92 +0,0 @@
using System.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Parser.Model
{
public class ParsedEpisodeInfo
{
public string SeriesTitle { get; set; }
public SeriesTitleInfo SeriesTitleInfo { get; set; }
public QualityModel Quality { get; set; }
public int SeasonNumber { get; set; }
public int[] EpisodeNumbers { get; set; }
public int[] AbsoluteEpisodeNumbers { get; set; }
public string AirDate { get; set; }
public Language Language { get; set; }
public bool FullSeason { get; set; }
public bool Special { get; set; }
public string ReleaseGroup { get; set; }
public string ReleaseHash { get; set; }
public ParsedEpisodeInfo()
{
EpisodeNumbers = new int[0];
AbsoluteEpisodeNumbers = new int[0];
}
public bool IsDaily
{
get
{
return !string.IsNullOrWhiteSpace(AirDate);
}
//This prevents manually downloading a release from blowing up in mono
//TODO: Is there a better way?
private set { }
}
public bool IsAbsoluteNumbering
{
get
{
return AbsoluteEpisodeNumbers.Any();
}
//This prevents manually downloading a release from blowing up in mono
//TODO: Is there a better way?
private set { }
}
public bool IsPossibleSpecialEpisode
{
get
{
// if we don't have eny episode numbers we are likely a special episode and need to do a search by episode title
return (AirDate.IsNullOrWhiteSpace() &&
SeriesTitle.IsNullOrWhiteSpace() &&
(EpisodeNumbers.Length == 0 || SeasonNumber == 0) ||
!SeriesTitle.IsNullOrWhiteSpace() && Special);
}
//This prevents manually downloading a release from blowing up in mono
//TODO: Is there a better way?
private set {}
}
public override string ToString()
{
string episodeString = "[Unknown Episode]";
if (IsDaily && EpisodeNumbers.Empty())
{
episodeString = string.Format("{0}", AirDate);
}
else if (FullSeason)
{
episodeString = string.Format("Season {0:00}", SeasonNumber);
}
else if (EpisodeNumbers != null && EpisodeNumbers.Any())
{
episodeString = string.Format("S{0:00}E{1}", SeasonNumber, string.Join("-", EpisodeNumbers.Select(c => c.ToString("00"))));
}
else if (AbsoluteEpisodeNumbers != null && AbsoluteEpisodeNumbers.Any())
{
episodeString = string.Format("{0}", string.Join("-", AbsoluteEpisodeNumbers.Select(c => c.ToString("000"))));
}
return string.Format("{0} - {1} {2}", SeriesTitle, episodeString, Quality);
}
}
}
@@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Parser.Model
{
public class RemoteEpisode
{
public ReleaseInfo Release { get; set; }
public ParsedEpisodeInfo ParsedEpisodeInfo { get; set; }
public Series Series { get; set; }
public List<Episode> Episodes { get; set; }
public bool DownloadAllowed { get; set; }
public bool IsRecentEpisode()
{
return Episodes.Any(e => e.AirDateUtc >= DateTime.UtcNow.Date.AddDays(-14));
}
public override string ToString()
{
return Release.Title;
}
}
}
@@ -1,14 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Parser.Model
{
public class RemoteMovie
{
public ReleaseInfo Release { get; set; }
public ParsedEpisodeInfo ParsedEpisodeInfo { get; set; } //TODO: Change to ParsedMovieInfo, for now though ParsedEpisodeInfo will do.
public ParsedMovieInfo ParsedMovieInfo { get; set; }
public Movie Movie { get; set; }
public MappingResultType MappingResult { get; set; }
@@ -18,4 +17,4 @@ namespace NzbDrone.Core.Parser.Model
return Release.Title;
}
}
}
}