#712 - Support grouping multiple versions of a movie

This commit is contained in:
Luke Pulverenti
2014-03-16 00:23:58 -04:00
parent 4e6d306d00
commit b36aea4ff7
12 changed files with 216 additions and 38 deletions

View File

@@ -111,6 +111,7 @@ namespace MediaBrowser.Server.Implementations.Collections
}
var list = new List<LinkedChild>();
var currentLinkedChildren = collection.GetLinkedChildren().ToList();
foreach (var itemId in ids)
{
@@ -121,7 +122,7 @@ namespace MediaBrowser.Server.Implementations.Collections
throw new ArgumentException("No item exists with the supplied Id");
}
if (collection.LinkedChildren.Any(i => i.ItemId.HasValue && i.ItemId == itemId))
if (currentLinkedChildren.Any(i => i.Id == itemId))
{
throw new ArgumentException("Item already exists in collection");
}

View File

@@ -1082,7 +1082,12 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.IsHD = video.IsHD;
dto.PartCount = video.AdditionalPartIds.Count + 1;
dto.HasAlternateVersions = video.HasAlternateVersions;
dto.AlternateVersionCount = video.AlternateVersionCount;
if (video.PrimaryVersionId.HasValue)
{
dto.PrimaryVersionId = video.PrimaryVersionId.Value.ToString("N");
}
if (fields.Contains(ItemFields.Chapters))
{

View File

@@ -410,7 +410,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
if (!string.IsNullOrWhiteSpace(filenamePrefix))
{
if (sortedMovies.All(i => Path.GetFileNameWithoutExtension(i.Path).StartsWith(filenamePrefix, StringComparison.OrdinalIgnoreCase)))
if (sortedMovies.Skip(1).All(i => Path.GetFileNameWithoutExtension(i.Path).StartsWith(filenamePrefix + " - ", StringComparison.OrdinalIgnoreCase)))
{
firstMovie.HasLocalAlternateVersions = true;

View File

@@ -690,6 +690,11 @@ namespace MediaBrowser.Server.Implementations.Session
}
}
if (session.UserId.HasValue)
{
command.ControllingUserId = session.UserId.Value.ToString("N");
}
return session.SessionController.SendPlayCommand(command, cancellationToken);
}
@@ -723,6 +728,11 @@ namespace MediaBrowser.Server.Implementations.Session
throw new ArgumentException(string.Format("Session {0} is unable to seek.", session.Id));
}
if (session.UserId.HasValue)
{
command.ControllingUserId = session.UserId.Value.ToString("N");
}
return session.SessionController.SendPlaystateCommand(command, cancellationToken);
}