New: Indexers - AvistaZ, CinemaZ, ExoticaZ

This commit is contained in:
Qstick
2021-03-20 16:50:17 -04:00
parent acbb6e3549
commit d2e3bf3964
9 changed files with 6869 additions and 31 deletions
@@ -0,0 +1,60 @@
using System.Collections.Generic;
using NLog;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Definitions.Avistaz;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions
{
public class AvistaZ : AvistazBase
{
public override string Name => "AvistaZ";
public override string BaseUrl => "https://avistaz.to/";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public AvistaZ(IIndexerRepository indexerRepository, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(indexerRepository, httpClient, eventAggregator, indexerStatusService, configService, logger)
{
}
public override IIndexerRequestGenerator GetRequestGenerator()
{
return new AvistazRequestGenerator()
{
Settings = Settings,
HttpClient = _httpClient,
Logger = _logger,
Capabilities = Capabilities,
BaseUrl = BaseUrl
};
}
protected override IndexerCapabilities SetCapabilities()
{
var caps = new IndexerCapabilities
{
TvSearchParams = new List<TvSearchParam>
{
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId
},
MovieSearchParams = new List<MovieSearchParam>
{
MovieSearchParam.Q, MovieSearchParam.ImdbId
}
};
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.Movies);
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.MoviesUHD);
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.MoviesHD);
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.MoviesSD);
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TV);
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TVUHD);
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TVHD);
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TVSD);
caps.Categories.AddCategoryMapping(3, NewznabStandardCategory.Audio);
return caps;
}
}
}
@@ -20,15 +20,15 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
[JsonProperty(PropertyName = "info_hash")]
public string InfoHash { get; set; }
public int Leech { get; set; }
public int Completed { get; set; }
public int Seed { get; set; }
public int? Leech { get; set; }
public int? Completed { get; set; }
public int? Seed { get; set; }
[JsonProperty(PropertyName = "file_size")]
public long FileSize { get; set; }
public long? FileSize { get; set; }
[JsonProperty(PropertyName = "file_count")]
public int FileCount { get; set; }
public int? FileCount { get; set; }
[JsonProperty(PropertyName = "download_multiply")]
public double? DownloadMultiply { get; set; }
@@ -43,14 +43,13 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public class AvistazResponse
{
public string Status { get; set; }
public List<AvistazRelease> Data { get; set; }
}
public class AvistazIdInfo
{
public int Tmdb { get; set; }
public int Tvdb { get; set; }
public string Tmdb { get; set; }
public string Tvdb { get; set; }
public string Imdb { get; set; }
public string Title { get; set; }
@@ -9,7 +9,7 @@ using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions.Avistaz
{
public abstract class Avistaz : HttpIndexerBase<AvistazSettings>
public abstract class AvistazBase : HttpIndexerBase<AvistazSettings>
{
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
public override string BaseUrl => "";
@@ -20,7 +20,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public override IndexerCapabilities Capabilities => SetCapabilities();
private IIndexerRepository _indexerRepository;
public Avistaz(IIndexerRepository indexerRepository,
public AvistazBase(IIndexerRepository indexerRepository,
IHttpClient httpClient,
IEventAggregator eventAggregator,
IIndexerStatusService indexerStatusService,
@@ -45,7 +45,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public override IParseIndexerResponse GetParser()
{
return new AvistazParser(Settings, Capabilities, BaseUrl);
return new AvistazParser();
}
protected virtual IndexerCapabilities SetCapabilities()
@@ -12,37 +12,25 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
{
public class AvistazParser : IParseIndexerResponse
{
private readonly AvistazSettings _settings;
private readonly IndexerCapabilities _capabilities;
private readonly string _baseUrl;
private readonly HashSet<string> _hdResolutions = new HashSet<string> { "1080p", "1080i", "720p" };
public AvistazParser(AvistazSettings settings, IndexerCapabilities capabilities, string baseUrl)
public AvistazParser()
{
_settings = settings;
_capabilities = capabilities;
_baseUrl = baseUrl;
}
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
{
var torrentInfos = new List<ReleaseInfo>();
var torrentInfos = new List<TorrentInfo>();
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
{
// Remove cookie cache
CookiesUpdater(null, null);
throw new IndexerException(indexerResponse, $"Unexpected response status {indexerResponse.HttpResponse.StatusCode} code from API request");
}
if (!indexerResponse.HttpResponse.Headers.ContentType.Contains(HttpAccept.Json.Value))
{
// Remove cookie cache
CookiesUpdater(null, null);
throw new IndexerException(indexerResponse, $"Unexpected response header {indexerResponse.HttpResponse.Headers.ContentType} from API request, expected {HttpAccept.Json.Value}");
}
@@ -69,15 +57,19 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
Grabs = row.Completed,
Seeders = row.Seed,
Peers = row.Leech + row.Seed,
ImdbId = ParseUtil.GetImdbID(row.MovieTvinfo.Imdb).Value,
TvdbId = row.MovieTvinfo.Tvdb,
TmdbId = row.MovieTvinfo.Tmdb,
DownloadVolumeFactor = row.DownloadMultiply,
UploadVolumeFactor = row.UploadMultiply,
MinimumRatio = 1,
MinimumSeedTime = 172800 // 48 hours
MinimumSeedTime = 172800, // 48 hours
};
if (row.MovieTvinfo != null)
{
release.ImdbId = ParseUtil.GetImdbID(row.MovieTvinfo.Imdb).GetValueOrDefault();
release.TmdbId = row.MovieTvinfo.Tmdb.IsNullOrWhiteSpace() ? 0 : ParseUtil.CoerceInt(row.MovieTvinfo.Tmdb);
release.TvdbId = row.MovieTvinfo.Tvdb.IsNullOrWhiteSpace() ? 0 : ParseUtil.CoerceInt(row.MovieTvinfo.Tvdb);
}
torrentInfos.Add(release);
}
@@ -113,7 +105,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
cats.Add(NewznabStandardCategory.Audio);
break;
default:
throw new Exception("Error parsing category!");
throw new Exception(string.Format("Error parsing Avistaz category type {0}", row.Type));
}
return cats;
@@ -0,0 +1,60 @@
using System.Collections.Generic;
using NLog;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Definitions.Avistaz;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions
{
public class CinemaZ : AvistazBase
{
public override string Name => "CinemaZ";
public override string BaseUrl => "https://cinemaz.to/";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public CinemaZ(IIndexerRepository indexerRepository, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(indexerRepository, httpClient, eventAggregator, indexerStatusService, configService, logger)
{
}
public override IIndexerRequestGenerator GetRequestGenerator()
{
return new AvistazRequestGenerator()
{
Settings = Settings,
HttpClient = _httpClient,
Logger = _logger,
Capabilities = Capabilities,
BaseUrl = BaseUrl
};
}
protected override IndexerCapabilities SetCapabilities()
{
var caps = new IndexerCapabilities
{
TvSearchParams = new List<TvSearchParam>
{
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId
},
MovieSearchParams = new List<MovieSearchParam>
{
MovieSearchParam.Q, MovieSearchParam.ImdbId
}
};
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.Movies);
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.MoviesUHD);
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.MoviesHD);
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.MoviesSD);
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TV);
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TVUHD);
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TVHD);
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TVSD);
caps.Categories.AddCategoryMapping(3, NewznabStandardCategory.Audio);
return caps;
}
}
}
@@ -0,0 +1,54 @@
using System.Collections.Generic;
using NLog;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Definitions.Avistaz;
using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions
{
public class ExoticaZ : AvistazBase
{
public override string Name => "ExoticaZ";
public override string BaseUrl => "https://exoticaz.to/";
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public ExoticaZ(IIndexerRepository indexerRepository, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
: base(indexerRepository, httpClient, eventAggregator, indexerStatusService, configService, logger)
{
}
public override IIndexerRequestGenerator GetRequestGenerator()
{
return new AvistazRequestGenerator()
{
Settings = Settings,
HttpClient = _httpClient,
Logger = _logger,
Capabilities = Capabilities,
BaseUrl = BaseUrl
};
}
protected override IndexerCapabilities SetCapabilities()
{
var caps = new IndexerCapabilities
{
MovieSearchParams = new List<MovieSearchParam>
{
MovieSearchParam.Q
}
};
caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.XXXx264);
caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.XXXPack);
caps.Categories.AddCategoryMapping(3, NewznabStandardCategory.XXXPack);
caps.Categories.AddCategoryMapping(4, NewznabStandardCategory.XXXPack);
caps.Categories.AddCategoryMapping(5, NewznabStandardCategory.XXXDVD);
caps.Categories.AddCategoryMapping(6, NewznabStandardCategory.XXXOther);
caps.Categories.AddCategoryMapping(7, NewznabStandardCategory.XXXImageSet);
return caps;
}
}
}
@@ -7,7 +7,7 @@ using NzbDrone.Core.Messaging.Events;
namespace NzbDrone.Core.Indexers.Definitions
{
public class PrivateHD : Avistaz.Avistaz
public class PrivateHD : Avistaz.AvistazBase
{
public override string Name => "PrivateHD";
public override string BaseUrl => "https://privatehd.to/";