diff options
Diffstat (limited to 'MediaBrowser.Api')
| -rw-r--r-- | MediaBrowser.Api/Images/ImageService.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Api/Session/SessionsService.cs | 17 |
2 files changed, 16 insertions, 11 deletions
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 72e4fe224..2b8ac1a66 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -315,7 +315,7 @@ namespace MediaBrowser.Api.Images return list; } - private ImageInfo GetImageInfo(IHasMetadata item, ItemImageInfo info, int? imageIndex) + private ImageInfo GetImageInfo(BaseItem item, ItemImageInfo info, int? imageIndex) { try { @@ -330,11 +330,17 @@ namespace MediaBrowser.Api.Images var fileInfo = _fileSystem.GetFileInfo(info.Path); length = fileInfo.Length; - var size = _imageProcessor.GetImageSize(info, true); + var size = _imageProcessor.GetImageSize(item, info, true, true); width = Convert.ToInt32(size.Width); height = Convert.ToInt32(size.Height); + if (width <= 0 || height <= 0) + { + width = null; + height = null; + } + } } catch diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs index 8f54b591e..e961f9d51 100644 --- a/MediaBrowser.Api/Session/SessionsService.cs +++ b/MediaBrowser.Api/Session/SessionsService.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.Services; +using MediaBrowser.Controller; namespace MediaBrowser.Api.Session { @@ -293,15 +294,9 @@ namespace MediaBrowser.Api.Session private readonly IAuthenticationRepository _authRepo; private readonly IDeviceManager _deviceManager; private readonly ISessionContext _sessionContext; + private IServerApplicationHost _appHost; - /// <summary> - /// Initializes a new instance of the <see cref="SessionsService" /> class. - /// </summary> - /// <param name="sessionManager">The session manager.</param> - /// <param name="userManager">The user manager.</param> - /// <param name="authContext">The authentication context.</param> - /// <param name="authRepo">The authentication repo.</param> - public SessionsService(ISessionManager sessionManager, IUserManager userManager, IAuthorizationContext authContext, IAuthenticationRepository authRepo, IDeviceManager deviceManager, ISessionContext sessionContext) + public SessionsService(ISessionManager sessionManager, IServerApplicationHost appHost, IUserManager userManager, IAuthorizationContext authContext, IAuthenticationRepository authRepo, IDeviceManager deviceManager, ISessionContext sessionContext) { _sessionManager = sessionManager; _userManager = userManager; @@ -309,6 +304,7 @@ namespace MediaBrowser.Api.Session _authRepo = authRepo; _deviceManager = deviceManager; _sessionContext = sessionContext; + _appHost = appHost; } public void Delete(RevokeKey request) @@ -324,7 +320,10 @@ namespace MediaBrowser.Api.Session AppName = request.App, IsActive = true, AccessToken = Guid.NewGuid().ToString("N"), - DateCreated = DateTime.UtcNow + DateCreated = DateTime.UtcNow, + DeviceId = _appHost.SystemId, + DeviceName = _appHost.FriendlyName, + AppVersion = _appHost.ApplicationVersion.ToString() }, CancellationToken.None); } |
