Skip to content

Commit

Permalink
New: (AudioBookBay) Migrate to C#
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan committed Feb 17, 2023
1 parent f03a64f commit c923982
Show file tree
Hide file tree
Showing 2 changed files with 367 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ public class IndexerDefinitionUpdateService : IIndexerDefinitionUpdateService, I
private const string DEFINITION_BRANCH = "master";
private const int DEFINITION_VERSION = 8;

//Used when moving yml to C#
private readonly List<string> _defintionBlocklist = new List<string>()
// Used when moving yml to C#
private readonly List<string> _definitionBlocklist = new ()
{
"aither",
"animeworld",
"audiobookbay",
"beyond-hd-oneurl",
"beyond-hd",
"blutopia",
Expand Down Expand Up @@ -89,7 +90,7 @@ public List<CardigannMetaDefinition> All()
{
var request = new HttpRequest($"https://indexers.prowlarr.com/{DEFINITION_BRANCH}/{DEFINITION_VERSION}");
var response = _httpClient.Get<List<CardigannMetaDefinition>>(request);
indexerList = response.Resource.Where(i => !_defintionBlocklist.Contains(i.File)).ToList();
indexerList = response.Resource.Where(i => !_definitionBlocklist.Contains(i.File)).ToList();
}
catch
{
Expand Down Expand Up @@ -125,7 +126,7 @@ public CardigannDefinition GetCachedDefinition(string fileKey)

public List<string> GetBlocklist()
{
return _defintionBlocklist;
return _definitionBlocklist;
}

private List<CardigannMetaDefinition> ReadDefinitionsFromDisk(List<CardigannMetaDefinition> defs, string path, SearchOption options = SearchOption.TopDirectoryOnly)
Expand Down Expand Up @@ -227,10 +228,10 @@ private CardigannDefinition CleanIndexerDefinition(CardigannDefinition definitio
if (definition.Settings == null)
{
definition.Settings = new List<SettingsField>
{
new SettingsField { Name = "username", Label = "Username", Type = "text" },
new SettingsField { Name = "password", Label = "Password", Type = "password" }
};
{
new () { Name = "username", Label = "Username", Type = "text" },
new () { Name = "password", Label = "Password", Type = "password" }
};
}

if (definition.Encoding == null)
Expand Down

0 comments on commit c923982

Please sign in to comment.