mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 12:32:31 +01:00
Fixed Series.QualityProfile relationship
more subsonic cleanup
This commit is contained in:
parent
17d084cdf3
commit
520e9c9d14
@ -40,6 +40,29 @@ public void Test_Storage()
|
|||||||
Assert.AreEqual(testProfile.Allowed, fetch.Allowed);
|
Assert.AreEqual(testProfile.Allowed, fetch.Allowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_Storage_no_allowed()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var database = MockLib.GetEmptyDatabase();
|
||||||
|
var testProfile = new QualityProfile
|
||||||
|
{
|
||||||
|
Name = Guid.NewGuid().ToString(),
|
||||||
|
Cutoff = QualityTypes.SDTV
|
||||||
|
};
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var id = Convert.ToInt32(database.Insert(testProfile));
|
||||||
|
var fetch = database.SingleOrDefault<QualityProfile>(id);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(id, fetch.QualityProfileId);
|
||||||
|
Assert.AreEqual(testProfile.Name, fetch.Name);
|
||||||
|
Assert.AreEqual(testProfile.Cutoff, fetch.Cutoff);
|
||||||
|
fetch.Allowed.Should().HaveCount(0);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_Series_Quality()
|
public void Test_Series_Quality()
|
||||||
{
|
{
|
||||||
|
Binary file not shown.
@ -51,9 +51,9 @@ public virtual List<QualityProfile> GetAllProfiles()
|
|||||||
return profiles;
|
return profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual QualityProfile Find(int profileId)
|
public virtual QualityProfile Get(int profileId)
|
||||||
{
|
{
|
||||||
return _database.SingleOrDefault<QualityProfile>(profileId);
|
return _database.Single<QualityProfile>(profileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetupDefaultProfiles()
|
public virtual void SetupDefaultProfiles()
|
||||||
|
@ -38,13 +38,18 @@ public SeriesProvider()
|
|||||||
public virtual IList<Series> GetAllSeries()
|
public virtual IList<Series> GetAllSeries()
|
||||||
{
|
{
|
||||||
var series = _database.Fetch<Series>();
|
var series = _database.Fetch<Series>();
|
||||||
series.ForEach(c => c.QualityProfile = _qualityProvider.Find(c.QualityProfileId));
|
series.ForEach(c => c.QualityProfile = _qualityProvider.Get(c.QualityProfileId));
|
||||||
return series;
|
return series;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Series GetSeries(int seriesId)
|
public virtual Series GetSeries(int seriesId)
|
||||||
{
|
{
|
||||||
return _database.SingleOrDefault<Series>("WHERE seriesId= @0", seriesId);
|
var series = _database.SingleOrDefault<Series>("WHERE seriesId= @0", seriesId);
|
||||||
|
if (series != null)
|
||||||
|
{
|
||||||
|
series.QualityProfile = _qualityProvider.Get(series.QualityProfileId);
|
||||||
|
}
|
||||||
|
return series;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using PetaPoco;
|
using PetaPoco;
|
||||||
|
|
||||||
@ -9,30 +8,26 @@ namespace NzbDrone.Core.Repository
|
|||||||
[PrimaryKey("EpisodeId", autoIncrement = true)]
|
[PrimaryKey("EpisodeId", autoIncrement = true)]
|
||||||
public class Episode
|
public class Episode
|
||||||
{
|
{
|
||||||
|
public int EpisodeId { get; set; }
|
||||||
|
|
||||||
public virtual int EpisodeId { get; set; }
|
public int? TvDbEpisodeId { get; set; }
|
||||||
|
|
||||||
public virtual int? TvDbEpisodeId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
|
public int EpisodeFileId { get; set; }
|
||||||
public virtual int SeriesId { get; set; }
|
public int SeasonNumber { get; set; }
|
||||||
public virtual int EpisodeFileId { get; set; }
|
public int EpisodeNumber { get; set; }
|
||||||
public virtual int SeasonNumber { get; set; }
|
public string Title { get; set; }
|
||||||
public virtual int EpisodeNumber { get; set; }
|
public DateTime AirDate { get; set; }
|
||||||
public virtual string Title { get; set; }
|
|
||||||
public virtual DateTime AirDate { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public virtual string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
|
|
||||||
public virtual Boolean Ignored { get; set; }
|
public Boolean Ignored { get; set; }
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
public Boolean IsDailyEpisode
|
public Boolean IsDailyEpisode
|
||||||
{
|
{
|
||||||
get
|
get { return EpisodeNumber == 0; }
|
||||||
{
|
|
||||||
return EpisodeNumber == 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -42,7 +37,7 @@ public Boolean IsDailyEpisode
|
|||||||
/// Used to specify when the episode was grapped.
|
/// Used to specify when the episode was grapped.
|
||||||
/// this filed is used by status as an expirable "Grabbed" status.
|
/// this filed is used by status as an expirable "Grabbed" status.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public virtual DateTime? GrabDate { get; set; }
|
public DateTime? GrabDate { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
@ -71,25 +66,21 @@ public EpisodeStatusType Status
|
|||||||
|
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
public virtual Series Series { get; set; }
|
public Series Series { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
public virtual EpisodeFile EpisodeFile { get; set; }
|
public EpisodeFile EpisodeFile { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[Ignore]
|
|
||||||
public virtual IList<History> Histories { get; protected set; }
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
var seriesTitle = Series == null ? "[NULL]" : Series.Title;
|
string seriesTitle = Series == null ? "[NULL]" : Series.Title;
|
||||||
|
|
||||||
if (IsDailyEpisode)
|
if (IsDailyEpisode)
|
||||||
return string.Format("{0} - {1}", seriesTitle, AirDate.Date);
|
return string.Format("{0} - {1}", seriesTitle, AirDate.Date);
|
||||||
|
|
||||||
return string.Format("{0} - S{1:00}E{2:00}", seriesTitle, SeasonNumber, EpisodeNumber);
|
return string.Format("{0} - S{1:00}E{2:00}", seriesTitle, SeasonNumber, EpisodeNumber);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,10 +9,10 @@ namespace NzbDrone.Core.Repository
|
|||||||
[PrimaryKey("EpisodeFileId", autoIncrement = true)]
|
[PrimaryKey("EpisodeFileId", autoIncrement = true)]
|
||||||
public class EpisodeFile
|
public class EpisodeFile
|
||||||
{
|
{
|
||||||
public virtual int EpisodeFileId { get; set; }
|
public int EpisodeFileId { get; set; }
|
||||||
|
|
||||||
public virtual int SeriesId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
public virtual int SeasonNumber { get; set; }
|
public int SeasonNumber { get; set; }
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public QualityTypes Quality { get; set; }
|
public QualityTypes Quality { get; set; }
|
||||||
public bool Proper { get; set; }
|
public bool Proper { get; set; }
|
||||||
@ -20,9 +20,9 @@ public class EpisodeFile
|
|||||||
public DateTime DateAdded { get; set; }
|
public DateTime DateAdded { get; set; }
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
public virtual IList<Episode> Episodes { get; set; }
|
public IList<Episode> Episodes { get; set; }
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
public virtual Series Series { get; set; }
|
public Series Series { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
@ -10,7 +11,6 @@ namespace NzbDrone.Core.Repository.Quality
|
|||||||
[PrimaryKey("QualityProfileId", autoIncrement = true)]
|
[PrimaryKey("QualityProfileId", autoIncrement = true)]
|
||||||
public class QualityProfile
|
public class QualityProfile
|
||||||
{
|
{
|
||||||
|
|
||||||
public virtual int QualityProfileId { get; set; }
|
public virtual int QualityProfileId { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "A Name is Required")]
|
[Required(ErrorMessage = "A Name is Required")]
|
||||||
@ -49,15 +49,11 @@ private set
|
|||||||
{
|
{
|
||||||
var qualities = value.Split('|');
|
var qualities = value.Split('|');
|
||||||
Allowed = new List<QualityTypes>(qualities.Length);
|
Allowed = new List<QualityTypes>(qualities.Length);
|
||||||
foreach (var quality in qualities)
|
foreach (var quality in qualities.Where(q => !String.IsNullOrWhiteSpace(q)))
|
||||||
{
|
{
|
||||||
Allowed.Add((QualityTypes)Convert.ToInt32(quality));
|
Allowed.Add((QualityTypes)Convert.ToInt32(quality));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Ignore]
|
|
||||||
|
|
||||||
public virtual List<Series> Series { get; private set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,10 +6,10 @@ namespace NzbDrone.Core.Repository
|
|||||||
[PrimaryKey("CleanTitle", autoIncrement = false)]
|
[PrimaryKey("CleanTitle", autoIncrement = false)]
|
||||||
public class SceneMapping
|
public class SceneMapping
|
||||||
{
|
{
|
||||||
public virtual string CleanTitle { get; set; }
|
public string CleanTitle { get; set; }
|
||||||
|
|
||||||
public virtual int SeriesId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
|
|
||||||
public virtual string SceneName { get; set; }
|
public string SceneName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using NzbDrone.Core.Repository.Quality;
|
using NzbDrone.Core.Repository.Quality;
|
||||||
using PetaPoco;
|
using PetaPoco;
|
||||||
@ -9,7 +8,6 @@ namespace NzbDrone.Core.Repository
|
|||||||
[PrimaryKey("SeriesId", autoIncrement = false)]
|
[PrimaryKey("SeriesId", autoIncrement = false)]
|
||||||
public class Series
|
public class Series
|
||||||
{
|
{
|
||||||
|
|
||||||
public virtual int SeriesId { get; set; }
|
public virtual int SeriesId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
@ -38,6 +36,14 @@ public class Series
|
|||||||
public bool Monitored { get; set; }
|
public bool Monitored { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public virtual int QualityProfileId { get; set; }
|
||||||
|
|
||||||
|
public bool SeasonFolder { get; set; }
|
||||||
|
|
||||||
|
public DateTime? LastInfoSync { get; set; }
|
||||||
|
|
||||||
|
public DateTime? LastDiskSync { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this <see cref="Series"/> is hidden.
|
/// Gets or sets a value indicating whether this <see cref="Series"/> is hidden.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -47,15 +53,7 @@ public class Series
|
|||||||
[Ignore]
|
[Ignore]
|
||||||
public bool Hidden { get; set; }
|
public bool Hidden { get; set; }
|
||||||
|
|
||||||
public virtual int QualityProfileId { get; set; }
|
|
||||||
|
|
||||||
public bool SeasonFolder { get; set; }
|
|
||||||
|
|
||||||
public DateTime? LastInfoSync { get; set; }
|
|
||||||
|
|
||||||
public DateTime? LastDiskSync { get; set; }
|
|
||||||
|
|
||||||
[Ignore]
|
[Ignore]
|
||||||
public virtual QualityProfile QualityProfile { get; set; }
|
public QualityProfile QualityProfile { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user