diff --git a/src/Jackett/Services/IndexerManagerService.cs b/src/Jackett/Services/IndexerManagerService.cs index 911ed2120..82c7e436a 100644 --- a/src/Jackett/Services/IndexerManagerService.cs +++ b/src/Jackett/Services/IndexerManagerService.cs @@ -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 newIndexers = new Dictionary(); + foreach (var indexer in indexers.OrderBy(_ => _.Value.DisplayName)) + newIndexers.Add(indexer.Key, indexer.Value); + indexers = newIndexers; + } } } diff --git a/src/Jackett/Services/ServerService.cs b/src/Jackett/Services/ServerService.cs index 86f1def81..fb86c62e9 100644 --- a/src/Jackett/Services/ServerService.cs +++ b/src/Jackett/Services/ServerService.cs @@ -154,6 +154,7 @@ namespace Jackett.Services { indexerService.InitCardigannIndexers(dir); } + indexerService.SortIndexers(); client.Init(); }