mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
subsplease: update category mappings for movie releases
Co-authored-by: Lemres <45440100+Calemy@users.noreply.github.com>
This commit is contained in:
@@ -66,11 +66,15 @@ namespace Jackett.Common.Indexers
|
|||||||
TvSearchParams = new List<TvSearchParam>
|
TvSearchParams = new List<TvSearchParam>
|
||||||
{
|
{
|
||||||
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep
|
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep
|
||||||
|
},
|
||||||
|
MovieSearchParams = new List<MovieSearchParam>
|
||||||
|
{
|
||||||
|
MovieSearchParam.Q
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Configure the category mappings
|
caps.Categories.AddCategoryMapping(1, TorznabCatType.TVAnime);
|
||||||
caps.Categories.AddCategoryMapping(1, TorznabCatType.TVAnime, "Anime");
|
caps.Categories.AddCategoryMapping(2, TorznabCatType.MoviesOther);
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
@@ -142,12 +146,16 @@ namespace Jackett.Common.Indexers
|
|||||||
|
|
||||||
// When there are no results, the API returns an empty array or empty response instead of an object
|
// When there are no results, the API returns an empty array or empty response instead of an object
|
||||||
if (string.IsNullOrWhiteSpace(json) || json == "[]")
|
if (string.IsNullOrWhiteSpace(json) || json == "[]")
|
||||||
|
{
|
||||||
return releaseInfo;
|
return releaseInfo;
|
||||||
|
}
|
||||||
|
|
||||||
var releases = JsonConvert.DeserializeObject<Dictionary<string, Release>>(json);
|
var releases = JsonConvert.DeserializeObject<Dictionary<string, Release>>(json);
|
||||||
|
|
||||||
foreach (var keyValue in releases)
|
foreach (var keyValue in releases)
|
||||||
{
|
{
|
||||||
Release r = keyValue.Value;
|
var r = keyValue.Value;
|
||||||
|
|
||||||
var baseRelease = new ReleaseInfo
|
var baseRelease = new ReleaseInfo
|
||||||
{
|
{
|
||||||
Details = new Uri(SiteLink + $"shows/{r.Page}/"),
|
Details = new Uri(SiteLink + $"shows/{r.Page}/"),
|
||||||
@@ -161,6 +169,12 @@ namespace Jackett.Common.Indexers
|
|||||||
DownloadVolumeFactor = 0,
|
DownloadVolumeFactor = 0,
|
||||||
UploadVolumeFactor = 1
|
UploadVolumeFactor = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (r.Episode.ToLowerInvariant() == "movie")
|
||||||
|
{
|
||||||
|
baseRelease.Category.Add(TorznabCatType.MoviesOther.ID);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var d in r.Downloads)
|
foreach (var d in r.Downloads)
|
||||||
{
|
{
|
||||||
var release = (ReleaseInfo)baseRelease.Clone();
|
var release = (ReleaseInfo)baseRelease.Clone();
|
||||||
@@ -169,21 +183,34 @@ namespace Jackett.Common.Indexers
|
|||||||
release.MagnetUri = new Uri(d.Magnet);
|
release.MagnetUri = new Uri(d.Magnet);
|
||||||
release.Link = null;
|
release.Link = null;
|
||||||
release.Guid = new Uri(d.Magnet);
|
release.Guid = new Uri(d.Magnet);
|
||||||
Match sizeMatch = Regex.Match(d.Magnet, "&xl=\\d+");
|
|
||||||
|
var sizeMatch = Regex.Match(d.Magnet, "&xl=\\d+");
|
||||||
|
|
||||||
if (sizeMatch.Success)
|
if (sizeMatch.Success)
|
||||||
|
{
|
||||||
release.Size = ParseUtil.CoerceLong(sizeMatch.Value.Replace("&xl=", string.Empty));
|
release.Size = ParseUtil.CoerceLong(sizeMatch.Value.Replace("&xl=", string.Empty));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The API doesn't tell us file size, so give an estimate based on resolution
|
// The API doesn't tell us file size, so give an estimate based on resolution
|
||||||
if (string.Equals(d.Res, "1080"))
|
if (string.Equals(d.Res, "1080"))
|
||||||
|
{
|
||||||
release.Size = 1395864371; // 1.3GB
|
release.Size = 1395864371; // 1.3GB
|
||||||
|
}
|
||||||
else if (string.Equals(d.Res, "720"))
|
else if (string.Equals(d.Res, "720"))
|
||||||
|
{
|
||||||
release.Size = 734003200; // 700MB
|
release.Size = 734003200; // 700MB
|
||||||
|
}
|
||||||
else if (string.Equals(d.Res, "480"))
|
else if (string.Equals(d.Res, "480"))
|
||||||
|
{
|
||||||
release.Size = 367001600; // 350MB
|
release.Size = 367001600; // 350MB
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
release.Size = 1073741824; // 1GB
|
release.Size = 1073741824; // 1GB
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
releaseInfo.Add(release);
|
releaseInfo.Add(release);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user