mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-25 01:02:05 +00:00
Rmeove illegal characters
Fixed: Remove illegal characters when saving blackhole and pneumatic downloads
This commit is contained in:
parent
c9056998cf
commit
97fa0ef0d3
4 changed files with 26 additions and 2 deletions
|
@ -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 @@ public void should_return_false_on_failed_download()
|
|||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 @@ public void should_skip_if_full_season_download()
|
|||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ public virtual bool DownloadNzb(string url, string title)
|
|||
{
|
||||
try
|
||||
{
|
||||
title = MediaFileProvider.CleanFilename(title);
|
||||
|
||||
var filename = Path.Combine(_configProvider.BlackholeDirectory, title + ".nzb");
|
||||
|
||||
if (_diskProvider.FileExists(filename))
|
||||
|
@ -64,7 +66,5 @@ public virtual bool IsInQueue(EpisodeParseResult newParseResult)
|
|||
{
|
||||
return !_upgradeHistorySpecification.IsSatisfiedBy(newParseResult);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ public virtual bool DownloadNzb(string url, string title)
|
|||
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");
|
||||
|
||||
|
|
Loading…
Reference in a new issue