fixed for new collection creation
This commit is contained in:
parent
a7b32d4ec0
commit
6562824a84
|
@ -62,12 +62,15 @@ namespace MediaBrowser.Api.Movies
|
|||
|
||||
public async Task<object> 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<Guid> { new Guid(userId) }
|
||||
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to split names of comma or pipe delimeted genres and people
|
||||
|
|
|
@ -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<Share>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
};
|
||||
|
|
|
@ -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:",
|
||||
|
|
|
@ -18,7 +18,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace MediaBrowser.Server.Implementations.UserViews
|
||||
{
|
||||
public class DynamicImageProvider : BaseDynamicImageProvider<UserView>, IPreRefreshProvider
|
||||
public class DynamicImageProvider : BaseDynamicImageProvider<UserView>
|
||||
{
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
|
Loading…
Reference in New Issue
Block a user