mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
Rewrite of InventoryProvider
This commit is contained in:
parent
f62b02a36b
commit
1239da656e
31 changed files with 1009 additions and 677 deletions
|
@ -13,13 +13,9 @@ namespace NzbDrone.Core.Model
|
|||
|
||||
internal List<int> EpisodeNumbers { get; set; }
|
||||
|
||||
internal string EpisodeTitle { get; set; }
|
||||
|
||||
internal DateTime AirDate { get; set; }
|
||||
|
||||
public bool Proper { get; set; }
|
||||
|
||||
public QualityTypes Quality { get; set; }
|
||||
|
||||
public Quality Quality { get; set; }
|
||||
|
||||
public LanguageType Language { get; set; }
|
||||
|
||||
|
@ -36,10 +32,10 @@ namespace NzbDrone.Core.Model
|
|||
public override string ToString()
|
||||
{
|
||||
if (EpisodeNumbers == null)
|
||||
return string.Format("{0} - {1}", CleanTitle, AirDate.Date);
|
||||
return string.Format("{0} - {1} {2}", CleanTitle, AirDate.ToShortDateString(), Quality);
|
||||
|
||||
return string.Format("{0} - S{1:00}E{2}", CleanTitle, SeasonNumber,
|
||||
String.Join("-", EpisodeNumbers));
|
||||
return string.Format("{0} - S{1:00}E{2} {3}", CleanTitle, SeasonNumber,
|
||||
String.Join("-", EpisodeNumbers),Quality);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
92
NzbDrone.Core/Model/Quality.cs
Normal file
92
NzbDrone.Core/Model/Quality.cs
Normal file
|
@ -0,0 +1,92 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
|
||||
namespace NzbDrone.Core.Model
|
||||
{
|
||||
public class Quality : IComparable<Quality>
|
||||
{
|
||||
public QualityTypes QualityType { get; set; }
|
||||
|
||||
public Boolean Proper { get; set; }
|
||||
|
||||
public Quality() { }
|
||||
|
||||
public Quality(QualityTypes quality, Boolean proper)
|
||||
{
|
||||
QualityType = quality;
|
||||
Proper = proper;
|
||||
}
|
||||
|
||||
public int CompareTo(Quality other)
|
||||
{
|
||||
if (other.QualityType > this.QualityType)
|
||||
return -1;
|
||||
|
||||
if (other.QualityType < this.QualityType)
|
||||
return 1;
|
||||
|
||||
if (other.QualityType == this.QualityType && other.Proper == this.Proper)
|
||||
return 0;
|
||||
|
||||
if (this.Proper && !other.Proper)
|
||||
return 1;
|
||||
|
||||
if (!this.Proper && other.Proper)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static bool operator !=(Quality x, Quality y)
|
||||
{
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
public static bool operator ==(Quality x, Quality y)
|
||||
{
|
||||
var xObj = (Object)x;
|
||||
var yObj = (object)y;
|
||||
|
||||
if (xObj == null || yObj == null)
|
||||
{
|
||||
return xObj == yObj;
|
||||
}
|
||||
|
||||
return x.CompareTo(y) == 0;
|
||||
}
|
||||
|
||||
public static bool operator >(Quality x, Quality y)
|
||||
{
|
||||
return x.CompareTo(y) > 0;
|
||||
}
|
||||
|
||||
public static bool operator <(Quality x, Quality y)
|
||||
{
|
||||
return x.CompareTo(y) < 1;
|
||||
}
|
||||
|
||||
public static bool operator <=(Quality x, Quality y)
|
||||
{
|
||||
return x.CompareTo(y) <= 0;
|
||||
}
|
||||
|
||||
public static bool operator >=(Quality x, Quality y)
|
||||
{
|
||||
return x.CompareTo(y) >= 0;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = QualityType.ToString();
|
||||
if (Proper)
|
||||
{
|
||||
result += " [proper]";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ namespace NzbDrone.Core.Model
|
|||
internal int SeasonNumber { get; set; }
|
||||
internal int Year { get; set; }
|
||||
|
||||
public QualityTypes Quality { get; set; }
|
||||
public Quality Quality { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue