mirror of
https://github.com/Jackett/Jackett
synced 2025-02-25 07:32:38 +00:00
Sort indexers once all are loaded
This commit is contained in:
parent
c38a2533e1
commit
412df7c6f6
2 changed files with 13 additions and 1 deletions
|
@ -23,6 +23,7 @@ namespace Jackett.Services
|
|||
void SaveConfig(IIndexer indexer, JToken obj);
|
||||
void InitIndexers();
|
||||
void InitCardigannIndexers(string path);
|
||||
void SortIndexers();
|
||||
}
|
||||
|
||||
public class IndexerManagerService : IIndexerManagerService
|
||||
|
@ -202,6 +203,16 @@ namespace Jackett.Services
|
|||
{
|
||||
logger.Error(string.Format("Error while moving {0} to {1}: {2}", configFilePathTmp, configFilePath, ex.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SortIndexers()
|
||||
{
|
||||
// Apparently Dictionary are ordered but can't be sorted again
|
||||
// This will recreate the indexers Dictionary to workaround this limitation
|
||||
Dictionary<string, IIndexer> newIndexers = new Dictionary<string, IIndexer>();
|
||||
foreach (var indexer in indexers.OrderBy(_ => _.Value.DisplayName))
|
||||
newIndexers.Add(indexer.Key, indexer.Value);
|
||||
indexers = newIndexers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,6 +154,7 @@ namespace Jackett.Services
|
|||
{
|
||||
indexerService.InitCardigannIndexers(dir);
|
||||
}
|
||||
indexerService.SortIndexers();
|
||||
client.Init();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue