mirror of https://github.com/Jackett/Jackett
Implemented indexer configuration result status to prevent double query test on some indexers
This commit is contained in:
parent
30ba1793c0
commit
748d85f32f
|
@ -67,7 +67,7 @@ namespace Jackett.Controllers
|
|||
result.Content = new StreamContent(stream);
|
||||
result.Content.Headers.ContentType =
|
||||
new MediaTypeHeaderValue(MimeMapping.GetMimeMapping(mappedPath));
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ namespace Jackett.Controllers
|
|||
[AllowAnonymous]
|
||||
public async Task<HttpResponseMessage> Dashboard()
|
||||
{
|
||||
if(Request.RequestUri.Query!=null && Request.RequestUri.Query.Contains("logout"))
|
||||
if (Request.RequestUri.Query != null && Request.RequestUri.Query.Contains("logout"))
|
||||
{
|
||||
var file = GetFile("login.html");
|
||||
securityService.Logout(file);
|
||||
|
@ -98,16 +98,18 @@ namespace Jackett.Controllers
|
|||
{
|
||||
return GetFile("index.html");
|
||||
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
var formData = await Request.Content.ReadAsFormDataAsync();
|
||||
|
||||
if (formData!=null && securityService.HashPassword(formData["password"]) == serverService.Config.AdminPassword)
|
||||
|
||||
if (formData != null && securityService.HashPassword(formData["password"]) == serverService.Config.AdminPassword)
|
||||
{
|
||||
var file = GetFile("index.html");
|
||||
securityService.Login(file);
|
||||
return file;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetFile("login.html");
|
||||
}
|
||||
|
@ -180,8 +182,15 @@ namespace Jackett.Controllers
|
|||
string indexerString = (string)postData["indexer"];
|
||||
indexer = indexerService.GetIndexer((string)postData["indexer"]);
|
||||
jsonReply["name"] = indexer.DisplayName;
|
||||
await indexer.ApplyConfiguration(postData["config"]);
|
||||
await indexerService.TestIndexer((string)postData["indexer"]);
|
||||
var configurationResult = await indexer.ApplyConfiguration(postData["config"]);
|
||||
if (configurationResult == IndexerConfigurationStatus.RequiresTesting)
|
||||
{
|
||||
await indexerService.TestIndexer((string)postData["indexer"]);
|
||||
}
|
||||
else if (configurationResult == IndexerConfigurationStatus.Failed)
|
||||
{
|
||||
throw new Exception("Configuration Failed");
|
||||
}
|
||||
jsonReply["result"] = "success";
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -194,10 +203,11 @@ namespace Jackett.Controllers
|
|||
if (ex is ExceptionWithConfigData)
|
||||
{
|
||||
jsonReply["config"] = ((ExceptionWithConfigData)ex).ConfigData.ToJson(null);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Error(ex, "Exception in Configure");
|
||||
}
|
||||
}
|
||||
}
|
||||
return Json(jsonReply);
|
||||
}
|
||||
|
@ -293,12 +303,13 @@ namespace Jackett.Controllers
|
|||
cfg["external"] = serverService.Config.AllowExternal;
|
||||
cfg["api_key"] = serverService.Config.APIKey;
|
||||
cfg["blackholedir"] = serverService.Config.BlackholeDir;
|
||||
cfg["password"] = string.IsNullOrEmpty(serverService.Config.AdminPassword )? string.Empty:serverService.Config.AdminPassword.Substring(0,10);
|
||||
cfg["password"] = string.IsNullOrEmpty(serverService.Config.AdminPassword) ? string.Empty : serverService.Config.AdminPassword.Substring(0, 10);
|
||||
|
||||
jsonReply["config"] = cfg;
|
||||
jsonReply["app_version"] = config.GetVersion();
|
||||
jsonReply["result"] = "success";
|
||||
}catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, "Exception in get_jackett_config");
|
||||
jsonReply["result"] = "error";
|
||||
|
@ -360,7 +371,8 @@ namespace Jackett.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
(new Thread(() => {
|
||||
(new Thread(() =>
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
serverService.Stop();
|
||||
Engine.BuildContainer();
|
||||
|
@ -370,7 +382,7 @@ namespace Jackett.Controllers
|
|||
}
|
||||
|
||||
|
||||
if(saveDir != Engine.Server.Config.BlackholeDir)
|
||||
if (saveDir != Engine.Server.Config.BlackholeDir)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(saveDir))
|
||||
{
|
||||
|
@ -435,12 +447,12 @@ namespace Jackett.Controllers
|
|||
var query = new TorznabQuery()
|
||||
{
|
||||
SearchTerm = value.Query,
|
||||
Categories = value.Category ==0?new int[0]: new int[1] { value.Category }
|
||||
Categories = value.Category == 0 ? new int[0] : new int[1] { value.Category }
|
||||
};
|
||||
|
||||
query.ExpandCatsToSubCats();
|
||||
|
||||
var trackers = indexerService.GetAllIndexers().Where(t=>t.IsConfigured).ToList();
|
||||
var trackers = indexerService.GetAllIndexers().Where(t => t.IsConfigured).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(value.Tracker))
|
||||
{
|
||||
trackers = trackers.Where(t => t.ID == value.Tracker).ToList();
|
||||
|
@ -453,7 +465,8 @@ namespace Jackett.Controllers
|
|||
|
||||
Parallel.ForEach(trackers.ToList(), indexer =>
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
var searchResults = indexer.PerformQuery(query).Result;
|
||||
cacheService.CacheRssResults(indexer, searchResults);
|
||||
searchResults = indexer.FilterResults(query, searchResults);
|
||||
|
@ -470,7 +483,7 @@ namespace Jackett.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.Error(e, "An error occured during manual search on " + indexer.DisplayName + ": " + e.Message);
|
||||
}
|
||||
|
@ -483,10 +496,10 @@ namespace Jackett.Controllers
|
|||
results = results.OrderByDescending(d => d.PublishDate).ToList();
|
||||
}
|
||||
|
||||
var manualResult = new ManualSearchResult()
|
||||
var manualResult = new ManualSearchResult()
|
||||
{
|
||||
Results = results,
|
||||
Indexers = trackers.Select(t=>t.DisplayName).ToList()
|
||||
Indexers = trackers.Select(t => t.DisplayName).ToList()
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace Jackett.Indexers
|
|||
AddCategoryMapping(23, TorznabCatType.Audio);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
var incomingConfig = new ConfigurationDataBasicLogin();
|
||||
incomingConfig.LoadValuesFromJson(configJson);
|
||||
|
@ -76,6 +76,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = dom["#loginform"].Text().Trim().Replace("\n\t", " ");
|
||||
throw new ExceptionWithConfigData(errorMessage, (ConfigurationData)incomingConfig);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
void FillReleaseInfoFromJson(ReleaseInfo release, JObject r)
|
||||
|
|
|
@ -49,10 +49,10 @@ namespace Jackett.Indexers
|
|||
p: ps,
|
||||
configData: new ConfigurationDataAnimeBytes())
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -99,6 +99,8 @@ namespace Jackett.Indexers
|
|||
// Their login page appears to be broken and just gives a 500 error.
|
||||
throw new ExceptionWithConfigData("Failed to login, 6 failed attempts will get you banned for 6 hours.", configData);
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
// Override to load legacy config format
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace Jackett.Indexers
|
|||
AddCategoryMapping(11, TorznabCatType.PCGames);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -80,8 +80,9 @@ namespace Jackett.Indexers
|
|||
}
|
||||
var message = string.Join(" ", messages);
|
||||
throw new ExceptionWithConfigData(message, configData);
|
||||
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -66,6 +66,8 @@ namespace Jackett.Indexers
|
|||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace Jackett.Indexers
|
|||
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -93,6 +93,7 @@ namespace Jackett.Indexers
|
|||
CQ dom = response.Content;
|
||||
throw new ExceptionWithConfigData("Invalid cookie header", configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -62,6 +62,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace Jackett.Indexers
|
|||
return configData;
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -80,6 +80,7 @@ namespace Jackett.Indexers
|
|||
configData.CaptchaCookie.Value = captchaImage.Cookies;
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -58,6 +58,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = dom[".red"].ElementAt(1).Cq().Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace Jackett.Indexers
|
|||
AddCategoryMapping(7, TorznabCatType.XXX);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -81,6 +81,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = dom[".main"].Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
@ -99,7 +100,7 @@ namespace Jackett.Indexers
|
|||
if (!string.IsNullOrWhiteSpace(searchString) || cat != "0")
|
||||
searchUrl += string.Format("?search={0}&cat={1}&searchin=0&sort=0", HttpUtility.UrlEncode(searchString), cat);
|
||||
|
||||
|
||||
|
||||
|
||||
var response = await RequestStringWithCookiesAndRetry(searchUrl, null, BrowseUrl);
|
||||
var results = response.Content;
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var response = await webclient.GetString(new Utils.Clients.WebRequest()
|
||||
|
@ -51,6 +51,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
throw new ExceptionWithConfigData("Failed to login", configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -65,6 +65,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -63,6 +63,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = string.Format(errorStr, attempts);
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Jackett.Indexers
|
|||
AddCategoryMapping("47", TorznabCatType.XXX);//XXX/720p
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
||||
|
@ -82,6 +82,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = "Couldn't login";
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
@ -104,7 +105,7 @@ namespace Jackett.Indexers
|
|||
queryCollection.Add("search", searchString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
queryCollection.Add("active", "1");
|
||||
queryCollection.Add("options", "0");
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Jackett.Indexers
|
|||
Task<ConfigurationData> GetConfigurationForSetup();
|
||||
|
||||
// Called when web API wants to apply setup configuration via web API, usually this is where login and storing cookie happens
|
||||
Task ApplyConfiguration(JToken configJson);
|
||||
Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson);
|
||||
|
||||
// Called on startup when initializing indexers from saved configuration
|
||||
void LoadFromSavedConfiguration(JToken jsonConfig);
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace Jackett.Indexers
|
|||
AddCategoryMapping(94, TorznabCatType.BooksComics);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -109,6 +109,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace Jackett.Indexers
|
|||
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -93,6 +93,8 @@ namespace Jackett.Indexers
|
|||
var errorMessage = "Incorrect username or password! " + tries + " tries remaining.";
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -63,6 +63,8 @@ namespace Jackett.Indexers
|
|||
var errorMessage = dom["#loginform"].Text().Trim().Replace("\n\t", " ");
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
private void FillReleaseInfoFromJson(ReleaseInfo release, JObject r)
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace Jackett.Indexers
|
|||
TorznabCaps.Categories.Add(newznabCategory);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -198,6 +198,8 @@ namespace Jackett.Indexers
|
|||
CookieHeader = string.Empty;
|
||||
throw new ExceptionWithConfigData("Failed", configData);
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
@ -292,7 +294,7 @@ namespace Jackett.Indexers
|
|||
release.Seeders = ParseUtil.CoerceInt(row.ChildElements.ElementAt(9).InnerText);
|
||||
release.Peers = ParseUtil.CoerceInt(row.ChildElements.ElementAt(10).InnerText) + release.Seeders;
|
||||
|
||||
var cat = row.ChildElements.ElementAt(0).ChildElements.ElementAt(0).GetAttribute("href").Replace("browse.php?",string.Empty);
|
||||
var cat = row.ChildElements.ElementAt(0).ChildElements.ElementAt(0).GetAttribute("href").Replace("browse.php?", string.Empty);
|
||||
release.Category = MapTrackerResultCatToNewznab(cat);
|
||||
|
||||
releases.Add(release);
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Jackett.Indexers
|
|||
AddCategoryMapping(3, TorznabCatType.Audio);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
||||
|
@ -68,6 +68,8 @@ namespace Jackett.Indexers
|
|||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
@ -119,7 +121,7 @@ namespace Jackett.Indexers
|
|||
.Replace("gi gi-film", "1")
|
||||
.Replace("gi gi-tv", "2")
|
||||
.Replace("gi gi-music", "3")
|
||||
.Replace("text-pink",string.Empty);
|
||||
.Replace("text-pink", string.Empty);
|
||||
release.Category = MapTrackerCatToNewznab(cat.Trim());
|
||||
releases.Add(release);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace Jackett.Indexers
|
|||
TorznabCaps.Categories.Add(TorznabCatType.Books);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var oldConfig = configData;
|
||||
|
@ -60,6 +60,8 @@ namespace Jackett.Indexers
|
|||
configData = oldConfig;
|
||||
throw new Exception("Could not find releases from this URL");
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace Jackett.Indexers
|
|||
}
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var releases = await PerformQuery(new TorznabQuery());
|
||||
|
@ -103,6 +103,8 @@ namespace Jackett.Indexers
|
|||
{
|
||||
throw new Exception("Could not find releases from this URL");
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.Completed;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -60,6 +60,8 @@ namespace Jackett.Indexers
|
|||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -58,6 +58,8 @@ namespace Jackett.Indexers
|
|||
var errorMessage = dom["td.text"].Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
private Dictionary<string, string> GetSearchFormData(string searchString)
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var releases = await PerformQuery(new TorznabQuery());
|
||||
|
@ -58,6 +58,8 @@ namespace Jackett.Indexers
|
|||
{
|
||||
throw new Exception("Could not find releases from this URL");
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
// Override to load legacy config format
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -61,6 +61,8 @@ namespace Jackett.Indexers
|
|||
var errorMessage = dom["h5"].First().Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var releases = await PerformQuery(new TorznabQuery());
|
||||
|
@ -59,6 +59,8 @@ namespace Jackett.Indexers
|
|||
{
|
||||
throw new Exception("Could not find releases from this URL");
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.Completed;
|
||||
}
|
||||
|
||||
// Override to load legacy config format
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Jackett.Indexers
|
|||
return configData.ApiToken.Value;
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -99,6 +99,8 @@ namespace Jackett.Indexers
|
|||
{
|
||||
throw tokenFetchEx;
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
// Override to load legacy config format
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace Jackett.Indexers
|
|||
AddCategoryMapping("HD Factual/Reality", TorznabCatType.TVHD);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -139,6 +139,7 @@ namespace Jackett.Indexers
|
|||
IsConfigured = false;
|
||||
throw e;
|
||||
}
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var releases = await PerformQuery(new TorznabQuery());
|
||||
|
@ -60,6 +60,8 @@ namespace Jackett.Indexers
|
|||
{
|
||||
throw new Exception("Could not find releases from this URL");
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.Completed;
|
||||
}
|
||||
|
||||
// Override to load legacy config format
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace Jackett.Indexers
|
|||
AddCategoryMapping(24, TorznabCatType.XXXImageset);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -91,6 +91,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace Jackett.Indexers
|
|||
return result;
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -140,6 +140,7 @@ namespace Jackett.Indexers
|
|||
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace Jackett.Indexers
|
|||
AddCategoryMapping(33, TorznabCatType.PC0day);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var pairs = new Dictionary<string, string> {
|
||||
|
@ -97,6 +97,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
@ -107,7 +108,7 @@ namespace Jackett.Indexers
|
|||
|
||||
if (!string.IsNullOrWhiteSpace(searchString))
|
||||
{
|
||||
searchUrl += "query/" + HttpUtility.UrlEncode(searchString) + "/";
|
||||
searchUrl += "query/" + HttpUtility.UrlEncode(searchString) + "/";
|
||||
}
|
||||
string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
|
||||
|
||||
|
@ -160,7 +161,7 @@ namespace Jackett.Indexers
|
|||
release.Seeders = ParseUtil.CoerceInt(qRow.Find(".seeders").Text());
|
||||
release.Peers = release.Seeders + ParseUtil.CoerceInt(qRow.Find(".leechers").Text());
|
||||
|
||||
var category = qRow.Find(".category a").Attr("href").Replace("/torrents/browse/index/categories/",string.Empty);
|
||||
var category = qRow.Find(".category a").Attr("href").Replace("/torrents/browse/index/categories/", string.Empty);
|
||||
release.Category = MapTrackerCatToNewznab(category);
|
||||
|
||||
releases.Add(release);
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -62,6 +62,7 @@ namespace Jackett.Indexers
|
|||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
var releases = await PerformQuery(new TorznabQuery());
|
||||
|
@ -59,6 +59,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
throw new Exception("Could not find releases from this URL");
|
||||
});
|
||||
return IndexerConfigurationStatus.Completed;
|
||||
}
|
||||
|
||||
// Override to load legacy config format
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Jackett.Indexers
|
|||
{
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
configData.LoadValuesFromJson(configJson);
|
||||
|
||||
|
@ -69,6 +69,8 @@ namespace Jackett.Indexers
|
|||
var errorMessage = msgContainer != null ? msgContainer.InnerText : "Error while trying to login.";
|
||||
throw new ExceptionWithConfigData(errorMessage, configData);
|
||||
});
|
||||
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
}
|
||||
|
||||
List<KeyValuePair<string, string>> CreateKeyValueList(params string[][] keyValues)
|
||||
|
|
|
@ -215,6 +215,7 @@
|
|||
<Compile Include="Models\CachedResult.cs" />
|
||||
<Compile Include="Models\CategoryMapping.cs" />
|
||||
<Compile Include="Models\AdminSearch.cs" />
|
||||
<Compile Include="Models\IndexerConfigurationStatus.cs" />
|
||||
<Compile Include="Models\IndexerConfig\ConfigurationDataFileList.cs" />
|
||||
<Compile Include="Models\IndexerConfig\ConfigurationDataBasicLoginWithRSS.cs" />
|
||||
<Compile Include="Models\IndexerConfig\ConfigurationDataRecaptchaLogin.cs" />
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jackett.Models
|
||||
{
|
||||
public enum IndexerConfigurationStatus
|
||||
{
|
||||
Completed,
|
||||
RequiresTesting,
|
||||
Failed
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue