2020-02-09 02:35:16 +00:00
|
|
|
using System;
|
2017-07-10 20:58:44 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
2018-03-10 08:05:56 +00:00
|
|
|
namespace Jackett.Common.Models
|
2017-07-10 20:58:44 +00:00
|
|
|
{
|
|
|
|
// A Dictionary allowing the same key multiple times
|
|
|
|
public class KeyValuePairList : List<KeyValuePair<string, selectorBlock>>, IDictionary<string, selectorBlock>
|
|
|
|
{
|
|
|
|
public selectorBlock this[string key]
|
|
|
|
{
|
2020-02-25 16:08:03 +00:00
|
|
|
get => throw new NotImplementedException();
|
2017-07-10 20:58:44 +00:00
|
|
|
|
2020-02-25 16:08:03 +00:00
|
|
|
set => Add(new KeyValuePair<string, selectorBlock>(key, value));
|
2017-07-10 20:58:44 +00:00
|
|
|
}
|
|
|
|
|
2020-02-25 16:08:03 +00:00
|
|
|
public ICollection<string> Keys => throw new NotImplementedException();
|
2017-07-10 20:58:44 +00:00
|
|
|
|
2020-02-25 16:08:03 +00:00
|
|
|
public ICollection<selectorBlock> Values => throw new NotImplementedException();
|
2017-07-10 20:58:44 +00:00
|
|
|
|
2020-02-25 16:08:03 +00:00
|
|
|
public void Add(string key, selectorBlock value) => Add(new KeyValuePair<string, selectorBlock>(key, value));
|
2017-07-10 20:58:44 +00:00
|
|
|
|
2020-02-25 16:08:03 +00:00
|
|
|
public bool ContainsKey(string key) => throw new NotImplementedException();
|
2017-07-10 20:58:44 +00:00
|
|
|
|
2020-02-25 16:08:03 +00:00
|
|
|
public bool Remove(string key) => throw new NotImplementedException();
|
2017-07-10 20:58:44 +00:00
|
|
|
|
2020-02-25 16:08:03 +00:00
|
|
|
public bool TryGetValue(string key, out selectorBlock value) => throw new NotImplementedException();
|
2017-07-10 20:58:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Cardigann yaml classes
|
|
|
|
public class IndexerDefinition
|
|
|
|
{
|
2020-05-11 19:59:28 +00:00
|
|
|
public string Id { get; set; }
|
2017-07-10 20:58:44 +00:00
|
|
|
public List<settingsField> Settings { get; set; }
|
|
|
|
public string Name { get; set; }
|
|
|
|
public string Description { get; set; }
|
|
|
|
public string Type { get; set; }
|
|
|
|
public string Language { get; set; }
|
|
|
|
public string Encoding { get; set; }
|
2021-10-20 20:49:11 +00:00
|
|
|
public double? RequestDelay { get; set; }
|
2017-07-10 20:58:44 +00:00
|
|
|
public List<string> Links { get; set; }
|
2017-08-30 16:46:36 +00:00
|
|
|
public List<string> Legacylinks { get; set; }
|
2018-11-19 13:05:46 +00:00
|
|
|
public bool Followredirect { get; set; } = false;
|
2021-09-15 03:29:01 +00:00
|
|
|
public bool Testlinktorrent { get; set; } = true;
|
2017-07-10 20:58:44 +00:00
|
|
|
public List<string> Certificates { get; set; }
|
|
|
|
public capabilitiesBlock Caps { get; set; }
|
|
|
|
public loginBlock Login { get; set; }
|
|
|
|
public ratioBlock Ratio { get; set; }
|
|
|
|
public searchBlock Search { get; set; }
|
|
|
|
public downloadBlock Download { get; set; }
|
|
|
|
// IndexerDefinitionStats not needed/implemented
|
|
|
|
}
|
|
|
|
public class settingsField
|
|
|
|
{
|
|
|
|
public string Name { get; set; }
|
|
|
|
public string Type { get; set; }
|
|
|
|
public string Label { get; set; }
|
|
|
|
public string Default { get; set; }
|
2020-02-19 20:23:55 +00:00
|
|
|
public string[] Defaults { get; set; }
|
2017-07-10 20:58:44 +00:00
|
|
|
public Dictionary<string, string> Options { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class CategorymappingBlock
|
|
|
|
{
|
|
|
|
public string id { get; set; }
|
|
|
|
public string cat { get; set; }
|
|
|
|
public string desc { get; set; }
|
2018-04-01 12:56:45 +00:00
|
|
|
public bool Default { get; set; }
|
2017-07-10 20:58:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public class capabilitiesBlock
|
|
|
|
{
|
|
|
|
public Dictionary<string, string> Categories { get; set; }
|
|
|
|
public List<CategorymappingBlock> Categorymappings { get; set; }
|
|
|
|
public Dictionary<string, List<string>> Modes { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class captchaBlock
|
|
|
|
{
|
|
|
|
public string Type { get; set; }
|
2018-01-10 17:20:11 +00:00
|
|
|
public string Selector { get; set; }
|
2017-07-10 20:58:44 +00:00
|
|
|
public string Input { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class loginBlock
|
|
|
|
{
|
|
|
|
public string Path { get; set; }
|
|
|
|
public string Submitpath { get; set; }
|
|
|
|
public List<string> Cookies { get; set; }
|
|
|
|
public string Method { get; set; }
|
|
|
|
public string Form { get; set; }
|
|
|
|
public bool Selectors { get; set; } = false;
|
|
|
|
public Dictionary<string, string> Inputs { get; set; }
|
|
|
|
public Dictionary<string, selectorBlock> Selectorinputs { get; set; }
|
|
|
|
public Dictionary<string, selectorBlock> Getselectorinputs { get; set; }
|
|
|
|
public List<errorBlock> Error { get; set; }
|
|
|
|
public pageTestBlock Test { get; set; }
|
|
|
|
public captchaBlock Captcha { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class errorBlock
|
|
|
|
{
|
|
|
|
public string Path { get; set; }
|
|
|
|
public string Selector { get; set; }
|
|
|
|
public selectorBlock Message { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class selectorBlock
|
|
|
|
{
|
|
|
|
public string Selector { get; set; }
|
|
|
|
public bool Optional { get; set; } = false;
|
|
|
|
public string Text { get; set; }
|
|
|
|
public string Attribute { get; set; }
|
|
|
|
public string Remove { get; set; }
|
|
|
|
public List<filterBlock> Filters { get; set; }
|
|
|
|
public Dictionary<string, string> Case { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class filterBlock
|
|
|
|
{
|
|
|
|
public string Name { get; set; }
|
|
|
|
public dynamic Args { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class pageTestBlock
|
|
|
|
{
|
|
|
|
public string Path { get; set; }
|
|
|
|
public string Selector { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class ratioBlock : selectorBlock
|
|
|
|
{
|
|
|
|
public string Path { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class searchBlock
|
|
|
|
{
|
|
|
|
public string Path { get; set; }
|
|
|
|
public List<searchPathBlock> Paths { get; set; }
|
|
|
|
public Dictionary<string, List<string>> Headers { get; set; }
|
|
|
|
public List<filterBlock> Keywordsfilters { get; set; }
|
|
|
|
public Dictionary<string, string> Inputs { get; set; }
|
|
|
|
public List<errorBlock> Error { get; set; }
|
2017-10-17 16:23:13 +00:00
|
|
|
public List<filterBlock> Preprocessingfilters { get; set; }
|
2017-07-10 20:58:44 +00:00
|
|
|
public rowsBlock Rows { get; set; }
|
|
|
|
public KeyValuePairList Fields { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class rowsBlock : selectorBlock
|
|
|
|
{
|
|
|
|
public int After { get; set; }
|
|
|
|
//public string Remove { get; set; } // already inherited
|
|
|
|
public selectorBlock Dateheaders { get; set; }
|
2021-10-20 20:49:11 +00:00
|
|
|
public selectorBlock Count { get; set; }
|
2022-02-07 20:54:17 +00:00
|
|
|
public bool Multiple { get; set; } = false;
|
2022-02-26 19:23:37 +00:00
|
|
|
public bool MissingAttributeEquals0Results { get; set; } = false;
|
2017-07-10 20:58:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public class searchPathBlock : requestBlock
|
|
|
|
{
|
2021-06-19 20:30:08 +00:00
|
|
|
public List<string> Categories { get; set; } = new List<string>();
|
2017-07-10 20:58:44 +00:00
|
|
|
public bool Inheritinputs { get; set; } = true;
|
2018-12-01 13:19:50 +00:00
|
|
|
public bool Followredirect { get; set; } = false;
|
2021-10-20 20:49:11 +00:00
|
|
|
public responseBlock Response { get; set; }
|
2017-07-10 20:58:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public class requestBlock
|
|
|
|
{
|
|
|
|
public string Path { get; set; }
|
|
|
|
public string Method { get; set; }
|
|
|
|
public Dictionary<string, string> Inputs { get; set; }
|
2020-04-12 07:55:56 +00:00
|
|
|
public string Queryseparator { get; set; } = "&";
|
2017-07-10 20:58:44 +00:00
|
|
|
}
|
|
|
|
|
2021-09-10 03:14:57 +00:00
|
|
|
public class beforeBlock : requestBlock
|
|
|
|
{
|
|
|
|
public selectorField Pathselector { get; set; }
|
|
|
|
}
|
|
|
|
|
2021-09-06 03:42:15 +00:00
|
|
|
public class infohashBlock
|
|
|
|
{
|
2021-09-10 03:14:57 +00:00
|
|
|
public selectorField Hash { get; set; }
|
|
|
|
public selectorField Title { get; set; }
|
2021-10-06 06:56:46 +00:00
|
|
|
public bool Usebeforeresponse { get; set; } = false;
|
2021-09-06 03:42:15 +00:00
|
|
|
}
|
|
|
|
|
2017-07-10 20:58:44 +00:00
|
|
|
public class downloadBlock
|
|
|
|
{
|
2021-09-10 03:14:57 +00:00
|
|
|
public List<selectorField> Selectors { get; set; }
|
2017-07-10 20:58:44 +00:00
|
|
|
public string Method { get; set; }
|
2021-09-10 03:14:57 +00:00
|
|
|
public beforeBlock Before { get; set; }
|
2021-09-06 03:42:15 +00:00
|
|
|
public infohashBlock Infohash { get; set; }
|
2017-07-10 20:58:44 +00:00
|
|
|
}
|
2021-06-14 05:13:56 +00:00
|
|
|
|
2021-09-10 03:14:57 +00:00
|
|
|
public class selectorField
|
2021-06-14 05:13:56 +00:00
|
|
|
{
|
|
|
|
public string Selector { get; set; }
|
|
|
|
public string Attribute { get; set; }
|
2021-10-06 06:14:34 +00:00
|
|
|
public bool Usebeforeresponse { get; set; } = false;
|
2021-06-14 16:11:23 +00:00
|
|
|
public List<filterBlock> Filters { get; set; }
|
2021-06-14 05:13:56 +00:00
|
|
|
}
|
2021-10-20 20:49:11 +00:00
|
|
|
|
|
|
|
public class responseBlock
|
|
|
|
{
|
|
|
|
public string Type { get; set; }
|
2021-10-24 23:00:19 +00:00
|
|
|
public string NoResultsMessage { get; set; }
|
2021-10-20 20:49:11 +00:00
|
|
|
}
|
2017-07-10 20:58:44 +00:00
|
|
|
}
|