Merge branch 'master' into searching

This commit is contained in:
Mark McDowall 2012-11-21 08:16:22 -08:00
commit d073a0b2fb
15 changed files with 45 additions and 13 deletions

View File

@ -596,7 +596,6 @@ namespace NzbDrone.Core.Test
WithConfiguredIndexers();
const string fileName = "wombles.xml";
const string expectedString = "nzbdetails";
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
@ -635,7 +634,6 @@ namespace NzbDrone.Core.Test
{
WithConfiguredIndexers();
const string fileName = "nzbindex.xml";
const string expectedString = "release";
Mocker.GetMock<HttpProvider>()

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
@ -67,6 +68,15 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
ExceptionVerification.ExpectedWarns(1);
}
[Test]
public void should_replace_illegal_characters_in_title()
{
var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]";
var expectedFilename = Path.Combine(blackHoleFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb");
Mocker.Resolve<BlackholeProvider>().DownloadNzb(nzbUrl, illegalTitle).Should().BeTrue();
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
}
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
@ -75,5 +76,16 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests
{
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, "30 Rock - Season 1").Should().BeFalse();
}
[Test]
public void should_replace_illegal_characters_in_title()
{
var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]";
var expectedFilename = Path.Combine(pneumaticFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb");
Mocker.Resolve<PneumaticProvider>().DownloadNzb(nzbUrl, illegalTitle).Should().BeTrue();
Mocker.GetMock<HttpProvider>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
}
}
}

View File

@ -220,8 +220,7 @@ namespace NzbDrone.Core
}
parsedEpisode = new EpisodeParseResult
{
{
AirDate = new DateTime(airyear, airmonth, airday).Date,
};
}

View File

@ -206,6 +206,7 @@ namespace NzbDrone.Core.Providers
catch (UnauthorizedAccessException ex)
{
Logger.Debug("Unable to apply folder permissions to: ", newFile.FullName);
Logger.TraceException(ex.Message, ex);
}
episodeFile.Path = newFile.FullName;

View File

@ -38,6 +38,8 @@ namespace NzbDrone.Core.Providers.DownloadClients
{
try
{
title = MediaFileProvider.CleanFilename(title);
var filename = Path.Combine(_configProvider.BlackholeDirectory, title + ".nzb");
if (_diskProvider.FileExists(filename))
@ -64,7 +66,5 @@ namespace NzbDrone.Core.Providers.DownloadClients
{
return !_upgradeHistorySpecification.IsSatisfiedBy(newParseResult);
}
}
}

View File

@ -44,6 +44,8 @@ namespace NzbDrone.Core.Providers.DownloadClients
return false;
}
title = MediaFileProvider.CleanFilename(title);
//Save to the Pneumatic directory (The user will need to ensure its accessible by XBMC)
var filename = Path.Combine(_configProvider.PneumaticDirectory, title + ".nzb");

View File

@ -140,6 +140,7 @@ namespace NzbDrone.Core.Providers
catch (Exception ex)
{
Logger.Error("Invalid address {0}, please correct the site URL.", url);
Logger.TraceException(ex.Message, ex);
throw;
}

View File

@ -28,11 +28,10 @@ namespace NzbDrone.Core.Providers
EpisodeStatus = episodeStatus.ToString(),
Quality = (quality == null ? String.Empty : quality.Quality.ToString())
});
var test = 0;
}
catch (Exception ex)
{
logger.Trace("Error");
logger.TraceException("Error", ex);
throw;
}
}

View File

@ -61,6 +61,7 @@ namespace NzbDrone.Core.Providers
catch(Exception ex)
{
Logger.Error("Error sending email. Subject: {0}", email.Subject);
Logger.TraceException(ex.Message, ex);
}
}

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NLog;
using NzbDrone.Services.Service.Repository;
using Services.PetaPoco;
@ -11,6 +12,8 @@ namespace NzbDrone.Services.Service.Providers
{
private readonly IDatabase _database;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public SceneMappingProvider(IDatabase database)
{
_database = database;
@ -74,6 +77,7 @@ namespace NzbDrone.Services.Service.Providers
}
catch (Exception ex)
{
logger.WarnException("Unable to promote scene mapping", ex);
return false;
}
@ -93,6 +97,7 @@ namespace NzbDrone.Services.Service.Providers
}
catch (Exception ex)
{
logger.WarnException("Unable to promote all scene mappings", ex);
return false;
}

View File

@ -80,11 +80,11 @@
<Name>NzbDrone.Common</Name>
</ProjectReference>
<ProjectReference Include="..\NzbDrone.Test.Common\NzbDrone.Test.Common.csproj">
<Project>{CADDFCE0-7509-4430-8364-2074E1EEFCA2}</Project>
<Project>{caddfce0-7509-4430-8364-2074e1eefca2}</Project>
<Name>NzbDrone.Test.Common</Name>
</ProjectReference>
<ProjectReference Include="..\NzbDrone.Update\NzbDrone.Update.csproj">
<Project>{4CCC53CD-8D5E-4CC4-97D2-5C9312AC2BD7}</Project>
<Project>{4ccc53cd-8d5e-4cc4-97d2-5c9312ac2bd7}</Project>
<Name>NzbDrone.Update</Name>
</ProjectReference>
</ItemGroup>

View File

@ -1,4 +1,5 @@
using System.Web.Mvc;
using NLog;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.DownloadClients;
@ -21,6 +22,8 @@ namespace NzbDrone.Web.Controllers
private readonly XbmcProvider _xbmcProvider;
private readonly PlexProvider _plexProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public CommandController(JobProvider jobProvider, SabProvider sabProvider,
SmtpProvider smtpProvider, TwitterProvider twitterProvider,
EpisodeProvider episodeProvider, GrowlProvider growlProvider,
@ -133,6 +136,7 @@ namespace NzbDrone.Web.Controllers
}
catch(Exception ex)
{
logger.TraceException(ex.Message, ex);
return JsonNotificationResult.Oops("Couldn't register and test Growl");
}
}

View File

@ -53,7 +53,7 @@ namespace NzbDrone.Web.Controllers
Success = s.Success,
SearchError = s.SearchError.AddSpacesToEnum().Replace("None", "Grabbed"),
Quality = s.Quality.ToString(),
QualityInt = (int)s.Quality,
QualityInt = s.Quality.Weight,
Proper = s.Proper,
Age = s.Age,
Size = s.Size.ToBestFileSize(1),
@ -68,7 +68,7 @@ namespace NzbDrone.Web.Controllers
{
_searchHistoryProvider.ForceDownload(id);
return new JsonResult { Data = "ok", JsonRequestBehavior = JsonRequestBehavior.AllowGet };
return JsonNotificationResult.Info("Success", "Requested episode has been sent to download client");
}
public string GetDisplayName(SearchHistory searchResult)

View File

@ -38,7 +38,7 @@
function actionColumn(source, type, val) {
if (type === 'display' || type === 'filter') {
return '<a href="/SearchHistory/ForceDownload/' + source["Id"] + '" data-ajax="true" data-ajax-confirm="Are you sure?"><i class="icon-plus gridAction"></i></a>';
return '<a href="/SearchHistory/ForceDownload?id=' + source["Id"] + '" data-ajax="true" data-ajax-confirm="Are you sure?"><i class="icon-plus gridAction"></i></a>';
}
// 'sort' and 'type' both just use the raw data
return '';