mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-16 15:29:40 +02:00
Updated subsonic to latest nightly build
Added foreign relations to all entities object Removed unnecessary libraries
This commit is contained in:
parent
899e5a9a22
commit
beaf0cf939
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Moq;
|
using Moq;
|
||||||
@ -22,14 +23,10 @@ public static string[] StandardSeries
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static IRepository EmptyRepository
|
public static IRepository GetEmptyRepository()
|
||||||
{
|
{
|
||||||
get
|
var provider = ProviderFactory.GetProvider("Data Source=" + Guid.NewGuid() + ".testdb;Version=3;New=True", "System.Data.SQLite");
|
||||||
{
|
return new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations);
|
||||||
|
|
||||||
var provider = ProviderFactory.GetProvider("Data Source=" + Guid.NewGuid() + ".testdb;Version=3;New=True", "System.Data.SQLite");
|
|
||||||
return new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IConfigProvider StandardConfig
|
public static IConfigProvider StandardConfig
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using MbUnit.Framework;
|
using MbUnit.Framework;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
using NzbDrone.Core.Repository.Quality;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
@ -18,11 +19,11 @@ public void Test_Storage()
|
|||||||
{
|
{
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
var repo = MockLib.EmptyRepository;
|
var repo = MockLib.GetEmptyRepository();
|
||||||
var testProfile = new QualityProfile
|
var testProfile = new QualityProfile
|
||||||
{
|
{
|
||||||
Cutoff = Quality.SDTV,
|
Cutoff = QualityTypes.SDTV,
|
||||||
Allowed = new List<Quality>() { Quality.HDTV, Quality.DVD },
|
Allowed = new List<QualityTypes>() { QualityTypes.HDTV, QualityTypes.DVD },
|
||||||
};
|
};
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
using SubSonic.Repository;
|
using SubSonic.Repository;
|
||||||
using TvdbLib.Data;
|
using TvdbLib.Data;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
@ -34,10 +35,10 @@ public void skip_same_series_diffrent_folder()
|
|||||||
|
|
||||||
//setup db to return a fake series
|
//setup db to return a fake series
|
||||||
Series fakeSeries = Builder<Series>.CreateNew()
|
Series fakeSeries = Builder<Series>.CreateNew()
|
||||||
.With(f => f.TvdbId = tvDbId.ToString())
|
.With(f => f.TvdbId = tvDbId)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
moqData.Setup(f => f.Exists<Series>(c => c.TvdbId == tvDbId.ToString())).
|
moqData.Setup(f => f.Exists<Series>(c => c.TvdbId == tvDbId)).
|
||||||
Returns(true);
|
Returns(true);
|
||||||
|
|
||||||
//setup tvdb to return the same show,
|
//setup tvdb to return the same show,
|
||||||
@ -66,5 +67,24 @@ public void skip_same_series_diffrent_folder()
|
|||||||
//Verify that the show was added to the database only once.
|
//Verify that the show was added to the database only once.
|
||||||
moqData.Verify(c => c.Add(It.IsAny<Series>()), Times.Once());
|
moqData.Verify(c => c.Add(It.IsAny<Series>()), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
|
||||||
|
[Description("This test confirms that the tvdb id stored in the db is preserved rather than being replaced by an auto incrementing value")]
|
||||||
|
public void tvdbid_is_preserved([RandomNumbers(Minimum = 100, Maximum = 999, Count = 1)] int tvdbId)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var sonicRepo = MockLib.GetEmptyRepository();
|
||||||
|
var series = Builder<Series>.CreateNew().With(c => c.TvdbId = tvdbId).Build();
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var addId = sonicRepo.Add(series);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(tvdbId, addId);
|
||||||
|
var allSeries = sonicRepo.All<Series>();
|
||||||
|
Assert.IsNotEmpty(allSeries);
|
||||||
|
Assert.AreEqual(tvdbId, allSeries.First().TvdbId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
NzbDrone.Core/Libraries/Castle.Core.dll
Normal file
BIN
NzbDrone.Core/Libraries/Castle.Core.dll
Normal file
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -121,10 +121,17 @@
|
|||||||
<StartupObject />
|
<StartupObject />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Castle.Core, Version=2.5.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>Libraries\Castle.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL" />
|
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL" />
|
||||||
<Reference Include="Ninject, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL" />
|
<Reference Include="Ninject, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL" />
|
||||||
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL" />
|
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL" />
|
||||||
<Reference Include="SubSonic.Core, Version=3.0.0.3, Culture=neutral, processorArchitecture=MSIL" />
|
<Reference Include="SubSonic.Core, Version=3.0.1.3, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>Libraries\SubSonic.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.configuration" />
|
<Reference Include="System.configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@ -146,13 +153,14 @@
|
|||||||
<Compile Include="Providers\ISeriesProvider.cs" />
|
<Compile Include="Providers\ISeriesProvider.cs" />
|
||||||
<Compile Include="Providers\ITvDbProvider.cs" />
|
<Compile Include="Providers\ITvDbProvider.cs" />
|
||||||
<Compile Include="Providers\SabProvider.cs" />
|
<Compile Include="Providers\SabProvider.cs" />
|
||||||
|
<Compile Include="Repository\Quality\AllowedQuality.cs" />
|
||||||
<Compile Include="Repository\Config.cs" />
|
<Compile Include="Repository\Config.cs" />
|
||||||
<Compile Include="Repository\QualityProfile.cs" />
|
<Compile Include="Repository\Quality\QualityProfile.cs" />
|
||||||
<Compile Include="Repository\Season.cs" />
|
<Compile Include="Repository\Season.cs" />
|
||||||
<Compile Include="Repository\RemoteEpisode.cs" />
|
<Compile Include="Repository\RemoteEpisode.cs" />
|
||||||
<Compile Include="Repository\LocalEpisode.cs" />
|
<Compile Include="Repository\LocalEpisode.cs" />
|
||||||
<Compile Include="Repository\Episode.cs" />
|
<Compile Include="Repository\Episode.cs" />
|
||||||
<Compile Include="Repository\Quality.cs" />
|
<Compile Include="Repository\Quality\QualityTypes.cs" />
|
||||||
<Compile Include="Repository\Series.cs" />
|
<Compile Include="Repository\Series.cs" />
|
||||||
<Compile Include="Main.cs" />
|
<Compile Include="Main.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
@ -186,6 +194,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Libraries\CassiniDev-lib.dll" />
|
<Content Include="Libraries\CassiniDev-lib.dll" />
|
||||||
|
<Content Include="Libraries\Castle.Core.dll" />
|
||||||
<Content Include="Libraries\log4net.dll" />
|
<Content Include="Libraries\log4net.dll" />
|
||||||
<Content Include="Libraries\log4net.xml" />
|
<Content Include="Libraries\log4net.xml" />
|
||||||
<Content Include="Libraries\Ninject.dll" />
|
<Content Include="Libraries\Ninject.dll" />
|
||||||
@ -195,13 +204,9 @@
|
|||||||
<Content Include="Libraries\NLog.dll" />
|
<Content Include="Libraries\NLog.dll" />
|
||||||
<Content Include="Libraries\NLog.pdb" />
|
<Content Include="Libraries\NLog.pdb" />
|
||||||
<Content Include="Libraries\NLog.xml" />
|
<Content Include="Libraries\NLog.xml" />
|
||||||
<Content Include="Libraries\ObjectListView.dll" />
|
|
||||||
<Content Include="Libraries\RSS.NET.dll" />
|
|
||||||
<Content Include="Libraries\RSS.NET.XML" />
|
|
||||||
<Content Include="Libraries\SubSonic.Core.dll" />
|
<Content Include="Libraries\SubSonic.Core.dll" />
|
||||||
<Content Include="Libraries\SubSonic.Core.XML" />
|
<Content Include="Libraries\SubSonic.Core.XML" />
|
||||||
<Content Include="Libraries\System.Data.SQLite.dll" />
|
<Content Include="Libraries\System.Data.SQLite.dll" />
|
||||||
<Content Include="Libraries\System.Data.SQLite.Linq.dll" />
|
|
||||||
<Content Include="Libraries\System.Data.SQLite.XML" />
|
<Content Include="Libraries\System.Data.SQLite.XML" />
|
||||||
<Content Include="Libraries\TvdbLib.dll" />
|
<Content Include="Libraries\TvdbLib.dll" />
|
||||||
<Content Include="Libraries\TvdbLib.pdb" />
|
<Content Include="Libraries\TvdbLib.pdb" />
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
using NzbDrone.Core.Repository.Quality;
|
||||||
using SubSonic.Repository;
|
using SubSonic.Repository;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers
|
namespace NzbDrone.Core.Providers
|
||||||
@ -100,10 +101,10 @@ public static List<Episode> Parse(string title)
|
|||||||
foreach (var ep in result)
|
foreach (var ep in result)
|
||||||
{
|
{
|
||||||
//TODO: Get TVDB episode Title, Series name and the rest of the details
|
//TODO: Get TVDB episode Title, Series name and the rest of the details
|
||||||
ep.Season = Convert.ToInt32(match.Groups["seasonNumber"].Value);
|
ep.SeasonNumber = Convert.ToInt32(match.Groups["seasonNumber"].Value);
|
||||||
ep.Title = ReplaceSeparatorChars(match.Groups["episodeName"].Value);
|
ep.Title = ReplaceSeparatorChars(match.Groups["episodeName"].Value);
|
||||||
ep.Proper = title.Contains("PROPER");
|
ep.Proper = title.Contains("PROPER");
|
||||||
ep.Quality = Quality.Unknown;
|
ep.Quality = QualityTypes.Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -52,7 +52,7 @@ public IQueryable<Series> GetSeries()
|
|||||||
|
|
||||||
public Series GetSeries(long tvdbId)
|
public Series GetSeries(long tvdbId)
|
||||||
{
|
{
|
||||||
return _sonioRepo.Single<Series>(s => s.TvdbId == tvdbId.ToString());
|
return _sonioRepo.Single<Series>(s => s.TvdbId == tvdbId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<Season> GetSeasons(long tvdbId)
|
public IList<Season> GetSeasons(long tvdbId)
|
||||||
@ -79,14 +79,14 @@ public void SyncSeriesWithDisk()
|
|||||||
private void AddShow(string path)
|
private void AddShow(string path)
|
||||||
{
|
{
|
||||||
var searchResults = _tvDb.SearchSeries(new DirectoryInfo(path).Name);
|
var searchResults = _tvDb.SearchSeries(new DirectoryInfo(path).Name);
|
||||||
if (searchResults.Count != 0 && !_sonioRepo.Exists<Series>(s => s.TvdbId == searchResults[0].Id.ToString()))
|
if (searchResults.Count != 0 && !_sonioRepo.Exists<Series>(s => s.TvdbId == searchResults[0].Id))
|
||||||
AddShow(path, _tvDb.GetSeries(searchResults[0].Id, searchResults[0].Language));
|
AddShow(path, _tvDb.GetSeries(searchResults[0].Id, searchResults[0].Language));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddShow(string path, TvdbSeries series)
|
private void AddShow(string path, TvdbSeries series)
|
||||||
{
|
{
|
||||||
var repoSeries = new Series();
|
var repoSeries = new Series();
|
||||||
repoSeries.TvdbId = series.Id.ToString();
|
repoSeries.TvdbId = series.Id;
|
||||||
repoSeries.SeriesName = series.SeriesName;
|
repoSeries.SeriesName = series.SeriesName;
|
||||||
repoSeries.AirTimes = series.AirsTime;
|
repoSeries.AirTimes = series.AirsTime;
|
||||||
repoSeries.AirsDayOfWeek = series.AirsDayOfWeek;
|
repoSeries.AirsDayOfWeek = series.AirsDayOfWeek;
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ServiceModel.Syndication;
|
using NzbDrone.Core.Repository.Quality;
|
||||||
using SubSonic.SqlGeneration.Schema;
|
using SubSonic.SqlGeneration.Schema;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Repository
|
namespace NzbDrone.Core.Repository
|
||||||
{
|
{
|
||||||
public class Episode
|
public class Episode
|
||||||
{
|
{
|
||||||
[SubSonicPrimaryKey]
|
[SubSonicPrimaryKey(false)]
|
||||||
public string EpisodeId { get; set; }
|
public long EpisodeId { get; set; }
|
||||||
|
|
||||||
public long SeriesId { get; set; }
|
public long SeriesId { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public long Season { get; set; }
|
public long SeasonId { get; set; }
|
||||||
|
public int SeasonNumber { get; set; }
|
||||||
public int EpisodeNumber { get; set; }
|
public int EpisodeNumber { get; set; }
|
||||||
public DateTime AirDate { get; set; }
|
public DateTime AirDate { get; set; }
|
||||||
public Quality Quality { get; set; }
|
public QualityTypes Quality { get; set; }
|
||||||
public bool Proper { get; set; }
|
public bool Proper { get; set; }
|
||||||
|
|
||||||
|
[SubSonicToOneRelation(ThisClassContainsJoinKey = true)]
|
||||||
|
public virtual Season Season { get; private set; }
|
||||||
|
|
||||||
|
[SubSonicToOneRelation(ThisClassContainsJoinKey = true)]
|
||||||
|
public virtual Series Series { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
9
NzbDrone.Core/Repository/Quality/AllowedQuality.cs
Normal file
9
NzbDrone.Core/Repository/Quality/AllowedQuality.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace NzbDrone.Core.Repository.Quality
|
||||||
|
{
|
||||||
|
public class AllowedQuality
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int ProfileId { get; set; }
|
||||||
|
public QualityTypes Quality { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using SubSonic.SqlGeneration.Schema;
|
using SubSonic.SqlGeneration.Schema;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Repository
|
namespace NzbDrone.Core.Repository.Quality
|
||||||
{
|
{
|
||||||
public class QualityProfile
|
public class QualityProfile
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public Quality Cutoff { get; set; }
|
public QualityTypes Cutoff { get; set; }
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
public string SonicAllowed
|
public string SonicAllowed
|
||||||
@ -27,15 +25,15 @@ public string SonicAllowed
|
|||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
var qualities = value.Split('|');
|
var qualities = value.Split('|');
|
||||||
Allowed = new List<Quality>(qualities.Length);
|
Allowed = new List<QualityTypes>(qualities.Length);
|
||||||
foreach (var quality in qualities)
|
foreach (var quality in qualities)
|
||||||
{
|
{
|
||||||
Allowed.Add((Quality)Convert.ToInt32(quality));
|
Allowed.Add((QualityTypes)Convert.ToInt32(quality));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SubSonicIgnore]
|
[SubSonicIgnore]
|
||||||
public List<Quality> Allowed { get; set; }
|
public List<QualityTypes> Allowed { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,10 @@
|
|||||||
namespace NzbDrone.Core.Repository
|
namespace NzbDrone.Core.Repository.Quality
|
||||||
{
|
{
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents Video Quality
|
/// Represents Video Quality
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum Quality
|
public enum QualityTypes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Quality is unknown
|
/// Quality is unknown
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using SubSonic.SqlGeneration.Schema;
|
using SubSonic.SqlGeneration.Schema;
|
||||||
|
|
||||||
@ -6,11 +7,17 @@ namespace NzbDrone.Core.Repository
|
|||||||
{
|
{
|
||||||
public class Season
|
public class Season
|
||||||
{
|
{
|
||||||
[SubSonicPrimaryKey]
|
[SubSonicPrimaryKey(false)]
|
||||||
public string SeasonId { get; set; }
|
public long SeasonId { get; set; }
|
||||||
public long SeriesId { get; set; }
|
public long SeriesId { get; set; }
|
||||||
public int SeasonNumber { get; set; }
|
public int SeasonNumber { get; set; }
|
||||||
public bool Monitored { get; set; }
|
public bool Monitored { get; set; }
|
||||||
public string Folder { get; set; }
|
public string Folder { get; set; }
|
||||||
|
|
||||||
|
[SubSonicToManyRelation]
|
||||||
|
public virtual List<Episode> Episodes { get; set; }
|
||||||
|
|
||||||
|
[SubSonicToOneRelation(ThisClassContainsJoinKey = true)]
|
||||||
|
public virtual Series Series { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,12 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using SubSonic.SqlGeneration.Schema;
|
using SubSonic.SqlGeneration.Schema;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Repository
|
namespace NzbDrone.Core.Repository
|
||||||
{
|
{
|
||||||
public class Series
|
public class Series
|
||||||
{
|
{
|
||||||
[SubSonicPrimaryKey]
|
[SubSonicPrimaryKey(false)]
|
||||||
public string TvdbId { get; set; }
|
public int TvdbId { get; set; }
|
||||||
|
|
||||||
public string SeriesName { get; set; }
|
public string SeriesName { get; set; }
|
||||||
|
|
||||||
@ -22,5 +23,11 @@ public class Series
|
|||||||
public string Language { get; set; }
|
public string Language { get; set; }
|
||||||
|
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
|
[SubSonicToManyRelation]
|
||||||
|
public virtual List<Season> Seasons { get; private set; }
|
||||||
|
|
||||||
|
[SubSonicToManyRelation]
|
||||||
|
public virtual List<Episode> Episodes { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user