Merge branch 'master' of git://github.com/kayone/NzbDrone

pull/4/head
Mark McDowall 13 years ago
commit a0081ccb0b

@ -145,7 +145,7 @@
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" /> <virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:8980:" /> <binding protocol="http" bindingInformation="*:8989:" />
</bindings> </bindings>
</site> </site>
<applicationDefaults applicationPool="IISExpressAppPool" /> <applicationDefaults applicationPool="IISExpressAppPool" />

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Test
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
public class IndexerTests : TestBase public class IndexerTests : TestBase
{ {
[TestCase("nzbsorg.xml", 0)] [TestCase("nzbsorg.xml", 0)]
[TestCase("nzbsrus.xml", 6)] [TestCase("nzbsrus.xml", 6)]
[TestCase("newzbin.xml", 1)] [TestCase("newzbin.xml", 1)]
@ -60,16 +60,20 @@ namespace NzbDrone.Core.Test
public void newzbin_rss_fetch() public void newzbin_rss_fetch()
{ {
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
mocker.Resolve<HttpProvider>();
mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\newzbin.xml"));
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build(); var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
mocker.GetMock<IndexerProvider>() mocker.GetMock<IndexerProvider>()
.Setup(c => c.GetSettings(It.IsAny<Type>())) .Setup(c => c.GetSettings(It.IsAny<Type>()))
.Returns(fakeSettings); .Returns(fakeSettings);
mocker.GetMock<ConfigProvider>()
.SetupGet(c => c.NewzbinUsername)
.Returns("nzbdrone");
mocker.GetMock<ConfigProvider>()
.SetupGet(c => c.NewzbinPassword)
.Returns("smartar39865");
var newzbinProvider = mocker.Resolve<Newzbin>(); var newzbinProvider = mocker.Resolve<Newzbin>();
var parseResults = newzbinProvider.FetchRss(); var parseResults = newzbinProvider.FetchRss();
@ -84,11 +88,10 @@ namespace NzbDrone.Core.Test
parseResults.Should().OnlyContain(s => s.Indexer == newzbinProvider.Name); parseResults.Should().OnlyContain(s => s.Indexer == newzbinProvider.Name);
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle)); parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
ExceptionVerification.IgnoreWarns();
ExceptionVerification.ExcpectedWarns(1);
} }
[TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)] [TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)]
public void custome_parser_partial_success(string title, int season, int episode, QualityTypes quality) public void custome_parser_partial_success(string title, int season, int episode, QualityTypes quality)
{ {
@ -179,8 +182,8 @@ namespace NzbDrone.Core.Test
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23)); result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
} }
[TestCase("simpsons",21,23)] [TestCase("simpsons", 21, 23)]
[TestCase("Hawaii Five-0", 1, 5)] [TestCase("Hawaii Five-0 2010", 1, 5)]
public void newzbin_search_returns_valid_results(string title, int season, int episode) public void newzbin_search_returns_valid_results(string title, int season, int episode)
{ {
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
@ -198,7 +201,7 @@ namespace NzbDrone.Core.Test
var result = mocker.Resolve<Newzbin>().FetchEpisode(title, season, episode); var result = mocker.Resolve<Newzbin>().FetchEpisode(title, season, episode);
result.Should().NotBeEmpty(); result.Should().NotBeEmpty();
result.Should().OnlyContain(r => r.CleanTitle == title); result.Should().OnlyContain(r => r.CleanTitle == Parser.NormalizeTitle(title));
result.Should().OnlyContain(r => r.SeasonNumber == season); result.Should().OnlyContain(r => r.SeasonNumber == season);
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode)); result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode));
} }

@ -60,26 +60,6 @@ namespace NzbDrone.Core.Test
} }
[TestCase("D:\\TV Shows\\")]
[TestCase("//server//folder")]
public void UpdateRootDir(string newPath)
{
//Setup
var mocker = new AutoMoqer();
mocker.SetConstant(MockLib.GetEmptyDatabase());
//Act
var rootDirProvider = mocker.Resolve<RootDirProvider>();
rootDirProvider.Add(new RootDir { Path = @"C:\TV" });
rootDirProvider.Update(new RootDir { Id = 1, Path = newPath });
//Assert
var rootDirs = rootDirProvider.GetAll();
rootDirs.Should().HaveCount(1);
newPath.Should().Be(rootDirs.First().Path);
}
[Test] [Test]
public void RemoveRootDir() public void RemoveRootDir()
{ {
@ -152,14 +132,5 @@ namespace NzbDrone.Core.Test
mocker.Resolve<RootDirProvider>().Add(new RootDir { Id = 0, Path = path }); mocker.Resolve<RootDirProvider>().Add(new RootDir { Id = 0, Path = path });
} }
[TestCase("")]
[TestCase(null)]
[TestCase("BAD PATH")]
[ExpectedException(typeof(ArgumentException))]
public void invalid_folder_path_throws_on_update(string path)
{
var mocker = new AutoMoqer();
mocker.Resolve<RootDirProvider>().Update(new RootDir { Id = 2, Path = path });
}
} }
} }

@ -10,8 +10,6 @@ using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using PetaPoco;
using TvdbLib.Data;
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
namespace NzbDrone.Core.Test namespace NzbDrone.Core.Test

@ -85,16 +85,17 @@ namespace NzbDrone.Core.Test
} }
//assert //assert
seasonsNumbers.Should().HaveCount(8); seasonsNumbers.Should().HaveCount(7);
seasons[1].Should().HaveCount(23); seasons[1].Should().HaveCount(23);
seasons[2].Should().HaveCount(19); seasons[2].Should().HaveCount(19);
seasons[3].Should().HaveCount(16); seasons[3].Should().HaveCount(16);
seasons[4].Should().HaveCount(20); seasons[4].Should().HaveCount(20);
seasons[5].Should().HaveCount(18); seasons[5].Should().HaveCount(18);
seasons[6].Should().HaveCount(19);
foreach (var season in seasons) foreach (var season in seasons)
{ {
season.Value.Should().OnlyHaveUniqueItems(); season.Value.Should().OnlyHaveUniqueItems("Season {0}", season.Key);
} }
//Make sure no episode number is skipped //Make sure no episode number is skipped

@ -1,17 +1,18 @@
using System; using System;
using System.Reflection;
using PetaPoco; using PetaPoco;
namespace NzbDrone.Core.Datastore namespace NzbDrone.Core.Datastore
{ {
public class CustomeMapper : DefaultMapper public class CustomeMapper : DefaultMapper
{ {
public override Func<object, object> GetFromDbConverter(DestinationInfo destinationInfo, Type sourceType) public override Func<object, object> GetFromDbConverter(Type destinationType, Type sourceType)
{ {
if ((sourceType == typeof(Int32) || sourceType == typeof(Int64)) && destinationInfo.Type.IsGenericType && destinationInfo.Type.GetGenericTypeDefinition() == typeof(Nullable<>)) if ((sourceType == typeof(Int32) || sourceType == typeof(Int64)) && destinationType.IsGenericType && destinationType.GetGenericTypeDefinition() == typeof(Nullable<>))
{ {
// If it is NULLABLE, then get the underlying type. eg if "Nullable<int>" then this will return just "int" // If it is NULLABLE, then get the underlying type. eg if "Nullable<int>" then this will return just "int"
Type genericArgument = destinationInfo.Type.GetGenericArguments()[0]; Type genericArgument = destinationType.GetGenericArguments()[0];
if (genericArgument == typeof(DayOfWeek)) if (genericArgument == typeof(DayOfWeek))
{ {
return delegate(object s) return delegate(object s)
@ -30,7 +31,14 @@ namespace NzbDrone.Core.Datastore
}; };
} }
return base.GetFromDbConverter(destinationInfo, sourceType); return base.GetFromDbConverter(destinationType, sourceType);
}
public override Func<object, object> GetFromDbConverter(PropertyInfo propertyInfo, Type sourceType)
{
return GetFromDbConverter(propertyInfo.PropertyType, sourceType);
} }
} }
} }

File diff suppressed because it is too large Load Diff

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Model.Notification
/// Gets or sets the title for this notification. /// Gets or sets the title for this notification.
/// </summary> /// </summary>
/// <value>The title.</value> /// <value>The title.</value>
public String Title { get; set; } public String Title { get; private set; }
/// <summary> /// <summary>
/// Gets or sets the current status of this task. this field could be use to show the currently processing item in a long running task. /// Gets or sets the current status of this task. this field could be use to show the currently processing item in a long running task.

@ -13,7 +13,7 @@ namespace NzbDrone.Core.Providers
public class DiskScanProvider public class DiskScanProvider
{ {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private static readonly string[] MediaExtentions = new[] { ".mkv", ".avi", ".wmv", ".mp4" }; private static readonly string[] MediaExtentions = new[] { ".mkv", ".avi", ".wmv", ".mp4", ".mpg", ".mpeg", ".xvid", ".flv", ".mov", ".vob", ".ts", ".rm", ".rmvb", ".xvid", ".dvr-ms" };
private readonly DiskProvider _diskProvider; private readonly DiskProvider _diskProvider;
private readonly EpisodeProvider _episodeProvider; private readonly EpisodeProvider _episodeProvider;
private readonly MediaFileProvider _mediaFileProvider; private readonly MediaFileProvider _mediaFileProvider;

@ -10,19 +10,21 @@ namespace NzbDrone.Core.Providers.Indexer
{ {
public class Newzbin : IndexerBase public class Newzbin : IndexerBase
{ {
[Inject] [Inject]
public Newzbin(HttpProvider httpProvider, ConfigProvider configProvider) public Newzbin(HttpProvider httpProvider, ConfigProvider configProvider)
: base(httpProvider, configProvider) : base(httpProvider, configProvider)
{ {
} }
private const string UrlParams = "feed=rss&hauth=1&ps_rb_language=4096";
protected override string[] Urls protected override string[] Urls
{ {
get get
{ {
return new[] return new[]
{ {
"http://www.newzbin.com/browse/category/p/tv?feed=rss&hauth=1" "http://www.newzbin.com/browse/category/p/tv?" + UrlParams
}; };
} }
} }
@ -38,7 +40,7 @@ namespace NzbDrone.Core.Providers.Indexer
protected override IList<string> GetSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber) protected override IList<string> GetSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{ {
return new List<string> { String.Format(@"http://www.newzbin.com/search/query/?q={0}+{1}x{2:00}&fpn=p&searchaction=Go&category=8&feed=rss&hauth=1", GetQueryTitle(seriesTitle), seasonNumber, episodeNumber) }; return new List<string> { String.Format(@"http://www.newzbin.com/search/query/?q={0}+{1}x{2:00}&fpn=p&searchaction=Go&category=8&{3}", GetQueryTitle(seriesTitle), seasonNumber, episodeNumber, UrlParams) };
} }
public override string Name public override string Name

@ -51,6 +51,8 @@ namespace NzbDrone.Core.Providers.Jobs
Logger.Error("Unable to find an episode {0} in database", targetId); Logger.Error("Unable to find an episode {0} in database", targetId);
return; return;
} }
notification.CurrentMessage = "Searching for " + episode;
var series = episode.Series; var series = episode.Series;

@ -20,32 +20,44 @@ namespace NzbDrone.Core.Providers
get { return new List<BasicNotification>(_basicNotifications.Values); } get { return new List<BasicNotification>(_basicNotifications.Values); }
} }
public virtual List<ProgressNotification> GetProgressNotifications public virtual List<ProgressNotification> ProgressNotifications
{ {
get get
{ {
lock (_lock)
{
var activeNotification =
_progressNotification.Values.Where(p => p.Status == ProgressNotificationStatus.InProgress).
ToList();
var activeNotification = _progressNotification.Values.Where(p => p.Status == ProgressNotificationStatus.InProgress).ToList(); if (activeNotification.Count == 0)
{
//Get notifications that were recently done
activeNotification =
_progressNotification.Values.Where(p => p.CompletedTime >= DateTime.Now.AddSeconds(-3)).
OrderByDescending(c => c.CompletedTime).ToList();
if (activeNotification.Count == 0) }
{
//Get notifications that were recently done
activeNotification = _progressNotification.Values.Where(p => p.CompletedTime >= DateTime.Now.AddSeconds(-3)).OrderByDescending(c => c.CompletedTime).ToList();
return activeNotification.ToList();
} }
return activeNotification.ToList();
} }
} }
public virtual void Register(ProgressNotification notification) public virtual void Register(ProgressNotification notification)
{ {
_progressNotification.Add(notification.Id, notification); lock (_lock)
{
_progressNotification.Add(notification.Id, notification);
}
} }
public virtual void Register(BasicNotification notification) public virtual void Register(BasicNotification notification)
{ {
_basicNotifications.Add(notification.Id, notification); lock (_lock)
{
_basicNotifications.Add(notification.Id, notification);
}
} }
public virtual void Dismiss(Guid notificationId) public virtual void Dismiss(Guid notificationId)

@ -42,13 +42,6 @@ namespace NzbDrone.Core.Providers
_database.Delete<RootDir>(rootDirId); _database.Delete<RootDir>(rootDirId);
} }
public virtual void Update(RootDir rootDir)
{
ValidatePath(rootDir);
_database.Update(rootDir);
}
private static void ValidatePath(RootDir rootDir) private static void ValidatePath(RootDir rootDir)
{ {
if (String.IsNullOrWhiteSpace(rootDir.Path) || !Path.IsPathRooted(rootDir.Path)) if (String.IsNullOrWhiteSpace(rootDir.Path) || !Path.IsPathRooted(rootDir.Path))

@ -14,9 +14,6 @@ namespace NzbDrone.Core.Providers
private const string TVDB_APIKEY = "5D2D188E86E07F4F"; private const string TVDB_APIKEY = "5D2D188E86E07F4F";
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private static readonly Regex CleanUpRegex = new Regex(@"((\s|^)the(\s|$))|((\s|^)and(\s|$))|[^a-z]",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private readonly TvdbHandler _handler; private readonly TvdbHandler _handler;
public TvDbProvider() public TvDbProvider()
@ -48,6 +45,8 @@ namespace NzbDrone.Core.Providers
//Fix American Dad's scene gongshow //Fix American Dad's scene gongshow
if (result != null && result.Id == 73141) if (result != null && result.Id == 73141)
{ {
result.Episodes = result.Episodes.Where(e => e.SeasonNumber == 0 || e.EpisodeNumber > 0).ToList();
var seasonOneEpisodeCount = result.Episodes.Where(e => e.SeasonNumber == 1).Count(); var seasonOneEpisodeCount = result.Episodes.Where(e => e.SeasonNumber == 1).Count();
var seasonOneId = result.Episodes.Where(e => e.SeasonNumber == 1).First().SeasonId; var seasonOneId = result.Episodes.Where(e => e.SeasonNumber == 1).First().SeasonId;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 B

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save