mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
commit
087b9c6fd2
@ -340,7 +340,7 @@ namespace MediaBrowser.Api
|
||||
// We can really reduce the timeout for apps that are using the newer api
|
||||
if (!string.IsNullOrWhiteSpace(job.PlaySessionId))
|
||||
{
|
||||
timerDuration = 120000;
|
||||
timerDuration = 300000;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,6 +252,11 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
return (PersonIds ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
public string[] GetItemIds()
|
||||
{
|
||||
return (Ids ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
public VideoType[] GetVideoTypes()
|
||||
{
|
||||
var val = VideoTypes;
|
||||
@ -329,54 +334,12 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
|
||||
var result = await GetItemsToSerialize(request, user, parentItem).ConfigureAwait(false);
|
||||
|
||||
var isFiltered = result.Item2;
|
||||
var dtoOptions = GetDtoOptions(request);
|
||||
|
||||
if (isFiltered)
|
||||
{
|
||||
return new ItemsResult
|
||||
{
|
||||
TotalRecordCount = result.Item1.TotalRecordCount,
|
||||
Items = _dtoService.GetBaseItemDtos(result.Item1.Items, dtoOptions, user).ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
var items = result.Item1.Items.Where(i => ApplyAdditionalFilters(request, i, user, false, _libraryManager));
|
||||
|
||||
// Apply filters
|
||||
// Run them starting with the ones that are likely to reduce the list the most
|
||||
foreach (var filter in request.GetFilters().OrderByDescending(f => (int)f))
|
||||
{
|
||||
items = ApplyFilter(items, filter, user, _userDataRepository);
|
||||
}
|
||||
|
||||
items = UserViewBuilder.FilterVirtualEpisodes(items,
|
||||
request.IsMissing,
|
||||
request.IsVirtualUnaired,
|
||||
request.IsUnaired);
|
||||
|
||||
var internalQuery = GetItemsQuery(request, user);
|
||||
|
||||
items = UserViewBuilder.CollapseBoxSetItemsIfNeeded(items, internalQuery, parentItem, user);
|
||||
|
||||
items = _libraryManager.Sort(items, user, request.GetOrderBy(), request.SortOrder ?? SortOrder.Ascending);
|
||||
|
||||
// This must be the last filter
|
||||
if (!string.IsNullOrEmpty(request.AdjacentTo))
|
||||
{
|
||||
items = UserViewBuilder.FilterForAdjacency(items, request.AdjacentTo);
|
||||
}
|
||||
|
||||
var itemsArray = items.ToList();
|
||||
|
||||
var pagedItems = ApplyPaging(request, itemsArray);
|
||||
|
||||
var returnItems = _dtoService.GetBaseItemDtos(pagedItems, dtoOptions, user).ToArray();
|
||||
|
||||
return new ItemsResult
|
||||
{
|
||||
TotalRecordCount = itemsArray.Count,
|
||||
Items = returnItems
|
||||
TotalRecordCount = result.Item1.TotalRecordCount,
|
||||
Items = _dtoService.GetBaseItemDtos(result.Item1.Items, dtoOptions, user).ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
@ -394,45 +357,46 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
parentItem;
|
||||
|
||||
// Default list type = children
|
||||
IEnumerable<BaseItem> items;
|
||||
|
||||
if (!string.IsNullOrEmpty(request.Ids))
|
||||
{
|
||||
var idList = request.Ids.Split(',').ToList();
|
||||
request.Recursive = true;
|
||||
var result = await ((Folder)item).GetItems(GetItemsQuery(request, user)).ConfigureAwait(false);
|
||||
|
||||
items = idList.Select(i => _libraryManager.GetItemById(i));
|
||||
return new Tuple<QueryResult<BaseItem>, bool>(result, true);
|
||||
}
|
||||
|
||||
else if (request.Recursive)
|
||||
if (request.Recursive)
|
||||
{
|
||||
var result = await ((Folder)item).GetItems(GetItemsQuery(request, user)).ConfigureAwait(false);
|
||||
|
||||
return new Tuple<QueryResult<BaseItem>, bool>(result, true);
|
||||
}
|
||||
else
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
var result = await ((Folder)item).GetItems(GetItemsQuery(request, null)).ConfigureAwait(false);
|
||||
var result = await ((Folder)item).GetItems(GetItemsQuery(request, null)).ConfigureAwait(false);
|
||||
|
||||
return new Tuple<QueryResult<BaseItem>, bool>(result, true);
|
||||
}
|
||||
|
||||
var userRoot = item as UserRootFolder;
|
||||
|
||||
if (userRoot == null)
|
||||
{
|
||||
var result = await ((Folder)item).GetItems(GetItemsQuery(request, user)).ConfigureAwait(false);
|
||||
|
||||
return new Tuple<QueryResult<BaseItem>, bool>(result, true);
|
||||
}
|
||||
|
||||
items = ((Folder)item).GetChildren(user, true);
|
||||
return new Tuple<QueryResult<BaseItem>, bool>(result, true);
|
||||
}
|
||||
|
||||
var userRoot = item as UserRootFolder;
|
||||
|
||||
if (userRoot == null)
|
||||
{
|
||||
var result = await ((Folder)item).GetItems(GetItemsQuery(request, user)).ConfigureAwait(false);
|
||||
|
||||
return new Tuple<QueryResult<BaseItem>, bool>(result, true);
|
||||
}
|
||||
|
||||
IEnumerable<BaseItem> items = ((Folder)item).GetChildren(user, true);
|
||||
|
||||
var itemsArray = items.ToArray();
|
||||
|
||||
return new Tuple<QueryResult<BaseItem>, bool>(new QueryResult<BaseItem>
|
||||
{
|
||||
Items = items.ToArray()
|
||||
Items = itemsArray,
|
||||
TotalRecordCount = itemsArray.Length
|
||||
|
||||
}, false);
|
||||
}
|
||||
@ -450,7 +414,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
SortBy = request.GetOrderBy(),
|
||||
SortOrder = request.SortOrder ?? SortOrder.Ascending,
|
||||
|
||||
Filter = i => ApplyAdditionalFilters(request, i, user, true, _libraryManager),
|
||||
Filter = i => ApplyAdditionalFilters(request, i, user, _libraryManager),
|
||||
|
||||
Limit = request.Limit,
|
||||
StartIndex = request.StartIndex,
|
||||
@ -490,7 +454,12 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
Years = request.GetYears(),
|
||||
ImageTypes = request.GetImageTypes().ToArray(),
|
||||
VideoTypes = request.GetVideoTypes().ToArray(),
|
||||
AdjacentTo = request.AdjacentTo
|
||||
AdjacentTo = request.AdjacentTo,
|
||||
ItemIds = request.GetItemIds(),
|
||||
MinPlayers = request.MinPlayers,
|
||||
MaxPlayers = request.MaxPlayers,
|
||||
MinCommunityRating = request.MinCommunityRating,
|
||||
MinCriticRating = request.MinCriticRating
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.Ids))
|
||||
@ -619,440 +588,8 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
return items;
|
||||
}
|
||||
|
||||
private bool ApplyAdditionalFilters(GetItems request, BaseItem i, User user, bool isPreFiltered, ILibraryManager libraryManager)
|
||||
private bool ApplyAdditionalFilters(GetItems request, BaseItem i, User user, ILibraryManager libraryManager)
|
||||
{
|
||||
var video = i as Video;
|
||||
|
||||
if (!isPreFiltered)
|
||||
{
|
||||
var mediaTypes = request.GetMediaTypes();
|
||||
if (mediaTypes.Length > 0)
|
||||
{
|
||||
if (!(!string.IsNullOrEmpty(i.MediaType) && mediaTypes.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.IsPlayed.HasValue)
|
||||
{
|
||||
var val = request.IsPlayed.Value;
|
||||
if (i.IsPlayed(user) != val)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Exclude item types
|
||||
var excluteItemTypes = request.GetExcludeItemTypes();
|
||||
if (excluteItemTypes.Length > 0 && excluteItemTypes.Contains(i.GetType().Name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Include item types
|
||||
var includeItemTypes = request.GetIncludeItemTypes();
|
||||
if (includeItemTypes.Length > 0 && !includeItemTypes.Contains(i.GetType().Name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.IsInBoxSet.HasValue)
|
||||
{
|
||||
var val = request.IsInBoxSet.Value;
|
||||
if (i.Parents.OfType<BoxSet>().Any() != val)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter by Video3DFormat
|
||||
if (request.Is3D.HasValue)
|
||||
{
|
||||
var val = request.Is3D.Value;
|
||||
|
||||
if (video == null || val != video.Video3DFormat.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.IsHD.HasValue)
|
||||
{
|
||||
var val = request.IsHD.Value;
|
||||
|
||||
if (video == null || val != video.IsHD)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.IsUnidentified.HasValue)
|
||||
{
|
||||
var val = request.IsUnidentified.Value;
|
||||
if (i.IsUnidentified != val)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.IsLocked.HasValue)
|
||||
{
|
||||
var val = request.IsLocked.Value;
|
||||
if (i.IsLocked != val)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasOverview.HasValue)
|
||||
{
|
||||
var filterValue = request.HasOverview.Value;
|
||||
|
||||
var hasValue = !string.IsNullOrEmpty(i.Overview);
|
||||
|
||||
if (hasValue != filterValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasImdbId.HasValue)
|
||||
{
|
||||
var filterValue = request.HasImdbId.Value;
|
||||
|
||||
var hasValue = !string.IsNullOrEmpty(i.GetProviderId(MetadataProviders.Imdb));
|
||||
|
||||
if (hasValue != filterValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasTmdbId.HasValue)
|
||||
{
|
||||
var filterValue = request.HasTmdbId.Value;
|
||||
|
||||
var hasValue = !string.IsNullOrEmpty(i.GetProviderId(MetadataProviders.Tmdb));
|
||||
|
||||
if (hasValue != filterValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasTvdbId.HasValue)
|
||||
{
|
||||
var filterValue = request.HasTvdbId.Value;
|
||||
|
||||
var hasValue = !string.IsNullOrEmpty(i.GetProviderId(MetadataProviders.Tvdb));
|
||||
|
||||
if (hasValue != filterValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.IsYearMismatched.HasValue)
|
||||
{
|
||||
var filterValue = request.IsYearMismatched.Value;
|
||||
|
||||
if (UserViewBuilder.IsYearMismatched(i, libraryManager) != filterValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasOfficialRating.HasValue)
|
||||
{
|
||||
var filterValue = request.HasOfficialRating.Value;
|
||||
|
||||
var hasValue = !string.IsNullOrEmpty(i.OfficialRating);
|
||||
|
||||
if (hasValue != filterValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.IsPlaceHolder.HasValue)
|
||||
{
|
||||
var filterValue = request.IsPlaceHolder.Value;
|
||||
|
||||
var isPlaceHolder = false;
|
||||
|
||||
var hasPlaceHolder = i as ISupportsPlaceHolders;
|
||||
|
||||
if (hasPlaceHolder != null)
|
||||
{
|
||||
isPlaceHolder = hasPlaceHolder.IsPlaceHolder;
|
||||
}
|
||||
|
||||
if (isPlaceHolder != filterValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasSpecialFeature.HasValue)
|
||||
{
|
||||
var filterValue = request.HasSpecialFeature.Value;
|
||||
|
||||
var movie = i as IHasSpecialFeatures;
|
||||
|
||||
if (movie != null)
|
||||
{
|
||||
var ok = filterValue
|
||||
? movie.SpecialFeatureIds.Count > 0
|
||||
: movie.SpecialFeatureIds.Count == 0;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasSubtitles.HasValue)
|
||||
{
|
||||
var val = request.HasSubtitles.Value;
|
||||
|
||||
if (video == null || val != video.HasSubtitles)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasParentalRating.HasValue)
|
||||
{
|
||||
var val = request.HasParentalRating.Value;
|
||||
|
||||
var rating = i.CustomRating;
|
||||
|
||||
if (string.IsNullOrEmpty(rating))
|
||||
{
|
||||
rating = i.OfficialRating;
|
||||
}
|
||||
|
||||
if (val)
|
||||
{
|
||||
if (string.IsNullOrEmpty(rating))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(rating))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasTrailer.HasValue)
|
||||
{
|
||||
var val = request.HasTrailer.Value;
|
||||
var trailerCount = 0;
|
||||
|
||||
var hasTrailers = i as IHasTrailers;
|
||||
if (hasTrailers != null)
|
||||
{
|
||||
trailerCount = hasTrailers.GetTrailerIds().Count;
|
||||
}
|
||||
|
||||
var ok = val ? trailerCount > 0 : trailerCount == 0;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasThemeSong.HasValue)
|
||||
{
|
||||
var filterValue = request.HasThemeSong.Value;
|
||||
|
||||
var themeCount = 0;
|
||||
var iHasThemeMedia = i as IHasThemeMedia;
|
||||
|
||||
if (iHasThemeMedia != null)
|
||||
{
|
||||
themeCount = iHasThemeMedia.ThemeSongIds.Count;
|
||||
}
|
||||
var ok = filterValue ? themeCount > 0 : themeCount == 0;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.HasThemeVideo.HasValue)
|
||||
{
|
||||
var filterValue = request.HasThemeVideo.Value;
|
||||
|
||||
var themeCount = 0;
|
||||
var iHasThemeMedia = i as IHasThemeMedia;
|
||||
|
||||
if (iHasThemeMedia != null)
|
||||
{
|
||||
themeCount = iHasThemeMedia.ThemeVideoIds.Count;
|
||||
}
|
||||
var ok = filterValue ? themeCount > 0 : themeCount == 0;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply tag filter
|
||||
var tags = request.GetTags();
|
||||
if (tags.Length > 0)
|
||||
{
|
||||
var hasTags = i as IHasTags;
|
||||
if (hasTags == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(tags.Any(v => hasTags.Tags.Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply official rating filter
|
||||
var officialRatings = request.GetOfficialRatings();
|
||||
if (officialRatings.Length > 0 && !officialRatings.Contains(i.OfficialRating ?? string.Empty))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Apply genre filter
|
||||
var genres = request.GetGenres();
|
||||
if (genres.Length > 0 && !(genres.Any(v => i.Genres.Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Filter by VideoType
|
||||
var videoTypes = request.GetVideoTypes();
|
||||
if (videoTypes.Length > 0 && (video == null || !videoTypes.Contains(video.VideoType)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var imageTypes = request.GetImageTypes().ToList();
|
||||
if (imageTypes.Count > 0)
|
||||
{
|
||||
if (!(imageTypes.Any(i.HasImage)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply studio filter
|
||||
var studios = request.GetStudios();
|
||||
if (studios.Length > 0 && !studios.Any(v => i.Studios.Contains(v, StringComparer.OrdinalIgnoreCase)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Apply studio filter
|
||||
var studioIds = request.GetStudioIds();
|
||||
if (studioIds.Length > 0 && !studioIds.Any(id =>
|
||||
{
|
||||
var studioItem = libraryManager.GetItemById(id);
|
||||
return studioItem != null && i.Studios.Contains(studioItem.Name, StringComparer.OrdinalIgnoreCase);
|
||||
}))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Apply year filter
|
||||
var years = request.GetYears();
|
||||
if (years.Length > 0 && !(i.ProductionYear.HasValue && years.Contains(i.ProductionYear.Value)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Apply person filter
|
||||
var personIds = request.GetPersonIds();
|
||||
if (personIds.Length > 0)
|
||||
{
|
||||
var names = personIds
|
||||
.Select(libraryManager.GetItemById)
|
||||
.Select(p => p == null ? "-1" : p.Name)
|
||||
.ToList();
|
||||
|
||||
if (!(names.Any(v => libraryManager.GetPeople(i).Select(p => p.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply person filter
|
||||
if (!string.IsNullOrEmpty(request.Person))
|
||||
{
|
||||
var personTypes = request.GetPersonTypes();
|
||||
|
||||
if (personTypes.Length == 0)
|
||||
{
|
||||
if (!(libraryManager.GetPeople(i).Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var types = personTypes;
|
||||
|
||||
var ok = new[] { i }.Any(item =>
|
||||
libraryManager.GetPeople(item).Any(p =>
|
||||
p.Name.Equals(request.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role, StringComparer.OrdinalIgnoreCase))));
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (request.MinCommunityRating.HasValue)
|
||||
{
|
||||
var val = request.MinCommunityRating.Value;
|
||||
|
||||
if (!(i.CommunityRating.HasValue && i.CommunityRating >= val))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.MinCriticRating.HasValue)
|
||||
{
|
||||
var val = request.MinCriticRating.Value;
|
||||
|
||||
var hasCriticRating = i as IHasCriticRating;
|
||||
|
||||
if (hasCriticRating != null)
|
||||
{
|
||||
if (!(hasCriticRating.CriticRating.HasValue && hasCriticRating.CriticRating >= val))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Artists
|
||||
if (!string.IsNullOrEmpty(request.ArtistIds))
|
||||
{
|
||||
@ -1239,52 +776,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
}
|
||||
}
|
||||
|
||||
if (request.MinPlayers.HasValue)
|
||||
{
|
||||
var filterValue = request.MinPlayers.Value;
|
||||
|
||||
var game = i as Game;
|
||||
|
||||
if (game != null)
|
||||
{
|
||||
var players = game.PlayersSupported ?? 1;
|
||||
|
||||
var ok = players >= filterValue;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.MaxPlayers.HasValue)
|
||||
{
|
||||
var filterValue = request.MaxPlayers.Value;
|
||||
|
||||
var game = i as Game;
|
||||
|
||||
if (game != null)
|
||||
{
|
||||
var players = game.PlayersSupported ?? 1;
|
||||
|
||||
var ok = players <= filterValue;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.ParentIndexNumber.HasValue)
|
||||
{
|
||||
var filterValue = request.ParentIndexNumber.Value;
|
||||
@ -1347,29 +838,6 @@ namespace MediaBrowser.Api.UserLibrary
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the paging.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="items">The items.</param>
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
private IEnumerable<BaseItem> ApplyPaging(GetItems request, IEnumerable<BaseItem> items)
|
||||
{
|
||||
// Start at
|
||||
if (request.StartIndex.HasValue)
|
||||
{
|
||||
items = items.Skip(request.StartIndex.Value);
|
||||
}
|
||||
|
||||
// Return limit
|
||||
if (request.Limit.HasValue)
|
||||
{
|
||||
items = items.Take(request.Limit.Value);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -195,7 +195,7 @@ namespace MediaBrowser.Common.Implementations.Updates
|
||||
cacheLength = TimeSpan.FromMinutes(3);
|
||||
break;
|
||||
default:
|
||||
cacheLength = TimeSpan.FromHours(3);
|
||||
cacheLength = TimeSpan.FromHours(24);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -235,6 +235,15 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public virtual bool EnableAlphaNumericSorting
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is just a helper for convenience
|
||||
/// </summary>
|
||||
@ -439,6 +448,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
if (Name == null) return null; //some items may not have name filled in properly
|
||||
|
||||
if (!EnableAlphaNumericSorting)
|
||||
{
|
||||
return Name.TrimStart();
|
||||
}
|
||||
|
||||
var sortable = Name.Trim().ToLower();
|
||||
sortable = ConfigurationManager.Configuration.SortRemoveCharacters.Aggregate(sortable, (current, search) => current.Replace(search.ToLower(), string.Empty));
|
||||
|
||||
@ -466,12 +480,29 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public Guid ParentId { get; set; }
|
||||
|
||||
private Folder _parent;
|
||||
/// <summary>
|
||||
/// Gets or sets the parent.
|
||||
/// </summary>
|
||||
/// <value>The parent.</value>
|
||||
[IgnoreDataMember]
|
||||
public Folder Parent { get; set; }
|
||||
public Folder Parent
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_parent != null)
|
||||
{
|
||||
return _parent;
|
||||
}
|
||||
|
||||
if (ParentId != Guid.Empty)
|
||||
{
|
||||
return LibraryManager.GetItemById(ParentId) as Folder;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
set { _parent = value; }
|
||||
}
|
||||
|
||||
public void SetParent(Folder parent)
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
@ -42,6 +43,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public string Person { get; set; }
|
||||
public string[] PersonIds { get; set; }
|
||||
public string[] ItemIds { get; set; }
|
||||
public string AdjacentTo { get; set; }
|
||||
public string[] PersonTypes { get; set; }
|
||||
|
||||
@ -83,8 +85,15 @@ namespace MediaBrowser.Controller.Entities
|
||||
public bool? IsSports { get; set; }
|
||||
public bool? IsKids { get; set; }
|
||||
|
||||
public int? MinPlayers { get; set; }
|
||||
public int? MaxPlayers { get; set; }
|
||||
public double? MinCriticRating { get; set; }
|
||||
public double? MinCommunityRating { get; set; }
|
||||
|
||||
public string[] ChannelIds { get; set; }
|
||||
|
||||
internal List<Guid> ItemIdsFromPersonFilters { get; set; }
|
||||
|
||||
public InternalItemsQuery()
|
||||
{
|
||||
Tags = new string[] { };
|
||||
@ -102,6 +111,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
PersonTypes = new string[] { };
|
||||
PersonIds = new string[] { };
|
||||
ChannelIds = new string[] { };
|
||||
ItemIds = new string[] { };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,15 @@ namespace MediaBrowser.Controller.Entities
|
||||
return true;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool EnableAlphaNumericSorting
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is owned item.
|
||||
/// </summary>
|
||||
|
@ -1116,6 +1116,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.ItemIds.Length > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.Studios.Length > 0)
|
||||
{
|
||||
return false;
|
||||
@ -1146,6 +1151,26 @@ namespace MediaBrowser.Controller.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.MinPlayers.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.MaxPlayers.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.MinCommunityRating.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.MinCriticRating.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1304,6 +1329,41 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public static bool Filter(BaseItem item, User user, InternalItemsQuery query, IUserDataManager userDataManager, ILibraryManager libraryManager)
|
||||
{
|
||||
if (query.ItemIdsFromPersonFilters == null)
|
||||
{
|
||||
if (query.PersonIds.Length > 0)
|
||||
{
|
||||
var names = query.PersonIds
|
||||
.Select(libraryManager.GetItemById)
|
||||
.Select(i => i == null ? null : i.Name)
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.ToList();
|
||||
|
||||
var itemIdList = new List<Guid>();
|
||||
foreach (var name in names)
|
||||
{
|
||||
itemIdList.AddRange(libraryManager.GetItemIds(new InternalItemsQuery
|
||||
{
|
||||
Person = name
|
||||
}));
|
||||
}
|
||||
query.ItemIdsFromPersonFilters = itemIdList;
|
||||
}
|
||||
|
||||
// Apply person filter
|
||||
else if (!string.IsNullOrWhiteSpace(query.Person))
|
||||
{
|
||||
var itemIdList = new List<Guid>();
|
||||
|
||||
itemIdList.AddRange(libraryManager.GetItemIds(new InternalItemsQuery
|
||||
{
|
||||
Person = query.Person,
|
||||
PersonTypes = query.PersonTypes
|
||||
}));
|
||||
query.ItemIdsFromPersonFilters = itemIdList;
|
||||
}
|
||||
}
|
||||
|
||||
if (query.MediaTypes.Length > 0 && !query.MediaTypes.Contains(item.MediaType ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
@ -1691,44 +1751,20 @@ namespace MediaBrowser.Controller.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
// Apply person filter
|
||||
if (query.PersonIds.Length > 0)
|
||||
if (query.ItemIds.Length > 0)
|
||||
{
|
||||
var names = query.PersonIds
|
||||
.Select(libraryManager.GetItemById)
|
||||
.Select(i => i == null ? "-1" : i.Name)
|
||||
.ToList();
|
||||
|
||||
if (!(names.Any(v => libraryManager.GetPeople(item).Select(i => i.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||
if (!query.ItemIds.Contains(item.Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply person filter
|
||||
if (!string.IsNullOrWhiteSpace(query.Person))
|
||||
if (query.ItemIdsFromPersonFilters != null)
|
||||
{
|
||||
var personTypes = query.PersonTypes;
|
||||
|
||||
if (personTypes.Length == 0)
|
||||
if (!query.ItemIdsFromPersonFilters.Contains(item.Id))
|
||||
{
|
||||
if (!(libraryManager.GetPeople(item).Any(p => string.Equals(p.Name, query.Person, StringComparison.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var types = personTypes;
|
||||
|
||||
var ok = new[] { item }.Any(i =>
|
||||
libraryManager.GetPeople(i).Any(p =>
|
||||
string.Equals(p.Name, query.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role ?? string.Empty, StringComparer.OrdinalIgnoreCase))));
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1747,6 +1783,81 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
}
|
||||
|
||||
if (query.MinPlayers.HasValue)
|
||||
{
|
||||
var filterValue = query.MinPlayers.Value;
|
||||
|
||||
var game = item as Game;
|
||||
|
||||
if (game != null)
|
||||
{
|
||||
var players = game.PlayersSupported ?? 1;
|
||||
|
||||
var ok = players >= filterValue;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (query.MaxPlayers.HasValue)
|
||||
{
|
||||
var filterValue = query.MaxPlayers.Value;
|
||||
|
||||
var game = item as Game;
|
||||
|
||||
if (game != null)
|
||||
{
|
||||
var players = game.PlayersSupported ?? 1;
|
||||
|
||||
var ok = players <= filterValue;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (query.MinCommunityRating.HasValue)
|
||||
{
|
||||
var val = query.MinCommunityRating.Value;
|
||||
|
||||
if (!(item.CommunityRating.HasValue && item.CommunityRating >= val))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (query.MinCriticRating.HasValue)
|
||||
{
|
||||
var val = query.MinCriticRating.Value;
|
||||
|
||||
var hasCriticRating = item as IHasCriticRating;
|
||||
|
||||
if (hasCriticRating != null)
|
||||
{
|
||||
if (!(hasCriticRating.CriticRating.HasValue && hasCriticRating.CriticRating >= val))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(artists))
|
||||
{
|
||||
audio.Artists = artists.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
audio.Artists = SplitArtists(artists, new[] { '/' }, false)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
}
|
||||
@ -452,7 +452,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
}
|
||||
else
|
||||
{
|
||||
audio.Artists = SplitArtists(artist)
|
||||
audio.Artists = SplitArtists(artist, _nameDelimiters, true)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
}
|
||||
@ -474,7 +474,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
}
|
||||
else
|
||||
{
|
||||
audio.AlbumArtists = SplitArtists(albumArtist)
|
||||
audio.AlbumArtists = SplitArtists(albumArtist, _nameDelimiters, true)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
|
||||
@ -552,10 +552,13 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
|
||||
private const string ArtistReplaceValue = " | ";
|
||||
|
||||
private IEnumerable<string> SplitArtists(string val)
|
||||
private IEnumerable<string> SplitArtists(string val, char[] delimiters, bool splitFeaturing)
|
||||
{
|
||||
val = val.Replace(" featuring ", ArtistReplaceValue, StringComparison.OrdinalIgnoreCase)
|
||||
.Replace(" feat. ", ArtistReplaceValue, StringComparison.OrdinalIgnoreCase);
|
||||
if (splitFeaturing)
|
||||
{
|
||||
val = val.Replace(" featuring ", ArtistReplaceValue, StringComparison.OrdinalIgnoreCase)
|
||||
.Replace(" feat. ", ArtistReplaceValue, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
var artistsFound = new List<string>();
|
||||
|
||||
@ -570,11 +573,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
}
|
||||
}
|
||||
|
||||
// Only use the comma as a delimeter if there are no slashes or pipes.
|
||||
// We want to be careful not to split names that have commas in them
|
||||
var delimeter = _nameDelimiters;
|
||||
|
||||
var artists = val.Split(delimeter, StringSplitOptions.RemoveEmptyEntries)
|
||||
var artists = val.Split(delimiters, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.Select(i => i.Trim());
|
||||
|
||||
|
@ -362,8 +362,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
MediaStream videoStream = item.VideoStream;
|
||||
|
||||
// TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough
|
||||
bool isEligibleForDirectPlay = IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options), subtitleStream, options);
|
||||
bool isEligibleForDirectStream = IsEligibleForDirectPlay(item, options.GetMaxBitrate(), subtitleStream, options);
|
||||
bool isEligibleForDirectPlay = IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options), subtitleStream, options, PlayMethod.DirectPlay);
|
||||
bool isEligibleForDirectStream = IsEligibleForDirectPlay(item, options.GetMaxBitrate(), subtitleStream, options, PlayMethod.DirectStream);
|
||||
|
||||
_logger.Debug("Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
|
||||
options.Profile.Name ?? "Unknown Profile",
|
||||
@ -383,7 +383,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if (subtitleStream != null)
|
||||
{
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context);
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, directPlay.Value);
|
||||
|
||||
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
|
||||
playlistItem.SubtitleFormat = subtitleProfile.Format;
|
||||
@ -413,7 +413,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if (subtitleStream != null)
|
||||
{
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context);
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, PlayMethod.Transcode);
|
||||
|
||||
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
|
||||
playlistItem.SubtitleFormat = subtitleProfile.Format;
|
||||
@ -706,14 +706,16 @@ namespace MediaBrowser.Model.Dlna
|
||||
private bool IsEligibleForDirectPlay(MediaSourceInfo item,
|
||||
int? maxBitrate,
|
||||
MediaStream subtitleStream,
|
||||
VideoOptions options)
|
||||
VideoOptions options,
|
||||
PlayMethod playMethod)
|
||||
{
|
||||
if (subtitleStream != null)
|
||||
{
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context);
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, playMethod);
|
||||
|
||||
if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed)
|
||||
{
|
||||
_logger.Debug("Not eligible for {0} due to unsupported subtitles", playMethod);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -721,8 +723,25 @@ namespace MediaBrowser.Model.Dlna
|
||||
return IsAudioEligibleForDirectPlay(item, maxBitrate);
|
||||
}
|
||||
|
||||
public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, EncodingContext context)
|
||||
public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, EncodingContext context, PlayMethod playMethod)
|
||||
{
|
||||
if (playMethod != PlayMethod.Transcode)
|
||||
{
|
||||
// Look for supported embedded subs
|
||||
foreach (SubtitleProfile profile in subtitleProfiles)
|
||||
{
|
||||
if (!profile.SupportsLanguage(subtitleStream.Language))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (profile.Method == SubtitleDeliveryMethod.Embed && subtitleStream.IsTextSubtitleStream == MediaStream.IsTextFormat(profile.Format))
|
||||
{
|
||||
return profile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Look for an external profile that matches the stream type (text/graphical)
|
||||
foreach (SubtitleProfile profile in subtitleProfiles)
|
||||
{
|
||||
@ -781,7 +800,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
return true;
|
||||
}
|
||||
|
||||
_logger.Debug("Audio Bitrate exceeds DirectPlay limit");
|
||||
_logger.Debug("Bitrate exceeds DirectPlay limit");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream, string baseUrl, string accessToken, long startPositionTicks, SubtitleProfile[] subtitleProfiles)
|
||||
{
|
||||
SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, subtitleProfiles, Context);
|
||||
SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, subtitleProfiles, Context, PlayMethod);
|
||||
SubtitleStreamInfo info = new SubtitleStreamInfo
|
||||
{
|
||||
IsForced = stream.IsForced,
|
||||
|
@ -330,12 +330,11 @@ namespace MediaBrowser.Providers.Manager
|
||||
|
||||
protected async Task SaveItem(MetadataResult<TItemType> result, ItemUpdateType reason, CancellationToken cancellationToken)
|
||||
{
|
||||
await result.Item.UpdateToRepository(reason, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result.Item.SupportsPeople)
|
||||
{
|
||||
await LibraryManager.UpdatePeople(result.Item as BaseItem, result.People);
|
||||
}
|
||||
await result.Item.UpdateToRepository(reason, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public bool CanRefresh(IHasMetadata item)
|
||||
|
@ -138,7 +138,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||
if (item.IsShortcut)
|
||||
{
|
||||
FetchShortcutInfo(item);
|
||||
return Task.FromResult(ItemUpdateType.MetadataEdit);
|
||||
return Task.FromResult(ItemUpdateType.MetadataImport);
|
||||
}
|
||||
|
||||
var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager, _chapterManager, _libraryManager);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Common.Net;
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
@ -191,7 +192,20 @@ namespace MediaBrowser.Providers.Movies
|
||||
var tmdbId = item.GetProviderId(MetadataProviders.Tmdb);
|
||||
var language = item.GetPreferredMetadataLanguage();
|
||||
|
||||
if (string.IsNullOrEmpty(tmdbId))
|
||||
if (string.IsNullOrWhiteSpace(tmdbId))
|
||||
{
|
||||
var imdbId = item.GetProviderId(MetadataProviders.Imdb);
|
||||
if (!string.IsNullOrWhiteSpace(imdbId))
|
||||
{
|
||||
var movieInfo = await MovieDbProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false);
|
||||
if (movieInfo != null)
|
||||
{
|
||||
tmdbId = movieInfo.id.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(tmdbId))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Channels;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@ -34,6 +35,13 @@ namespace MediaBrowser.Providers.Movies
|
||||
return true;
|
||||
}
|
||||
|
||||
// Supports images for tv movies
|
||||
var tvProgram = item as LiveTvProgram;
|
||||
if (tvProgram != null && tvProgram.IsMovie)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return item is Movie || item is MusicVideo;
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
public IEnumerable<BaseItemDto> GetBaseItemDtos(IEnumerable<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
{
|
||||
var syncJobItems = GetSyncedItemProgress(options);
|
||||
var syncDictionary = syncJobItems.ToDictionary(i => i.ItemId);
|
||||
var syncDictionary = GetSyncedItemProgressDictionary(syncJobItems);
|
||||
|
||||
var list = new List<BaseItemDto>();
|
||||
|
||||
@ -120,11 +120,23 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
return list;
|
||||
}
|
||||
|
||||
private Dictionary<string, SyncedItemProgress> GetSyncedItemProgressDictionary(IEnumerable<SyncedItemProgress> items)
|
||||
{
|
||||
var dict = new Dictionary<string, SyncedItemProgress>();
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
dict[item.ItemId] = item;
|
||||
}
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
|
||||
{
|
||||
var syncProgress = GetSyncedItemProgress(options);
|
||||
|
||||
var dto = GetBaseItemDtoInternal(item, options, syncProgress.ToDictionary(i => i.ItemId), user, owner);
|
||||
var dto = GetBaseItemDtoInternal(item, options, GetSyncedItemProgressDictionary(syncProgress), user, owner);
|
||||
|
||||
var byName = item as IItemByName;
|
||||
|
||||
@ -382,7 +394,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
{
|
||||
var syncProgress = GetSyncedItemProgress(options);
|
||||
|
||||
var dto = GetBaseItemDtoInternal(item, options, syncProgress.ToDictionary(i => i.ItemId), user);
|
||||
var dto = GetBaseItemDtoInternal(item, options, GetSyncedItemProgressDictionary(syncProgress), user);
|
||||
|
||||
if (options.Fields.Contains(ItemFields.ItemCounts))
|
||||
{
|
||||
|
@ -256,7 +256,15 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
|
||||
NotificationType = type
|
||||
};
|
||||
|
||||
notification.Variables["ItemName"] = item.Name;
|
||||
if (e.Item != null)
|
||||
{
|
||||
notification.Variables["ItemName"] = GetItemName(e.Item);
|
||||
}
|
||||
else
|
||||
{
|
||||
notification.Variables["ItemName"] = item.Name;
|
||||
}
|
||||
|
||||
notification.Variables["UserName"] = user == null ? "Unknown user" : user.Name;
|
||||
notification.Variables["AppName"] = e.ClientName;
|
||||
notification.Variables["DeviceName"] = e.DeviceName;
|
||||
|
@ -345,7 +345,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
try
|
||||
{
|
||||
await UpdateItem(season, ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
|
||||
await UpdateItem(season, ItemUpdateType.MetadataDownload, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -2071,10 +2071,17 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
public List<PersonInfo> GetPeople(BaseItem item)
|
||||
{
|
||||
return item.People ?? GetPeople(new InternalPeopleQuery
|
||||
var people = GetPeople(new InternalPeopleQuery
|
||||
{
|
||||
ItemId = item.Id
|
||||
});
|
||||
|
||||
if (people.Count > 0)
|
||||
{
|
||||
return people;
|
||||
}
|
||||
|
||||
return item.People ?? new List<PersonInfo>();
|
||||
}
|
||||
|
||||
public List<Person> GetPeopleItems(InternalPeopleQuery query)
|
||||
@ -2106,15 +2113,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public async Task UpdatePeople(BaseItem item, List<PersonInfo> people)
|
||||
public Task UpdatePeople(BaseItem item, List<PersonInfo> people)
|
||||
{
|
||||
await ItemRepository.UpdatePeople(item.Id, people).ConfigureAwait(false);
|
||||
|
||||
if (item.People != null)
|
||||
{
|
||||
item.People = null;
|
||||
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
return ItemRepository.UpdatePeople(item.Id, people);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,10 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Naming.Common;
|
||||
using MediaBrowser.Naming.Video;
|
||||
using MediaBrowser.Server.Implementations.Logging;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Server.Implementations.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
|
@ -815,5 +815,6 @@
|
||||
"HeaderShare": "Share",
|
||||
"ButtonShareHelp": "Share a web page containing media information with social media. Media files are never shared publicly.",
|
||||
"ButtonShare": "Share",
|
||||
"HeaderConfirm": "Confirm"
|
||||
"HeaderConfirm": "Confirm",
|
||||
"ButtonAdvancedRefresh": "Advanced Refresh"
|
||||
}
|
||||
|
@ -86,7 +86,7 @@
|
||||
"OptionDetectArchiveFilesAsMedia": "Detect archive files as media",
|
||||
"OptionDetectArchiveFilesAsMediaHelp": "If enabled, files with .rar and .zip extensions will be detected as media files.",
|
||||
"LabelEnterConnectUserName": "Username or email:",
|
||||
"LabelEnterConnectUserNameHelp": "This is your Emby online account username or password.",
|
||||
"LabelEnterConnectUserNameHelp": "This is your Emby online account username or email.",
|
||||
"LabelEnableEnhancedMovies": "Enable enhanced movie displays",
|
||||
"LabelEnableEnhancedMoviesHelp": "When enabled, movies will be displayed as folders to include trailers, extras, cast & crew, and other related content.",
|
||||
"HeaderSyncJobInfo": "Sync Job",
|
||||
@ -1466,5 +1466,7 @@
|
||||
"TabHomeScreen": "Home Screen",
|
||||
"HeaderDisplay": "Display",
|
||||
"HeaderNavigation": "Navigation",
|
||||
"LegendTheseSettingsShared": "These settings are shared on all devices"
|
||||
"LegendTheseSettingsShared": "These settings are shared on all devices",
|
||||
"OptionEnableAutomaticServerUpdates": "Enable automatic server updates",
|
||||
"OptionOtherTrailers": "Include trailers from older movies"
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Sorting
|
||||
{
|
||||
@ -17,6 +18,11 @@ namespace MediaBrowser.Server.Implementations.Sorting
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
{
|
||||
if (!x.EnableAlphaNumericSorting || !y.EnableAlphaNumericSorting)
|
||||
{
|
||||
return string.Compare(x.SortName, y.SortName, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
return AlphanumComparator.CompareValues(x.Name, y.Name);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Sorting
|
||||
{
|
||||
@ -17,6 +18,11 @@ namespace MediaBrowser.Server.Implementations.Sorting
|
||||
/// <returns>System.Int32.</returns>
|
||||
public int Compare(BaseItem x, BaseItem y)
|
||||
{
|
||||
if (!x.EnableAlphaNumericSorting || !y.EnableAlphaNumericSorting)
|
||||
{
|
||||
return string.Compare(x.SortName, y.SortName, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
return AlphanumComparator.CompareValues(x.SortName, y.SortName);
|
||||
}
|
||||
|
||||
|
@ -209,6 +209,13 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
IsRequired = false
|
||||
},
|
||||
new ProfileCondition
|
||||
{
|
||||
Condition = ProfileConditionType.LessThanEqual,
|
||||
Property = ProfileConditionValue.AudioBitrate,
|
||||
Value = "320000",
|
||||
IsRequired = true
|
||||
},
|
||||
new ProfileCondition
|
||||
{
|
||||
Condition = ProfileConditionType.Equals,
|
||||
Property = ProfileConditionValue.IsSecondaryAudio,
|
||||
@ -231,6 +238,13 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||
IsRequired = true
|
||||
},
|
||||
new ProfileCondition
|
||||
{
|
||||
Condition = ProfileConditionType.LessThanEqual,
|
||||
Property = ProfileConditionValue.AudioBitrate,
|
||||
Value = "320000",
|
||||
IsRequired = true
|
||||
},
|
||||
new ProfileCondition
|
||||
{
|
||||
Condition = ProfileConditionType.Equals,
|
||||
Property = ProfileConditionValue.IsSecondaryAudio,
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Text;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
@ -16,6 +15,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebMarkupMin.Core.Minifiers;
|
||||
|
||||
@ -324,6 +324,10 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "webcomponentsjs", "webcomponents-lite.js"), Path.Combine(path, "bower_components", "webcomponentsjs", "webcomponents-lite.js"));
|
||||
CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "webcomponentsjs", "webcomponents-lite.min.js"), Path.Combine(path, "bower_components", "webcomponentsjs", "webcomponents-lite.min.js"));
|
||||
CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "velocity", "velocity.min.js"), Path.Combine(path, "bower_components", "velocity", "velocity.min.js"));
|
||||
CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "requirejs", "require.js"), Path.Combine(path, "bower_components", "requirejs", "require.js"));
|
||||
CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "fastclick", "lib", "fastclick.js"), Path.Combine(path, "bower_components", "fastclick", "lib", "fastclick.js"));
|
||||
CopyFile(Path.Combine(creator.DashboardUIPath, "bower_components", "jquery", "dist", "jquery.min.js"), Path.Combine(path, "bower_components", "jquery", "dist", "jquery.min.js"));
|
||||
|
||||
CopyDirectory(Path.Combine(creator.DashboardUIPath, "bower_components", "swipebox", "src", "css"), Path.Combine(path, "bower_components", "swipebox", "src", "css"));
|
||||
CopyDirectory(Path.Combine(creator.DashboardUIPath, "bower_components", "swipebox", "src", "js"), Path.Combine(path, "bower_components", "swipebox", "src", "js"));
|
||||
CopyDirectory(Path.Combine(creator.DashboardUIPath, "bower_components", "swipebox", "src", "img"), Path.Combine(path, "bower_components", "swipebox", "src", "img"));
|
||||
|
@ -443,11 +443,6 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
"bower_components/webcomponentsjs/webcomponents-lite.js" + versionString
|
||||
};
|
||||
|
||||
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
files.Insert(0, "cordova.js");
|
||||
}
|
||||
|
||||
var tags = files.Select(s => string.Format("<script src=\"{0}\"></script>", s)).ToArray();
|
||||
|
||||
builder.Append(string.Join(string.Empty, tags));
|
||||
@ -493,9 +488,9 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
var memoryStream = new MemoryStream();
|
||||
var newLineBytes = Encoding.UTF8.GetBytes(Environment.NewLine);
|
||||
|
||||
await AppendResource(memoryStream, "thirdparty/jquery-2.1.1.min.js", newLineBytes).ConfigureAwait(false);
|
||||
await AppendResource(memoryStream, "bower_components/jquery/dist/jquery.min.js", newLineBytes).ConfigureAwait(false);
|
||||
|
||||
await AppendResource(memoryStream, "thirdparty/require.js", newLineBytes).ConfigureAwait(false);
|
||||
await AppendResource(memoryStream, "bower_components/requirejs/require.js", newLineBytes).ConfigureAwait(false);
|
||||
|
||||
await AppendResource(memoryStream, "thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.min.js", newLineBytes).ConfigureAwait(false);
|
||||
|
||||
|
@ -87,6 +87,15 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="dashboard-ui\bower_components\fastclick\lib\fastclick.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\bower_components\jquery\dist\jquery.min.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\bower_components\requirejs\require.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\bower_components\swipebox\src\css\swipebox.min.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -258,7 +267,7 @@
|
||||
<Content Include="dashboard-ui\cordova\back.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\cordova\ios\actionsheet.js">
|
||||
<Content Include="dashboard-ui\cordova\actionsheet.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\cordova\ios\orientation.js">
|
||||
@ -297,6 +306,9 @@
|
||||
<Content Include="dashboard-ui\thirdparty\paper-button-style.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\paper-ie10.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\social-share-kit-1.0.4\.gitignore" />
|
||||
<Content Include="dashboard-ui\thirdparty\social-share-kit-1.0.4\dist\css\social-share-kit.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
@ -661,12 +673,6 @@
|
||||
<Content Include="dashboard-ui\dlnasettings.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\editcollectionitems.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\edititemsubtitles.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\encodingsettings.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -832,9 +838,6 @@
|
||||
<Content Include="dashboard-ui\css\userimage.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\edititemimages.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\edititemmetadata.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -1099,9 +1102,6 @@
|
||||
<Content Include="dashboard-ui\thirdparty\cast_sender.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\fastclick.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\filesystem.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -1117,9 +1117,6 @@
|
||||
<Content Include="dashboard-ui\thirdparty\headroom.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jquery-2.1.1.min.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jquery.unveil-custom.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -1753,9 +1750,6 @@
|
||||
<Content Include="dashboard-ui\thirdparty\jstree3.0.8\themes\default\throbber.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\require.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\tvupcoming.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@ -36,7 +36,7 @@ namespace MediaBrowser.XbmcMetadata
|
||||
|
||||
void _libraryManager_ItemUpdated(object sender, ItemChangeEventArgs e)
|
||||
{
|
||||
if (e.UpdateReason == ItemUpdateType.ImageUpdate)
|
||||
if (e.UpdateReason >= ItemUpdateType.ImageUpdate)
|
||||
{
|
||||
var person = e.Item as Person;
|
||||
|
||||
@ -57,7 +57,7 @@ namespace MediaBrowser.XbmcMetadata
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
SaveMetadataForItem(item, ItemUpdateType.MetadataEdit);
|
||||
SaveMetadataForItem(item, e.UpdateReason);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ namespace MediaBrowser.XbmcMetadata
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_config.GetNfoConfiguration().UserId))
|
||||
{
|
||||
SaveMetadataForItem(item, ItemUpdateType.MetadataEdit);
|
||||
SaveMetadataForItem(item, ItemUpdateType.MetadataDownload);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
//[assembly: AssemblyVersion("3.0.*")]
|
||||
[assembly: AssemblyVersion("3.0.5667.6")]
|
||||
[assembly: AssemblyVersion("3.0.5675.1")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user