mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 06:17:14 -04:00
Remove some junk from series provider
This commit is contained in:
parent
c2202be0f8
commit
19b6808602
@ -31,23 +31,17 @@ namespace MediaBrowser.Providers.TV.TheTVDB
|
|||||||
{
|
{
|
||||||
internal static TvdbSeriesProvider Current { get; private set; }
|
internal static TvdbSeriesProvider Current { get; private set; }
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
private readonly IFileSystem _fileSystem;
|
|
||||||
private readonly IXmlReaderSettingsFactory _xmlSettings;
|
|
||||||
private readonly IServerConfigurationManager _config;
|
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly ILocalizationManager _localizationManager;
|
private readonly ILocalizationManager _localizationManager;
|
||||||
private readonly TvDbClient _tvDbClient;
|
private readonly TvDbClient _tvDbClient;
|
||||||
|
|
||||||
public TvdbSeriesProvider(IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager config, ILogger logger, ILibraryManager libraryManager, IXmlReaderSettingsFactory xmlSettings, ILocalizationManager localizationManager)
|
public TvdbSeriesProvider(IHttpClient httpClient, ILogger logger, ILibraryManager libraryManager, ILocalizationManager localizationManager)
|
||||||
{
|
{
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_fileSystem = fileSystem;
|
|
||||||
_config = config;
|
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_xmlSettings = xmlSettings;
|
|
||||||
_localizationManager = localizationManager;
|
_localizationManager = localizationManager;
|
||||||
Current = this;
|
Current = this;
|
||||||
_tvDbClient = new TvDbClient();
|
_tvDbClient = new TvDbClient();
|
||||||
@ -179,45 +173,46 @@ namespace MediaBrowser.Providers.TV.TheTVDB
|
|||||||
// TODO caching
|
// TODO caching
|
||||||
private bool IsCacheValid(string seriesDataPath, string preferredMetadataLanguage)
|
private bool IsCacheValid(string seriesDataPath, string preferredMetadataLanguage)
|
||||||
{
|
{
|
||||||
try
|
return true;
|
||||||
{
|
// try
|
||||||
var files = _fileSystem.GetFiles(seriesDataPath, new[] { ".xml" }, true, false)
|
// {
|
||||||
.ToList();
|
// var files = _fileSystem.GetFiles(seriesDataPath, new[] { ".xml" }, true, false)
|
||||||
|
// .ToList();
|
||||||
var seriesXmlFilename = preferredMetadataLanguage + ".xml";
|
//
|
||||||
|
// var seriesXmlFilename = preferredMetadataLanguage + ".xml";
|
||||||
const int cacheHours = 12;
|
//
|
||||||
|
// const int cacheHours = 12;
|
||||||
var seriesFile = files.FirstOrDefault(i => string.Equals(seriesXmlFilename, i.Name, StringComparison.OrdinalIgnoreCase));
|
//
|
||||||
// No need to check age if automatic updates are enabled
|
// var seriesFile = files.FirstOrDefault(i => string.Equals(seriesXmlFilename, i.Name, StringComparison.OrdinalIgnoreCase));
|
||||||
if (seriesFile == null || !seriesFile.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(seriesFile)).TotalHours > cacheHours)
|
// // No need to check age if automatic updates are enabled
|
||||||
{
|
// if (seriesFile == null || !seriesFile.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(seriesFile)).TotalHours > cacheHours)
|
||||||
return false;
|
// {
|
||||||
}
|
// return false;
|
||||||
|
// }
|
||||||
var actorsXml = files.FirstOrDefault(i => string.Equals("actors.xml", i.Name, StringComparison.OrdinalIgnoreCase));
|
//
|
||||||
// No need to check age if automatic updates are enabled
|
// var actorsXml = files.FirstOrDefault(i => string.Equals("actors.xml", i.Name, StringComparison.OrdinalIgnoreCase));
|
||||||
if (actorsXml == null || !actorsXml.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(actorsXml)).TotalHours > cacheHours)
|
// // No need to check age if automatic updates are enabled
|
||||||
{
|
// if (actorsXml == null || !actorsXml.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(actorsXml)).TotalHours > cacheHours)
|
||||||
return false;
|
// {
|
||||||
}
|
// return false;
|
||||||
|
// }
|
||||||
var bannersXml = files.FirstOrDefault(i => string.Equals("banners.xml", i.Name, StringComparison.OrdinalIgnoreCase));
|
//
|
||||||
// No need to check age if automatic updates are enabled
|
// var bannersXml = files.FirstOrDefault(i => string.Equals("banners.xml", i.Name, StringComparison.OrdinalIgnoreCase));
|
||||||
if (bannersXml == null || !bannersXml.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(bannersXml)).TotalHours > cacheHours)
|
// // No need to check age if automatic updates are enabled
|
||||||
{
|
// if (bannersXml == null || !bannersXml.Exists || (DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(bannersXml)).TotalHours > cacheHours)
|
||||||
return false;
|
// {
|
||||||
}
|
// return false;
|
||||||
return true;
|
// }
|
||||||
}
|
// return true;
|
||||||
catch (FileNotFoundException)
|
// }
|
||||||
{
|
// catch (FileNotFoundException)
|
||||||
return false;
|
// {
|
||||||
}
|
// return false;
|
||||||
catch (IOException)
|
// }
|
||||||
{
|
// catch (IOException)
|
||||||
return false;
|
// {
|
||||||
}
|
// return false;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user