mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
id: nostalgic
|
id: vhstapes
|
||||||
name: VHSTAPES
|
name: VHSTAPES
|
||||||
description: "VHSTAPES (The Archive / Nostalgic) is a Private Torrent Tracker for MOVIES / TV / GENERAL NOSTALGIA"
|
description: "VHSTAPES (The Archive / Nostalgic) is a Private Torrent Tracker for MOVIES / TV / GENERAL NOSTALGIA"
|
||||||
language: en-us
|
language: en-us
|
@@ -33,7 +33,7 @@ namespace Jackett.Common.Services
|
|||||||
|
|
||||||
public void Delete(IIndexer indexer)
|
public void Delete(IIndexer indexer)
|
||||||
{
|
{
|
||||||
var configFilePath = GetIndexerConfigFilePath(indexer);
|
var configFilePath = GetIndexerConfigFilePath(indexer.Id);
|
||||||
File.Delete(configFilePath);
|
File.Delete(configFilePath);
|
||||||
var configFilePathBak = configFilePath + ".bak";
|
var configFilePathBak = configFilePath + ".bak";
|
||||||
if (File.Exists(configFilePathBak))
|
if (File.Exists(configFilePathBak))
|
||||||
@@ -42,20 +42,20 @@ namespace Jackett.Common.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Load(IIndexer idx)
|
public void Load(IIndexer indexer)
|
||||||
{
|
{
|
||||||
var configFilePath = GetIndexerConfigFilePath(idx);
|
var configFilePath = GetIndexerConfigFilePath(indexer.Id);
|
||||||
if (File.Exists(configFilePath))
|
if (File.Exists(configFilePath))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var fileStr = File.ReadAllText(configFilePath);
|
var fileStr = File.ReadAllText(configFilePath);
|
||||||
var jsonString = JToken.Parse(fileStr);
|
var jsonString = JToken.Parse(fileStr);
|
||||||
idx.LoadFromSavedConfiguration(jsonString);
|
indexer.LoadFromSavedConfiguration(jsonString);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.Error(ex, "Failed loading configuration for {0}, trying backup", idx.DisplayName);
|
logger.Error(ex, "Failed loading configuration for {0}, trying backup", indexer.DisplayName);
|
||||||
var configFilePathBak = configFilePath + ".bak";
|
var configFilePathBak = configFilePath + ".bak";
|
||||||
if (File.Exists(configFilePathBak))
|
if (File.Exists(configFilePathBak))
|
||||||
{
|
{
|
||||||
@@ -63,18 +63,18 @@ namespace Jackett.Common.Services
|
|||||||
{
|
{
|
||||||
var fileStrBak = File.ReadAllText(configFilePathBak);
|
var fileStrBak = File.ReadAllText(configFilePathBak);
|
||||||
var jsonStringBak = JToken.Parse(fileStrBak);
|
var jsonStringBak = JToken.Parse(fileStrBak);
|
||||||
idx.LoadFromSavedConfiguration(jsonStringBak);
|
indexer.LoadFromSavedConfiguration(jsonStringBak);
|
||||||
logger.Info("Successfully loaded backup config for {0}", idx.DisplayName);
|
logger.Info("Successfully loaded backup config for {0}", indexer.DisplayName);
|
||||||
idx.SaveConfig();
|
indexer.SaveConfig();
|
||||||
}
|
}
|
||||||
catch (Exception exbak)
|
catch (Exception exbak)
|
||||||
{
|
{
|
||||||
logger.Error(exbak, "Failed loading backup configuration for {0}, you must reconfigure this indexer", idx.DisplayName);
|
logger.Error(exbak, "Failed loading backup configuration for {0}, you must reconfigure this indexer", indexer.DisplayName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logger.Error(ex, "Failed loading backup configuration for {0} (no backup available), you must reconfigure this indexer", idx.DisplayName);
|
logger.Error(ex, "Failed loading backup configuration for {0} (no backup available), you must reconfigure this indexer", indexer.DisplayName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ namespace Jackett.Common.Services
|
|||||||
lock (configWriteLock)
|
lock (configWriteLock)
|
||||||
{
|
{
|
||||||
var uID = Guid.NewGuid().ToString("N");
|
var uID = Guid.NewGuid().ToString("N");
|
||||||
var configFilePath = GetIndexerConfigFilePath(indexer);
|
var configFilePath = GetIndexerConfigFilePath(indexer.Id);
|
||||||
var configFilePathBak = configFilePath + ".bak";
|
var configFilePathBak = configFilePath + ".bak";
|
||||||
var configFilePathTmp = configFilePath + "." + uID + ".tmp";
|
var configFilePathTmp = configFilePath + "." + uID + ".tmp";
|
||||||
var content = obj.ToString();
|
var content = obj.ToString();
|
||||||
@@ -141,7 +141,8 @@ namespace Jackett.Common.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetIndexerConfigFilePath(IIndexer indexer) => Path.Combine(configService.GetIndexerConfigDir(), indexer.Id + ".json");
|
public string GetIndexerConfigFilePath(string indexerId)
|
||||||
|
=> Path.Combine(configService.GetIndexerConfigDir(), indexerId + ".json");
|
||||||
|
|
||||||
private readonly IConfigurationService configService;
|
private readonly IConfigurationService configService;
|
||||||
private readonly Logger logger;
|
private readonly Logger logger;
|
||||||
|
@@ -30,6 +30,15 @@ namespace Jackett.Common.Services
|
|||||||
private readonly Dictionary<string, IIndexer> indexers = new Dictionary<string, IIndexer>();
|
private readonly Dictionary<string, IIndexer> indexers = new Dictionary<string, IIndexer>();
|
||||||
private AggregateIndexer aggregateIndexer;
|
private AggregateIndexer aggregateIndexer;
|
||||||
|
|
||||||
|
// this map is used to maintain backward compatibility when renaming the id of an indexer
|
||||||
|
// (the id is used in the torznab/download/search urls and in the indexer configuration file)
|
||||||
|
// if the indexer is removed, remove it from this list too
|
||||||
|
// use: {"<old id>", "<new id>"}
|
||||||
|
private readonly Dictionary<string, string> renamedIndexers = new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{"nostalgic", "vhstapes"}
|
||||||
|
};
|
||||||
|
|
||||||
public IndexerManagerService(IIndexerConfigurationService config, IProtectionService protectionService, WebClient webClient, Logger l, ICacheService cache, IProcessService processService, IConfigurationService globalConfigService, ServerConfig serverConfig)
|
public IndexerManagerService(IIndexerConfigurationService config, IProtectionService protectionService, WebClient webClient, Logger l, ICacheService cache, IProcessService processService, IConfigurationService globalConfigService, ServerConfig serverConfig)
|
||||||
{
|
{
|
||||||
configService = config;
|
configService = config;
|
||||||
@@ -44,11 +53,29 @@ namespace Jackett.Common.Services
|
|||||||
|
|
||||||
public void InitIndexers(IEnumerable<string> path)
|
public void InitIndexers(IEnumerable<string> path)
|
||||||
{
|
{
|
||||||
|
MigrateRenamedIndexers();
|
||||||
InitIndexers();
|
InitIndexers();
|
||||||
InitCardigannIndexers(path);
|
InitCardigannIndexers(path);
|
||||||
InitAggregateIndexer();
|
InitAggregateIndexer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MigrateRenamedIndexers()
|
||||||
|
{
|
||||||
|
foreach (var oldId in renamedIndexers.Keys)
|
||||||
|
{
|
||||||
|
var oldPath = configService.GetIndexerConfigFilePath(oldId);
|
||||||
|
if (File.Exists(oldPath))
|
||||||
|
{
|
||||||
|
// if the old configuration exists, we rename it to be used by the renamed indexer
|
||||||
|
var newPath = configService.GetIndexerConfigFilePath(renamedIndexers[oldId]);
|
||||||
|
File.Move(oldPath, newPath);
|
||||||
|
if (File.Exists(oldPath + ".bak"))
|
||||||
|
File.Move(oldPath + ".bak", newPath + ".bak");
|
||||||
|
logger.Info($"Configuration renamed: {oldPath} => {newPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void InitIndexers()
|
private void InitIndexers()
|
||||||
{
|
{
|
||||||
logger.Info("Using HTTP Client: " + webClient.GetType().Name);
|
logger.Info("Using HTTP Client: " + webClient.GetType().Name);
|
||||||
@@ -179,19 +206,24 @@ namespace Jackett.Common.Services
|
|||||||
|
|
||||||
public IIndexer GetIndexer(string name)
|
public IIndexer GetIndexer(string name)
|
||||||
{
|
{
|
||||||
if (indexers.ContainsKey(name))
|
// old id of renamed indexer is used to maintain backward compatibility
|
||||||
|
// both, the old id and the new one can be used until we remove it from renamedIndexers
|
||||||
|
var realName = name;
|
||||||
|
if (renamedIndexers.ContainsKey(name))
|
||||||
{
|
{
|
||||||
return indexers[name];
|
realName = renamedIndexers[name];
|
||||||
|
logger.Warn($"Indexer {name} has been renamed to {realName}. Please, update the URL of the feeds. " +
|
||||||
|
"This may stop working in the future.");
|
||||||
}
|
}
|
||||||
else if (name == "all")
|
|
||||||
{
|
if (indexers.ContainsKey(realName))
|
||||||
|
return indexers[realName];
|
||||||
|
|
||||||
|
if (realName == "all")
|
||||||
return aggregateIndexer;
|
return aggregateIndexer;
|
||||||
}
|
|
||||||
else
|
logger.Error("Request for unknown indexer: " + realName);
|
||||||
{
|
throw new Exception("Unknown indexer: " + realName);
|
||||||
logger.Error("Request for unknown indexer: " + name);
|
|
||||||
throw new Exception("Unknown indexer: " + name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IWebIndexer GetWebIndexer(string name)
|
public IWebIndexer GetWebIndexer(string name)
|
||||||
|
@@ -8,5 +8,6 @@ namespace Jackett.Common.Services.Interfaces
|
|||||||
void Load(IIndexer indexer);
|
void Load(IIndexer indexer);
|
||||||
void Save(IIndexer indexer, JToken config);
|
void Save(IIndexer indexer, JToken config);
|
||||||
void Delete(IIndexer indexer);
|
void Delete(IIndexer indexer);
|
||||||
|
string GetIndexerConfigFilePath(string indexerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -337,6 +337,7 @@ namespace Jackett.Updater
|
|||||||
"Definitions/music-master.yml",
|
"Definitions/music-master.yml",
|
||||||
"Definitions/nachtwerk.yml",
|
"Definitions/nachtwerk.yml",
|
||||||
"Definitions/nexttorrent.yml",
|
"Definitions/nexttorrent.yml",
|
||||||
|
"Definitions/nostalgic.yml",
|
||||||
"Definitions/nyaa.yml",
|
"Definitions/nyaa.yml",
|
||||||
"Definitions/nyoo.yml",
|
"Definitions/nyoo.yml",
|
||||||
"Definitions/passionetorrent.yml",
|
"Definitions/passionetorrent.yml",
|
||||||
|
Reference in New Issue
Block a user