New: Release Group can now be used in rename patterns
This commit is contained in:
parent
c1212f6940
commit
533bf5a893
|
@ -7,19 +7,6 @@ namespace NzbDrone.Core.Test.IndexerTests
|
||||||
{
|
{
|
||||||
public class BasicRssParserFixture : CoreTest<RssParserBase>
|
public class BasicRssParserFixture : CoreTest<RssParserBase>
|
||||||
{
|
{
|
||||||
|
|
||||||
[TestCase("Castle.2009.S01E14.English.HDTV.XviD-LOL", "LOL")]
|
|
||||||
[TestCase("Castle 2009 S01E14 English HDTV XviD LOL", "LOL")]
|
|
||||||
[TestCase("Acropolis Now S05 EXTRAS DVDRip XviD RUNNER", "RUNNER")]
|
|
||||||
[TestCase("Punky.Brewster.S01.EXTRAS.DVDRip.XviD-RUNNER", "RUNNER")]
|
|
||||||
[TestCase("2020.NZ.2011.12.02.PDTV.XviD-C4TV", "C4TV")]
|
|
||||||
[TestCase("The.Office.S03E115.DVDRip.XviD-OSiTV", "OSiTV")]
|
|
||||||
public void parse_releaseGroup(string title, string expected)
|
|
||||||
{
|
|
||||||
RssParserBase.ParseReleaseGroup(title).Should().Be(expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[TestCase("5.64 GB", 6055903887)]
|
[TestCase("5.64 GB", 6055903887)]
|
||||||
[TestCase("5.54 GiB", 5948529705)]
|
[TestCase("5.54 GiB", 5948529705)]
|
||||||
[TestCase("398.62 MiB", 417983365)]
|
[TestCase("398.62 MiB", 417983365)]
|
||||||
|
|
|
@ -47,7 +47,11 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||||
Series = series,
|
Series = series,
|
||||||
Episodes = new List<Episode> {episode},
|
Episodes = new List<Episode> {episode},
|
||||||
Path = @"C:\Test\TV\30 Rock\30 Rock - S01E01 - Pilot.avi".AsOsAgnostic(),
|
Path = @"C:\Test\TV\30 Rock\30 Rock - S01E01 - Pilot.avi".AsOsAgnostic(),
|
||||||
Quality = new QualityModel(Quality.Bluray720p)
|
Quality = new QualityModel(Quality.Bluray720p),
|
||||||
|
ParsedEpisodeInfo = new ParsedEpisodeInfo
|
||||||
|
{
|
||||||
|
ReleaseGroup = "DRONE"
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
.With(e => e.EpisodeNumber = 7)
|
.With(e => e.EpisodeNumber = 7)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) };
|
_episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p), ReleaseGroup = "DRONE" };
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenProper()
|
private void GivenProper()
|
||||||
|
@ -344,5 +344,14 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
||||||
.Should().Be(title);
|
.Should().Be(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_should_replace_release_group()
|
||||||
|
{
|
||||||
|
_namingConfig.StandardEpisodeFormat = "{Release Group}";
|
||||||
|
|
||||||
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
||||||
|
.Should().Be(_episodeFile.ReleaseGroup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -452,5 +452,19 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||||
Parser.Parser.ParseTitle(title).Should().BeNull();
|
Parser.Parser.ParseTitle(title).Should().BeNull();
|
||||||
ExceptionVerification.IgnoreWarns();
|
ExceptionVerification.IgnoreWarns();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("Castle.2009.S01E14.English.HDTV.XviD-LOL", "LOL")]
|
||||||
|
[TestCase("Castle 2009 S01E14 English HDTV XviD LOL", "LOL")]
|
||||||
|
[TestCase("Acropolis Now S05 EXTRAS DVDRip XviD RUNNER", "RUNNER")]
|
||||||
|
[TestCase("Punky.Brewster.S01.EXTRAS.DVDRip.XviD-RUNNER", "RUNNER")]
|
||||||
|
[TestCase("2020.NZ.2011.12.02.PDTV.XviD-C4TV", "C4TV")]
|
||||||
|
[TestCase("The.Office.S03E115.DVDRip.XviD-OSiTV", "OSiTV")]
|
||||||
|
[TestCase("The Office - S01E01 - Pilot [HTDV-480p]", "DRONE")]
|
||||||
|
[TestCase("The Office - S01E01 - Pilot [HTDV-720p]", "DRONE")]
|
||||||
|
[TestCase("The Office - S01E01 - Pilot [HTDV-1080p]", "DRONE")]
|
||||||
|
public void parse_releaseGroup(string title, string expected)
|
||||||
|
{
|
||||||
|
Parser.Parser.ParseReleaseGroup(title).Should().Be(expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(32)]
|
||||||
|
public class set_default_release_group : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Execute.Sql("UPDATE EpisodeFiles SET ReleaseGroup = 'DRONE' WHERE ReleaseGroup IS NULL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -101,7 +101,7 @@ namespace NzbDrone.Core.History
|
||||||
|
|
||||||
history.Data.Add("Indexer", message.Episode.Release.Indexer);
|
history.Data.Add("Indexer", message.Episode.Release.Indexer);
|
||||||
history.Data.Add("NzbInfoUrl", message.Episode.Release.InfoUrl);
|
history.Data.Add("NzbInfoUrl", message.Episode.Release.InfoUrl);
|
||||||
history.Data.Add("ReleaseGroup", message.Episode.Release.ReleaseGroup);
|
history.Data.Add("ReleaseGroup", message.Episode.ParsedEpisodeInfo.ReleaseGroup);
|
||||||
history.Data.Add("Age", message.Episode.Release.Age.ToString());
|
history.Data.Add("Age", message.Episode.Release.Age.ToString());
|
||||||
|
|
||||||
if (!String.IsNullOrWhiteSpace(message.DownloadClientId))
|
if (!String.IsNullOrWhiteSpace(message.DownloadClientId))
|
||||||
|
|
|
@ -70,7 +70,6 @@ namespace NzbDrone.Core.Indexers
|
||||||
|
|
||||||
reportInfo.Title = title;
|
reportInfo.Title = title;
|
||||||
reportInfo.PublishDate = item.PublishDate();
|
reportInfo.PublishDate = item.PublishDate();
|
||||||
reportInfo.ReleaseGroup = ParseReleaseGroup(title);
|
|
||||||
reportInfo.DownloadUrl = GetNzbUrl(item);
|
reportInfo.DownloadUrl = GetNzbUrl(item);
|
||||||
reportInfo.InfoUrl = GetNzbInfoUrl(item);
|
reportInfo.InfoUrl = GetNzbInfoUrl(item);
|
||||||
|
|
||||||
|
@ -114,25 +113,6 @@ namespace NzbDrone.Core.Indexers
|
||||||
return currentResult;
|
return currentResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ParseReleaseGroup(string title)
|
|
||||||
{
|
|
||||||
title = title.Trim();
|
|
||||||
var index = title.LastIndexOf('-');
|
|
||||||
|
|
||||||
if (index < 0)
|
|
||||||
index = title.LastIndexOf(' ');
|
|
||||||
|
|
||||||
if (index < 0)
|
|
||||||
return String.Empty;
|
|
||||||
|
|
||||||
var group = title.Substring(index + 1);
|
|
||||||
|
|
||||||
if (@group.Length == title.Length)
|
|
||||||
return String.Empty;
|
|
||||||
|
|
||||||
return @group.Trim('-', ' ', '[', ']');
|
|
||||||
}
|
|
||||||
|
|
||||||
private static readonly Regex ReportSizeRegex = new Regex(@"(?<value>\d+\.\d{1,2}|\d+\,\d+\.\d{1,2}|\d+)\W?(?<unit>GB|MB|GiB|MiB)",
|
private static readonly Regex ReportSizeRegex = new Regex(@"(?<value>\d+\.\d{1,2}|\d+\,\d+\.\d{1,2}|\d+)\W?(?<unit>GB|MB|GiB|MiB)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
public long Size { get; set; }
|
public long Size { get; set; }
|
||||||
public DateTime DateAdded { get; set; }
|
public DateTime DateAdded { get; set; }
|
||||||
public string SceneName { get; set; }
|
public string SceneName { get; set; }
|
||||||
|
public string ReleaseGroup { get; set; }
|
||||||
public QualityModel Quality { get; set; }
|
public QualityModel Quality { get; set; }
|
||||||
public LazyList<Episode> Episodes { get; set; }
|
public LazyList<Episode> Episodes { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||||
episodeFile.Quality = localEpisode.Quality;
|
episodeFile.Quality = localEpisode.Quality;
|
||||||
episodeFile.SeasonNumber = localEpisode.SeasonNumber;
|
episodeFile.SeasonNumber = localEpisode.SeasonNumber;
|
||||||
episodeFile.Episodes = localEpisode.Episodes;
|
episodeFile.Episodes = localEpisode.Episodes;
|
||||||
|
episodeFile.ReleaseGroup = localEpisode.ParsedEpisodeInfo.ReleaseGroup;
|
||||||
|
|
||||||
if (newDownload)
|
if (newDownload)
|
||||||
{
|
{
|
||||||
|
|
|
@ -187,6 +187,7 @@
|
||||||
<Compile Include="Datastore\Migration\029_add_formats_to_naming_config.cs" />
|
<Compile Include="Datastore\Migration\029_add_formats_to_naming_config.cs" />
|
||||||
<Compile Include="Datastore\Migration\031_delete_old_naming_config_columns.cs" />
|
<Compile Include="Datastore\Migration\031_delete_old_naming_config_columns.cs" />
|
||||||
<Compile Include="Datastore\Migration\030_add_season_folder_format_to_naming_config.cs" />
|
<Compile Include="Datastore\Migration\030_add_season_folder_format_to_naming_config.cs" />
|
||||||
|
<Compile Include="Datastore\Migration\032_set_default_release_group.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
|
||||||
|
|
|
@ -89,6 +89,8 @@ namespace NzbDrone.Core.Organizer
|
||||||
{"{Series Title}", series.Title}
|
{"{Series Title}", series.Title}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tokenValues.Add("{Release Group}", episodeFile.ReleaseGroup);
|
||||||
|
|
||||||
if (series.SeriesType == SeriesTypes.Daily)
|
if (series.SeriesType == SeriesTypes.Daily)
|
||||||
{
|
{
|
||||||
pattern = namingConfig.DailyEpisodeFormat;
|
pattern = namingConfig.DailyEpisodeFormat;
|
||||||
|
|
|
@ -65,19 +65,22 @@ namespace NzbDrone.Core.Organizer
|
||||||
_singleEpisodeFile = new EpisodeFile
|
_singleEpisodeFile = new EpisodeFile
|
||||||
{
|
{
|
||||||
Quality = new QualityModel(Quality.HDTV720p),
|
Quality = new QualityModel(Quality.HDTV720p),
|
||||||
Path = @"C:\Test\Series.Title.S01E01.720p.HDTV.x264-EVOLVE.mkv"
|
Path = @"C:\Test\Series.Title.S01E01.720p.HDTV.x264-EVOLVE.mkv",
|
||||||
|
ReleaseGroup = "RlsGrp"
|
||||||
};
|
};
|
||||||
|
|
||||||
_multiEpisodeFile = new EpisodeFile
|
_multiEpisodeFile = new EpisodeFile
|
||||||
{
|
{
|
||||||
Quality = new QualityModel(Quality.HDTV720p),
|
Quality = new QualityModel(Quality.HDTV720p),
|
||||||
Path = @"C:\Test\Series.Title.S01E01-E02.720p.HDTV.x264-EVOLVE.mkv"
|
Path = @"C:\Test\Series.Title.S01E01-E02.720p.HDTV.x264-EVOLVE.mkv",
|
||||||
|
ReleaseGroup = "RlsGrp"
|
||||||
};
|
};
|
||||||
|
|
||||||
_dailyEpisodeFile = new EpisodeFile
|
_dailyEpisodeFile = new EpisodeFile
|
||||||
{
|
{
|
||||||
Quality = new QualityModel(Quality.HDTV720p),
|
Quality = new QualityModel(Quality.HDTV720p),
|
||||||
Path = @"C:\Test\Series.Title.2013.10.30.HDTV.x264-EVOLVE.mkv"
|
Path = @"C:\Test\Series.Title.2013.10.30.HDTV.x264-EVOLVE.mkv",
|
||||||
|
ReleaseGroup = "RlsGrp"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace NzbDrone.Core.Parser.Model
|
||||||
public String AirDate { get; set; }
|
public String AirDate { get; set; }
|
||||||
public Language Language { get; set; }
|
public Language Language { get; set; }
|
||||||
public bool FullSeason { get; set; }
|
public bool FullSeason { get; set; }
|
||||||
|
public string ReleaseGroup { get; set; }
|
||||||
|
|
||||||
public ParsedEpisodeInfo()
|
public ParsedEpisodeInfo()
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,6 @@ namespace NzbDrone.Core.Parser.Model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReleaseGroup { get; set; }
|
|
||||||
public int TvRageId { get; set; }
|
public int TvRageId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -162,6 +162,9 @@ namespace NzbDrone.Core.Parser
|
||||||
result.Quality = QualityParser.ParseQuality(title);
|
result.Quality = QualityParser.ParseQuality(title);
|
||||||
Logger.Trace("Quality parsed: {0}", result.Quality);
|
Logger.Trace("Quality parsed: {0}", result.Quality);
|
||||||
|
|
||||||
|
result.ReleaseGroup = ParseReleaseGroup(title);
|
||||||
|
Logger.Trace("Release Group parsed: {0}", result.ReleaseGroup);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,6 +217,36 @@ namespace NzbDrone.Core.Parser
|
||||||
return MultiPartCleanupRegex.Replace(title, string.Empty).Trim();
|
return MultiPartCleanupRegex.Replace(title, string.Empty).Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ParseReleaseGroup(string title)
|
||||||
|
{
|
||||||
|
const string defaultReleaseGroup = "DRONE";
|
||||||
|
|
||||||
|
title = title.Trim();
|
||||||
|
var index = title.LastIndexOf('-');
|
||||||
|
|
||||||
|
if (index < 0)
|
||||||
|
index = title.LastIndexOf(' ');
|
||||||
|
|
||||||
|
if (index < 0)
|
||||||
|
return defaultReleaseGroup;
|
||||||
|
|
||||||
|
var group = title.Substring(index + 1);
|
||||||
|
|
||||||
|
if (group.Length == title.Length)
|
||||||
|
return String.Empty;
|
||||||
|
|
||||||
|
group = group.Trim('-', ' ', '[', ']');
|
||||||
|
|
||||||
|
if (group.ToLower() == "480p" ||
|
||||||
|
group.ToLower() == "720p" ||
|
||||||
|
group.ToLower() == "1080p")
|
||||||
|
{
|
||||||
|
return defaultReleaseGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
private static SeriesTitleInfo GetSeriesTitleInfo(string title)
|
private static SeriesTitleInfo GetSeriesTitleInfo(string title)
|
||||||
{
|
{
|
||||||
var seriesTitleInfo = new SeriesTitleInfo();
|
var seriesTitleInfo = new SeriesTitleInfo();
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
{{> EpisodeNamingPartial}}
|
{{> EpisodeNamingPartial}}
|
||||||
{{> EpisodeTitleNamingPartial}}
|
{{> EpisodeTitleNamingPartial}}
|
||||||
{{> QualityTitleNamingPartial}}
|
{{> QualityTitleNamingPartial}}
|
||||||
|
{{> ReleaseGroupNamingPartial}}
|
||||||
{{> SeparatorNamingPartial}}
|
{{> SeparatorNamingPartial}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,6 +70,7 @@
|
||||||
{{> EpisodeNamingPartial}}
|
{{> EpisodeNamingPartial}}
|
||||||
{{> EpisodeTitleNamingPartial}}
|
{{> EpisodeTitleNamingPartial}}
|
||||||
{{> QualityTitleNamingPartial}}
|
{{> QualityTitleNamingPartial}}
|
||||||
|
{{> ReleaseGroupNamingPartial}}
|
||||||
{{> SeparatorNamingPartial}}
|
{{> SeparatorNamingPartial}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<li><a href="#" data-token="Release Group">Release Group</a></li>
|
Loading…
Reference in New Issue