mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Sort indexers once all are loaded
This commit is contained in:
@@ -23,6 +23,7 @@ namespace Jackett.Services
|
|||||||
void SaveConfig(IIndexer indexer, JToken obj);
|
void SaveConfig(IIndexer indexer, JToken obj);
|
||||||
void InitIndexers();
|
void InitIndexers();
|
||||||
void InitCardigannIndexers(string path);
|
void InitCardigannIndexers(string path);
|
||||||
|
void SortIndexers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IndexerManagerService : IIndexerManagerService
|
public class IndexerManagerService : IIndexerManagerService
|
||||||
@@ -203,5 +204,15 @@ namespace Jackett.Services
|
|||||||
logger.Error(string.Format("Error while moving {0} to {1}: {2}", configFilePathTmp, configFilePath, ex.ToString()));
|
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.InitCardigannIndexers(dir);
|
||||||
}
|
}
|
||||||
|
indexerService.SortIndexers();
|
||||||
client.Init();
|
client.Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user