mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
core: code cleanup
This commit is contained in:
@@ -84,29 +84,25 @@ namespace Jackett.Common.Indexers
|
||||
var imdbId = ParseUtil.GetImdbID(query.ImdbID);
|
||||
|
||||
if (imdbId != null)
|
||||
{
|
||||
requestData["imdb"] = new JObject();
|
||||
requestData["imdb"]["id"] = imdbId;
|
||||
}
|
||||
requestData["imdb"] = new JObject
|
||||
{
|
||||
["id"] = imdbId
|
||||
};
|
||||
else if (query.TvdbID != null)
|
||||
{
|
||||
requestData["tvdb"] = new JObject();
|
||||
requestData["tvdb"]["id"] = query.TvdbID;
|
||||
requestData["tvdb"] = new JObject
|
||||
{
|
||||
["id"] = query.TvdbID
|
||||
};
|
||||
|
||||
if (query.Season != 0)
|
||||
{
|
||||
requestData["tvdb"]["season"] = query.Season;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(query.Episode))
|
||||
{
|
||||
requestData["tvdb"]["episode"] = query.Episode;
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(queryString))
|
||||
{
|
||||
requestData["search"] = queryString;
|
||||
}
|
||||
|
||||
var categories = MapTorznabCapsToTrackers(query);
|
||||
|
||||
@@ -152,14 +148,10 @@ namespace Jackett.Common.Indexers
|
||||
};
|
||||
|
||||
if (r.ContainsKey("imdb"))
|
||||
{
|
||||
release.Imdb = ParseUtil.GetImdbID((string)r["imdb"]["id"]);
|
||||
}
|
||||
|
||||
if (r.ContainsKey("tvdb"))
|
||||
{
|
||||
release.TVDBId = (long)r["tvdb"]["id"];
|
||||
}
|
||||
|
||||
releases.Add(release);
|
||||
}
|
||||
@@ -191,7 +183,7 @@ namespace Jackett.Common.Indexers
|
||||
{
|
||||
requestData["username"] = configData.Username.Value;
|
||||
requestData["passkey"] = configData.Passkey.Value;
|
||||
JObject json = null;
|
||||
|
||||
var response = await RequestWithCookiesAndRetryAsync(
|
||||
APIUrl + url, null, RequestType.POST, null, null,
|
||||
new Dictionary<string, string>
|
||||
@@ -201,6 +193,7 @@ namespace Jackett.Common.Indexers
|
||||
}, requestData.ToString(), false);
|
||||
CheckSiteDown(response);
|
||||
|
||||
JObject json;
|
||||
try
|
||||
{
|
||||
json = JObject.Parse(response.ContentString);
|
||||
@@ -211,9 +204,7 @@ namespace Jackett.Common.Indexers
|
||||
}
|
||||
|
||||
if ((int)json["status"] != 0)
|
||||
{
|
||||
throw new Exception("HDBits returned an error with status code " + (int)json["status"] + ": " + (string)json["message"]);
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ namespace Jackett.Common.Models.IndexerConfig.Bespoke
|
||||
public CheckboxItem Mediums { get; private set; }
|
||||
public CheckboxItem Origins { get; private set; }
|
||||
|
||||
public ConfigurationDataHDBitsApi() : base()
|
||||
public ConfigurationDataHDBitsApi()
|
||||
{
|
||||
Codecs = new CheckboxItem(new Dictionary<string, string>()
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace Jackett.Common.Models.IndexerConfig.Bespoke
|
||||
{"6", "VP9"},
|
||||
{"4", "XviD"}
|
||||
})
|
||||
{ Name = "Codec", Values = new string[] { "0", "1", "5", "2", "3", "6", "4" } };
|
||||
{ Name = "Codec", Values = new [] { "0", "1", "5", "2", "3", "6", "4" } };
|
||||
|
||||
Mediums = new CheckboxItem(new Dictionary<string, string>()
|
||||
{
|
||||
@@ -31,14 +31,14 @@ namespace Jackett.Common.Models.IndexerConfig.Bespoke
|
||||
{"5", "Remux"},
|
||||
{"6", "WEB-DL"}
|
||||
})
|
||||
{ Name = "Medium", Values = new string[] { "0", "1", "4", "3", "5", "6" } };
|
||||
{ Name = "Medium", Values = new [] { "0", "1", "4", "3", "5", "6" } };
|
||||
|
||||
Origins = new CheckboxItem(new Dictionary<string, string>()
|
||||
{
|
||||
{"0", "Undefined"},
|
||||
{"1", "Internal"}
|
||||
})
|
||||
{ Name = "Origin", Values = new string[] { "0", "1" } };
|
||||
{ Name = "Origin", Values = new [] { "0", "1" } };
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user