mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
auto-organize fixes
This commit is contained in:
parent
3b7afe85e5
commit
22377f2516
@ -27,6 +27,11 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
public static TvdbSeasonIdentity? ParseIdentity(string id)
|
public static TvdbSeasonIdentity? ParseIdentity(string id)
|
||||||
{
|
{
|
||||||
|
if (id == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var parts = id.Split(':');
|
var parts = id.Split(':');
|
||||||
|
@ -160,19 +160,19 @@ namespace MediaBrowser.Providers.TV
|
|||||||
var series = result.Item;
|
var series = result.Item;
|
||||||
|
|
||||||
string id;
|
string id;
|
||||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id))
|
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id) && !string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
series.SetProviderId(MetadataProviders.Tvdb, id);
|
series.SetProviderId(MetadataProviders.Tvdb, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id))
|
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id) && !string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
series.SetProviderId(MetadataProviders.Imdb, id);
|
series.SetProviderId(MetadataProviders.Imdb, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
||||||
|
|
||||||
var seriesXmlPath = GetSeriesXmlPath (seriesProviderIds, metadataLanguage);
|
var seriesXmlPath = GetSeriesXmlPath(seriesProviderIds, metadataLanguage);
|
||||||
var actorsXmlPath = Path.Combine(seriesDataPath, "actors.xml");
|
var actorsXmlPath = Path.Combine(seriesDataPath, "actors.xml");
|
||||||
|
|
||||||
FetchSeriesInfo(series, seriesXmlPath, cancellationToken);
|
FetchSeriesInfo(series, seriesXmlPath, cancellationToken);
|
||||||
@ -320,7 +320,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
internal static bool IsValidSeries(Dictionary<string, string> seriesProviderIds)
|
internal static bool IsValidSeries(Dictionary<string, string> seriesProviderIds)
|
||||||
{
|
{
|
||||||
string id;
|
string id;
|
||||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id))
|
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id) && !string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
// This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet.
|
// This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet.
|
||||||
if (!string.IsNullOrWhiteSpace(id))
|
if (!string.IsNullOrWhiteSpace(id))
|
||||||
@ -329,7 +329,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id))
|
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id) && !string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
// This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet.
|
// This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet.
|
||||||
if (!string.IsNullOrWhiteSpace(id))
|
if (!string.IsNullOrWhiteSpace(id))
|
||||||
@ -340,7 +340,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SemaphoreSlim _ensureSemaphore = new SemaphoreSlim(1,1);
|
private SemaphoreSlim _ensureSemaphore = new SemaphoreSlim(1, 1);
|
||||||
internal async Task<string> EnsureSeriesInfo(Dictionary<string, string> seriesProviderIds, string preferredMetadataLanguage, CancellationToken cancellationToken)
|
internal async Task<string> EnsureSeriesInfo(Dictionary<string, string> seriesProviderIds, string preferredMetadataLanguage, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await _ensureSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
await _ensureSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||||
@ -348,7 +348,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string seriesId;
|
string seriesId;
|
||||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId))
|
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId))
|
||||||
{
|
{
|
||||||
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
return seriesDataPath;
|
return seriesDataPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId))
|
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId))
|
||||||
{
|
{
|
||||||
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
||||||
|
|
||||||
@ -1300,14 +1300,14 @@ namespace MediaBrowser.Providers.TV
|
|||||||
internal static string GetSeriesDataPath(IApplicationPaths appPaths, Dictionary<string, string> seriesProviderIds)
|
internal static string GetSeriesDataPath(IApplicationPaths appPaths, Dictionary<string, string> seriesProviderIds)
|
||||||
{
|
{
|
||||||
string seriesId;
|
string seriesId;
|
||||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId))
|
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId))
|
||||||
{
|
{
|
||||||
var seriesDataPath = Path.Combine(GetSeriesDataPath(appPaths), seriesId);
|
var seriesDataPath = Path.Combine(GetSeriesDataPath(appPaths), seriesId);
|
||||||
|
|
||||||
return seriesDataPath;
|
return seriesDataPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId))
|
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId))
|
||||||
{
|
{
|
||||||
var seriesDataPath = Path.Combine(GetSeriesDataPath(appPaths), seriesId);
|
var seriesDataPath = Path.Combine(GetSeriesDataPath(appPaths), seriesId);
|
||||||
|
|
||||||
@ -1317,14 +1317,14 @@ namespace MediaBrowser.Providers.TV
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetSeriesXmlPath(Dictionary<string, string> seriesProviderIds, string language)
|
public string GetSeriesXmlPath(Dictionary<string, string> seriesProviderIds, string language)
|
||||||
{
|
{
|
||||||
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
||||||
|
|
||||||
var seriesXmlFilename = language.ToLower() + ".xml";
|
var seriesXmlFilename = language.ToLower() + ".xml";
|
||||||
|
|
||||||
return Path.Combine (seriesDataPath, seriesXmlFilename);
|
return Path.Combine(seriesDataPath, seriesXmlFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the series data path.
|
/// Gets the series data path.
|
||||||
|
@ -84,7 +84,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Error organizing episode {0}", ex, file);
|
_logger.ErrorException("Error organizing episode {0}", ex, file.FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
numComplete++;
|
numComplete++;
|
||||||
@ -132,7 +132,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _fileSystem.GetFiles(path, true)
|
return _fileSystem.GetFiles(path, true)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
@ -150,7 +150,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||||||
/// <param name="extensions">The extensions.</param>
|
/// <param name="extensions">The extensions.</param>
|
||||||
private void DeleteLeftOverFiles(string path, IEnumerable<string> extensions)
|
private void DeleteLeftOverFiles(string path, IEnumerable<string> extensions)
|
||||||
{
|
{
|
||||||
var eligibleFiles = _fileSystem.GetFiles(path, true)
|
var eligibleFiles = _fileSystem.GetFiles(path, true)
|
||||||
.Where(i => extensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase))
|
.Where(i => extensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user