AnimeBytes Sonarr Fix (Will only fix season 1 but we don't have season info).

This commit is contained in:
Azerelat 2016-01-16 22:36:03 +00:00
parent 02a57533f9
commit ea4d0fe701
2 changed files with 19 additions and 1 deletions

View File

@ -27,6 +27,7 @@ namespace Jackett.Indexers
private string LoginUrl { get { return SiteLink + "user/login"; } }
private string SearchUrl { get { return SiteLink + "torrents.php?"; } }
public bool AllowRaws { get { return configData.IncludeRaw.Value; } }
public bool InsertSeason { get { return configData.InsertSeason!=null && configData.InsertSeason.Value; } }
new ConfigurationDataAnimeBytes configData
{
@ -53,6 +54,13 @@ namespace Jackett.Indexers
}
public IEnumerable<ReleaseInfo> FilterResults(TorznabQuery query, IEnumerable<ReleaseInfo> input)
{
// Prevent filtering
return input;
}
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
{
configData.LoadValuesFromJson(configJson);
@ -122,7 +130,9 @@ namespace Jackett.Indexers
private string StripEpisodeNumber(string term)
{
// Tracer does not support searching with episode number so strip it if we have one
return Regex.Replace(term, @"\W(\dx)?\d?\d$", string.Empty);
term = Regex.Replace(term, @"\W(\dx)?\d?\d$", string.Empty);
term = Regex.Replace(term, @"\W(S\d\d?E)?\d?\d$", string.Empty);
return term;
}
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
@ -242,6 +252,12 @@ namespace Jackett.Indexers
releaseInfo = releaseInfo.Replace("Episode ", "");
releaseInfo = releaseInfo.Replace("Season ", "S");
releaseInfo = releaseInfo.Trim();
int test = 0;
if (InsertSeason && int.TryParse(releaseInfo, out test) && releaseInfo.Length==1)
{
releaseInfo = "S01E0" + releaseInfo;
}
}
else if (rowCq.HasClass("torrent"))
{

View File

@ -11,12 +11,14 @@ namespace Jackett.Models.IndexerConfig.Bespoke
{
public BoolItem IncludeRaw { get; private set; }
public DisplayItem DateWarning { get; private set; }
public BoolItem InsertSeason { get; private set; }
public ConfigurationDataAnimeBytes()
: base()
{
IncludeRaw = new BoolItem() { Name = "IncludeRaw", Value = false };
DateWarning = new DisplayItem("This tracker does not supply upload dates so they are based off year of release.") { Name = "DateWarning" };
InsertSeason = new BoolItem() { Name = "Prefix episode number with S01 for Sonarr Compatability", Value = false };
}
}
}