diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-12-01 22:35:54 -0500 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-12-01 22:35:54 -0500 |
| commit | ee3212d39db6ad75b19d470a6959f122cec939e6 (patch) | |
| tree | 3058d466307987881e66009c2a3c878cfcaccbe7 | |
| parent | 93817bdb7bc8ffcdb854b3e5d47ac63228f881c1 (diff) | |
| parent | 10f9aaaee4d811578a1dc534adec7a6c1cd5cf1c (diff) | |
Merge pull request #1295 from MediaBrowser/master
merge from master
| -rw-r--r-- | MediaBrowser.Controller/IO/FileData.cs | 43 | ||||
| -rw-r--r-- | MediaBrowser.Providers/TV/TvdbSeriesProvider.cs | 7 |
2 files changed, 29 insertions, 21 deletions
diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index e2bdb28e3..ed5acbb3d 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -26,12 +26,12 @@ namespace MediaBrowser.Controller.IO /// <param name="resolveShortcuts">if set to <c>true</c> [resolve shortcuts].</param> /// <returns>Dictionary{System.StringFileSystemInfo}.</returns> /// <exception cref="System.ArgumentNullException">path</exception> - public static Dictionary<string, FileSystemMetadata> GetFilteredFileSystemEntries(IDirectoryService directoryService, - string path, - IFileSystem fileSystem, - ILogger logger, - ItemResolveArgs args, - int flattenFolderDepth = 0, + public static Dictionary<string, FileSystemMetadata> GetFilteredFileSystemEntries(IDirectoryService directoryService, + string path, + IFileSystem fileSystem, + ILogger logger, + ItemResolveArgs args, + int flattenFolderDepth = 0, bool resolveShortcuts = true) { if (string.IsNullOrEmpty(path)) @@ -60,22 +60,29 @@ namespace MediaBrowser.Controller.IO if (resolveShortcuts && fileSystem.IsShortcut(fullName)) { - var newPath = fileSystem.ResolveShortcut(fullName); - - if (string.IsNullOrWhiteSpace(newPath)) + try { - //invalid shortcut - could be old or target could just be unavailable - logger.Warn("Encountered invalid shortcut: " + fullName); - continue; - } + var newPath = fileSystem.ResolveShortcut(fullName); + + if (string.IsNullOrWhiteSpace(newPath)) + { + //invalid shortcut - could be old or target could just be unavailable + logger.Warn("Encountered invalid shortcut: " + fullName); + continue; + } - // Don't check if it exists here because that could return false for network shares. - var data = fileSystem.GetDirectoryInfo(newPath); + // Don't check if it exists here because that could return false for network shares. + var data = fileSystem.GetDirectoryInfo(newPath); - // add to our physical locations - args.AddAdditionalLocation(newPath); + // add to our physical locations + args.AddAdditionalLocation(newPath); - dict[newPath] = data; + dict[newPath] = data; + } + catch (Exception ex) + { + logger.ErrorException("Error resolving shortcut from {0}", ex, fullName); + } } else if (flattenFolderDepth > 0 && isDirectory) { diff --git a/MediaBrowser.Providers/TV/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TvdbSeriesProvider.cs index 16c009812..5df5151ca 100644 --- a/MediaBrowser.Providers/TV/TvdbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TvdbSeriesProvider.cs @@ -101,7 +101,7 @@ namespace MediaBrowser.Providers.TV result.Item = new Series(); result.HasMetadata = true; - FetchSeriesData(result, itemId.ProviderIds, cancellationToken); + FetchSeriesData(result, itemId.MetadataLanguage, itemId.ProviderIds, cancellationToken); await FindAnimeSeriesIndex(result.Item, itemId).ConfigureAwait(false); } @@ -140,10 +140,11 @@ namespace MediaBrowser.Providers.TV /// Fetches the series data. /// </summary> /// <param name="result">The result.</param> + /// <param name="metadataLanguage">The metadata language.</param> /// <param name="seriesProviderIds">The series provider ids.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{System.Boolean}.</returns> - private void FetchSeriesData(MetadataResult<Series> result, Dictionary<string, string> seriesProviderIds, CancellationToken cancellationToken) + private void FetchSeriesData(MetadataResult<Series> result, string metadataLanguage, Dictionary<string, string> seriesProviderIds, CancellationToken cancellationToken) { var series = result.Item; @@ -160,7 +161,7 @@ namespace MediaBrowser.Providers.TV var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds); - var seriesXmlFilename = series.GetPreferredMetadataLanguage().ToLower() + ".xml"; + var seriesXmlFilename = metadataLanguage.ToLower() + ".xml"; var seriesXmlPath = Path.Combine(seriesDataPath, seriesXmlFilename); var actorsXmlPath = Path.Combine(seriesDataPath, "actors.xml"); |
