diff --git a/MediaBrowser.Api/Movies/CollectionService.cs b/MediaBrowser.Api/Movies/CollectionService.cs index e6277e39a..ec3265b56 100644 --- a/MediaBrowser.Api/Movies/CollectionService.cs +++ b/MediaBrowser.Api/Movies/CollectionService.cs @@ -62,12 +62,15 @@ namespace MediaBrowser.Api.Movies public async Task Post(CreateCollection request) { + var userId = AuthorizationContext.GetAuthorizationInfo(Request).UserId; + var item = await _collectionManager.CreateCollection(new CollectionCreationOptions { IsLocked = request.IsLocked, Name = request.Name, ParentId = request.ParentId, - ItemIdList = (request.Ids ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(i => new Guid(i)).ToList() + ItemIdList = (request.Ids ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(i => new Guid(i)).ToList(), + UserIds = new List { new Guid(userId) } }).ConfigureAwait(false); diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index 13f83c0fc..a8a3e88ab 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -1426,6 +1426,46 @@ namespace MediaBrowser.Controller.Providers return null; } + protected Share GetShare(XmlReader reader) + { + reader.MoveToContent(); + + var item = new Share(); + + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element) + { + switch (reader.Name) + { + case "UserId": + { + item.UserId = reader.ReadElementContentAsString(); + break; + } + + case "CanEdit": + { + item.CanEdit = string.Equals(reader.ReadElementContentAsString(), "true", StringComparison.OrdinalIgnoreCase); + break; + } + + default: + reader.Skip(); + break; + } + } + } + + // This is valid + if (!string.IsNullOrWhiteSpace(item.UserId)) + { + return item; + } + + return null; + } + /// /// Used to split names of comma or pipe delimeted genres and people diff --git a/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs index a12724ff7..02457ee73 100644 --- a/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs @@ -50,6 +50,14 @@ namespace MediaBrowser.LocalMetadata.Parsers } break; + case "Shares": + + using (var subReader = reader.ReadSubtree()) + { + FetchFromSharesNode(subReader, item); + } + break; + default: base.FetchDataFromXmlNode(reader, item); break; @@ -92,5 +100,42 @@ namespace MediaBrowser.LocalMetadata.Parsers item.LinkedChildren = list; } + + private void FetchFromSharesNode(XmlReader reader, Playlist item) + { + reader.MoveToContent(); + + var list = new List(); + + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element) + { + switch (reader.Name) + { + case "Share": + { + using (var subReader = reader.ReadSubtree()) + { + var child = GetShare(subReader); + + if (child != null) + { + list.Add(child); + } + } + + break; + } + + default: + reader.Skip(); + break; + } + } + } + + item.Shares = list; + } } } diff --git a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs index 92327c9bc..69b78b5f1 100644 --- a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs +++ b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs @@ -38,10 +38,6 @@ namespace MediaBrowser.Providers.BoxSets list.AddRange(target.LinkedChildren.Where(i => i.Type == LinkedChildType.Manual)); target.LinkedChildren = list; - } - - if (replaceData || target.Shares.Count == 0) - { target.Shares = source.Shares; } } diff --git a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs index 2e407f10c..c53a89db7 100644 --- a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs +++ b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs @@ -33,14 +33,10 @@ namespace MediaBrowser.Providers.Playlists target.PlaylistMediaType = source.PlaylistMediaType; } - if (replaceData || target.Shares.Count == 0) - { - target.Shares = source.Shares; - } - if (mergeMetadataSettings) { target.LinkedChildren = source.LinkedChildren; + target.Shares = source.Shares; } } } diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs index faf73c059..796d5f651 100644 --- a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs +++ b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs @@ -81,7 +81,8 @@ namespace MediaBrowser.Server.Implementations.Collections ProviderIds = options.ProviderIds, Shares = options.UserIds.Select(i => new Share { - UserId = i.ToString("N") + UserId = i.ToString("N"), + CanEdit = true }).ToList() }; diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 009fc1187..9b608513f 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -803,6 +803,7 @@ "LabelMaxBitrateHelp": "Specify a max bitrate in bandwidth constrained environments, or if the device imposes it's own limit.", "LabelMaxStreamingBitrate": "Max streaming bitrate:", "LabelMaxStreamingBitrateHelp": "Specify a max bitrate when streaming.", + "LabelMaxChromecastBitrate": "Max Chromecast bitrate:", "LabelMaxStaticBitrate": "Max sync bitrate:", "LabelMaxStaticBitrateHelp": "Specify a max bitrate when syncing content at high quality.", "LabelMusicStaticBitrate": "Music sync bitrate:", diff --git a/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs b/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs index 24dc2cc1d..93a9bc8f6 100644 --- a/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs +++ b/MediaBrowser.Server.Implementations/UserViews/DynamicImageProvider.cs @@ -18,7 +18,7 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.UserViews { - public class DynamicImageProvider : BaseDynamicImageProvider, IPreRefreshProvider + public class DynamicImageProvider : BaseDynamicImageProvider { private readonly IUserManager _userManager; private readonly ILibraryManager _libraryManager;