Jelajahi Sumber

update MovieDbPersonProvider

Luke Pulverenti 9 tahun lalu
induk
melakukan
d5a4a9424f
1 mengubah file dengan 17 tambahan dan 4 penghapusan
  1. 17 4
      MediaBrowser.Providers/People/MovieDbPersonProvider.cs

+ 17 - 4
MediaBrowser.Providers/People/MovieDbPersonProvider.cs

@@ -18,6 +18,7 @@ using System.Net;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using CommonIO;
 using CommonIO;
+using MediaBrowser.Model.Net;
 
 
 namespace MediaBrowser.Providers.People
 namespace MediaBrowser.Providers.People
 {
 {
@@ -68,7 +69,7 @@ namespace MediaBrowser.Providers.People
                     Name = info.name,
                     Name = info.name,
 
 
                     SearchProviderName = Name,
                     SearchProviderName = Name,
-                    
+
                     ImageUrl = images.Count == 0 ? null : (tmdbImageUrl + images[0].file_path)
                     ImageUrl = images.Count == 0 ? null : (tmdbImageUrl + images[0].file_path)
                 };
                 };
 
 
@@ -100,7 +101,7 @@ namespace MediaBrowser.Providers.People
             var result = new RemoteSearchResult
             var result = new RemoteSearchResult
             {
             {
                 SearchProviderName = Name,
                 SearchProviderName = Name,
-                
+
                 Name = i.Name,
                 Name = i.Name,
 
 
                 ImageUrl = string.IsNullOrEmpty(i.Profile_Path) ? null : (baseImageUrl + i.Profile_Path)
                 ImageUrl = string.IsNullOrEmpty(i.Profile_Path) ? null : (baseImageUrl + i.Profile_Path)
@@ -125,7 +126,19 @@ namespace MediaBrowser.Providers.People
 
 
             if (!string.IsNullOrEmpty(tmdbId))
             if (!string.IsNullOrEmpty(tmdbId))
             {
             {
-                await EnsurePersonInfo(tmdbId, cancellationToken).ConfigureAwait(false);
+                try
+                {
+                    await EnsurePersonInfo(tmdbId, cancellationToken).ConfigureAwait(false);
+                }
+                catch (HttpException ex)
+                {
+                    if (ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.NotFound)
+                    {
+                        return result;
+                    }
+
+                    throw;
+                }
 
 
                 var dataFilePath = GetPersonDataFilePath(_configurationManager.ApplicationPaths, tmdbId);
                 var dataFilePath = GetPersonDataFilePath(_configurationManager.ApplicationPaths, tmdbId);
 
 
@@ -201,7 +214,7 @@ namespace MediaBrowser.Providers.People
 
 
             }).ConfigureAwait(false))
             }).ConfigureAwait(false))
             {
             {
-				_fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
+                _fileSystem.CreateDirectory(Path.GetDirectoryName(dataFilePath));
 
 
                 using (var fs = _fileSystem.GetFileStream(dataFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, true))
                 using (var fs = _fileSystem.GetFileStream(dataFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, true))
                 {
                 {