diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-02-19 12:50:05 -0500 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-02-19 12:50:05 -0500 |
| commit | 8c09665c40776060a09655fb4ea04ec65bdffb73 (patch) | |
| tree | b1432a7315a7a7689be21fa2e3cc122350c778b2 /MediaBrowser.Server.Implementations/Library | |
| parent | 3cce8731614e6846096bbe54fca8336e7f5d98d9 (diff) | |
| parent | f2c3dade77878b48a9a333d745e5d92a0f913233 (diff) | |
Merge pull request #1016 from MediaBrowser/dev
3.0.5518.5
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library')
4 files changed, 28 insertions, 7 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index aac4c87f5..e6e6b8c74 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -401,7 +401,7 @@ namespace MediaBrowser.Server.Implementations.Library } catch (DirectoryNotFoundException) { - + } catch (Exception ex) { @@ -1489,6 +1489,23 @@ namespace MediaBrowser.Server.Implementations.Library return ItemRepository.RetrieveItem(id); } + public IEnumerable<Folder> GetCollectionFolders(BaseItem item) + { + while (!(item.Parent is AggregateFolder) && item.Parent != null) + { + item = item.Parent; + } + + if (item == null) + { + return new List<Folder>(); + } + + return GetUserRootFolder().Children + .OfType<Folder>() + .Where(i => string.Equals(i.Path, item.Path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(item.Path)); + } + public string GetContentType(BaseItem item) { string configuredContentType = GetConfiguredContentType(item, false); @@ -1547,7 +1564,7 @@ namespace MediaBrowser.Server.Implementations.Library } return null; } - + private string GetTopFolderContentType(BaseItem item) { while (!(item.Parent is AggregateFolder) && item.Parent != null) @@ -1840,7 +1857,7 @@ namespace MediaBrowser.Server.Implementations.Library options.VideoFileExtensions.Remove(".rar"); options.VideoFileExtensions.Remove(".zip"); } - + return options; } diff --git a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs index ed3503c1b..8cbb2eb1a 100644 --- a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs @@ -208,10 +208,11 @@ namespace MediaBrowser.Server.Implementations.Library }; } - public bool UpdatePlayState(BaseItem item, UserItemData data, long positionTicks) + public bool UpdatePlayState(BaseItem item, UserItemData data, long? reportedPositionTicks) { var playedToCompletion = false; + var positionTicks = reportedPositionTicks ?? item.RunTimeTicks ?? 0; var hasRuntime = item.RunTimeTicks.HasValue && item.RunTimeTicks > 0; // If a position has been reported, and if we know the duration diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index 8858abc10..59fecc857 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -402,15 +402,17 @@ namespace MediaBrowser.Server.Implementations.Library return dto; } - public UserDto GetOfflineUserDto(User user, string deviceId) + public UserDto GetOfflineUserDto(User user) { var dto = GetUserDto(user); var offlinePasswordHash = GetLocalPasswordHash(user); dto.HasPassword = !IsPasswordEmpty(offlinePasswordHash); + dto.OfflinePasswordSalt = Guid.NewGuid().ToString("N"); + // Hash the pin with the device Id to create a unique result for this device - dto.OfflinePassword = GetSha1String((offlinePasswordHash + deviceId).ToLower()); + dto.OfflinePassword = GetSha1String((offlinePasswordHash + dto.OfflinePasswordSalt).ToLower()); dto.ServerName = _appHost.FriendlyName; diff --git a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs index 2ec9e8a4f..a8ca1a2e0 100644 --- a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs @@ -86,7 +86,8 @@ namespace MediaBrowser.Server.Implementations.Library list.Add(await GetUserView(CollectionType.Movies, string.Empty, cancellationToken).ConfigureAwait(false)); } - if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Games, StringComparison.OrdinalIgnoreCase))) + if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Games, StringComparison.OrdinalIgnoreCase)) + || _config.Configuration.EnableLegacyCollectionInView) { list.Add(await GetUserView(CollectionType.Games, string.Empty, cancellationToken).ConfigureAwait(false)); } |
