mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
added new parent methods
This commit is contained in:
parent
db8e51edb6
commit
cc19ce0daf
@ -259,6 +259,16 @@ namespace Emby.Drawing
|
|||||||
|
|
||||||
_imageEncoder.EncodeImage(originalImagePath, cacheFilePath, newWidth, newHeight, quality, options, outputFormat);
|
_imageEncoder.EncodeImage(originalImagePath, cacheFilePath, newWidth, newHeight, quality, options, outputFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new Tuple<string, string>(cacheFilePath, GetMimeType(outputFormat, cacheFilePath));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// If it fails for whatever reason, return the original image
|
||||||
|
_logger.ErrorException("Error encoding image", ex);
|
||||||
|
|
||||||
|
// Just spit out the original file if all the options are default
|
||||||
|
return new Tuple<string, string>(originalImagePath, MimeTypes.GetMimeType(originalImagePath));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -269,8 +279,6 @@ namespace Emby.Drawing
|
|||||||
|
|
||||||
semaphore.Release();
|
semaphore.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Tuple<string, string>(cacheFilePath, GetMimeType(outputFormat, cacheFilePath));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetMimeType(ImageFormat format, string path)
|
private string GetMimeType(ImageFormat format, string path)
|
||||||
|
@ -108,7 +108,7 @@ namespace MediaBrowser.Api
|
|||||||
IncludeItemTypes = new[] { typeof(GameSystem).Name }
|
IncludeItemTypes = new[] { typeof(GameSystem).Name }
|
||||||
};
|
};
|
||||||
var parentIds = new string[] { } ;
|
var parentIds = new string[] { } ;
|
||||||
var gameSystems = _libraryManager.GetItems(query, user, parentIds)
|
var gameSystems = _libraryManager.GetItems(query, parentIds)
|
||||||
.Cast<GameSystem>()
|
.Cast<GameSystem>()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ namespace MediaBrowser.Api
|
|||||||
IncludeItemTypes = new[] { typeof(Game).Name }
|
IncludeItemTypes = new[] { typeof(Game).Name }
|
||||||
};
|
};
|
||||||
var parentIds = new string[] { };
|
var parentIds = new string[] { };
|
||||||
var games = _libraryManager.GetItems(query, user, parentIds)
|
var games = _libraryManager.GetItems(query, parentIds)
|
||||||
.Cast<Game>()
|
.Cast<Game>()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -698,7 +698,7 @@ namespace MediaBrowser.Api.Images
|
|||||||
|
|
||||||
var userAgent = Request.UserAgent ?? string.Empty;
|
var userAgent = Request.UserAgent ?? string.Empty;
|
||||||
|
|
||||||
if (userAgent.IndexOf("crosswalk", StringComparison.OrdinalIgnoreCase) != -1 &&
|
if (userAgent.IndexOf("dalvik", StringComparison.OrdinalIgnoreCase) != -1 &&
|
||||||
userAgent.IndexOf("android", StringComparison.OrdinalIgnoreCase) != -1)
|
userAgent.IndexOf("android", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
supportsWebP = true;
|
supportsWebP = true;
|
||||||
|
@ -610,7 +610,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
|
||||||
BaseItem parent = item.Parent;
|
BaseItem parent = item.GetParent();
|
||||||
|
|
||||||
while (parent != null)
|
while (parent != null)
|
||||||
{
|
{
|
||||||
@ -621,7 +621,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
|
|
||||||
baseItemDtos.Add(_dtoService.GetBaseItemDto(parent, dtoOptions, user));
|
baseItemDtos.Add(_dtoService.GetBaseItemDto(parent, dtoOptions, user));
|
||||||
|
|
||||||
parent = parent.Parent;
|
parent = parent.GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseItemDtos.ToList();
|
return baseItemDtos.ToList();
|
||||||
@ -629,7 +629,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
|
|
||||||
private BaseItem TranslateParentItem(BaseItem item, User user)
|
private BaseItem TranslateParentItem(BaseItem item, User user)
|
||||||
{
|
{
|
||||||
if (item.Parent is AggregateFolder)
|
if (item.GetParent() is AggregateFolder)
|
||||||
{
|
{
|
||||||
return user.RootFolder.GetChildren(user, true).FirstOrDefault(i => i.PhysicalLocations.Contains(item.Path));
|
return user.RootFolder.GetChildren(user, true).FirstOrDefault(i => i.PhysicalLocations.Contains(item.Path));
|
||||||
}
|
}
|
||||||
@ -861,9 +861,9 @@ namespace MediaBrowser.Api.Library
|
|||||||
: (Folder)_libraryManager.RootFolder)
|
: (Folder)_libraryManager.RootFolder)
|
||||||
: _libraryManager.GetItemById(request.Id);
|
: _libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
while (GetThemeSongIds(item).Count == 0 && request.InheritFromParent && item.Parent != null)
|
while (GetThemeSongIds(item).Count == 0 && request.InheritFromParent && item.GetParent() != null)
|
||||||
{
|
{
|
||||||
item = item.Parent;
|
item = item.GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
@ -904,9 +904,9 @@ namespace MediaBrowser.Api.Library
|
|||||||
: (Folder)_libraryManager.RootFolder)
|
: (Folder)_libraryManager.RootFolder)
|
||||||
: _libraryManager.GetItemById(request.Id);
|
: _libraryManager.GetItemById(request.Id);
|
||||||
|
|
||||||
while (GetThemeVideoIds(item).Count == 0 && request.InheritFromParent && item.Parent != null)
|
while (GetThemeVideoIds(item).Count == 0 && request.InheritFromParent && item.GetParent() != null)
|
||||||
{
|
{
|
||||||
item = item.Parent;
|
item = item.GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
|
@ -139,7 +139,7 @@ namespace MediaBrowser.Api.Movies
|
|||||||
IncludeItemTypes = new[] { typeof(Movie).Name }
|
IncludeItemTypes = new[] { typeof(Movie).Name }
|
||||||
};
|
};
|
||||||
var parentIds = string.IsNullOrWhiteSpace(request.ParentId) ? new string[] { } : new[] { request.ParentId };
|
var parentIds = string.IsNullOrWhiteSpace(request.ParentId) ? new string[] { } : new[] { request.ParentId };
|
||||||
var movies = _libraryManager.GetItems(query, user, parentIds);
|
var movies = _libraryManager.GetItems(query, parentIds);
|
||||||
movies = _libraryManager.ReplaceVideosWithPrimaryVersions(movies);
|
movies = _libraryManager.ReplaceVideosWithPrimaryVersions(movies);
|
||||||
|
|
||||||
var listEligibleForCategories = new List<BaseItem>();
|
var listEligibleForCategories = new List<BaseItem>();
|
||||||
@ -195,7 +195,7 @@ namespace MediaBrowser.Api.Movies
|
|||||||
IncludeItemTypes = new[] { typeof(Movie).Name }
|
IncludeItemTypes = new[] { typeof(Movie).Name }
|
||||||
};
|
};
|
||||||
var parentIds = new string[] { };
|
var parentIds = new string[] { };
|
||||||
var list = _libraryManager.GetItems(query, user, parentIds)
|
var list = _libraryManager.GetItems(query, parentIds)
|
||||||
.Where(i =>
|
.Where(i =>
|
||||||
{
|
{
|
||||||
// Strip out secondary versions
|
// Strip out secondary versions
|
||||||
|
@ -283,7 +283,7 @@ namespace MediaBrowser.Api
|
|||||||
private T GetParentWithImage<T>(BaseItem item, ImageType type)
|
private T GetParentWithImage<T>(BaseItem item, ImageType type)
|
||||||
where T : BaseItem
|
where T : BaseItem
|
||||||
{
|
{
|
||||||
return item.Parents.OfType<T>().FirstOrDefault(i => i.HasImage(type));
|
return item.GetParents().OfType<T>().FirstOrDefault(i => i.HasImage(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,10 +70,10 @@ namespace MediaBrowser.Api
|
|||||||
_config.Configuration.EnableStandaloneMetadata = true;
|
_config.Configuration.EnableStandaloneMetadata = true;
|
||||||
_config.Configuration.EnableLibraryMetadataSubFolder = true;
|
_config.Configuration.EnableLibraryMetadataSubFolder = true;
|
||||||
_config.Configuration.EnableCustomPathSubFolders = true;
|
_config.Configuration.EnableCustomPathSubFolders = true;
|
||||||
_config.Configuration.DisableXmlSavers = true;
|
|
||||||
_config.Configuration.DisableStartupScan = true;
|
_config.Configuration.DisableStartupScan = true;
|
||||||
_config.Configuration.EnableUserViews = true;
|
_config.Configuration.EnableUserViews = true;
|
||||||
_config.Configuration.EnableDateLastRefresh = true;
|
_config.Configuration.EnableDateLastRefresh = true;
|
||||||
|
_config.Configuration.EnableSharedCollectionViewImage = true;
|
||||||
_config.SaveConfiguration();
|
_config.SaveConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
var dtoOptions = GetDtoOptions(request);
|
var dtoOptions = GetDtoOptions(request);
|
||||||
dtoOptions.Fields = new List<ItemFields>();
|
dtoOptions.Fields = new List<ItemFields>();
|
||||||
dtoOptions.Fields.Add(ItemFields.PrimaryImageAspectRatio);
|
dtoOptions.Fields.Add(ItemFields.PrimaryImageAspectRatio);
|
||||||
|
dtoOptions.Fields.Add(ItemFields.DisplayPreferencesId);
|
||||||
|
|
||||||
var user = _userManager.GetUserById(request.UserId);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Parents.OfType<MusicArtist>().FirstOrDefault();
|
return GetParents().OfType<MusicArtist>().FirstOrDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||||||
|
|
||||||
id.AlbumArtists = AlbumArtists;
|
id.AlbumArtists = AlbumArtists;
|
||||||
|
|
||||||
var artist = Parents.OfType<MusicArtist>().FirstOrDefault();
|
var artist = GetParents().OfType<MusicArtist>().FirstOrDefault();
|
||||||
|
|
||||||
if (artist != null)
|
if (artist != null)
|
||||||
{
|
{
|
||||||
|
@ -214,11 +214,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool IsHiddenFromUser(User user)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public virtual bool IsOwnedItem
|
public virtual bool IsOwnedItem
|
||||||
{
|
{
|
||||||
@ -519,15 +514,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public Folder Parent
|
public Folder Parent
|
||||||
{
|
{
|
||||||
get
|
get { return GetParent() as Folder; }
|
||||||
{
|
|
||||||
if (ParentId != Guid.Empty)
|
|
||||||
{
|
|
||||||
return LibraryManager.GetItemById(ParentId) as Folder;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -542,16 +529,28 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public IEnumerable<Folder> Parents
|
public IEnumerable<Folder> Parents
|
||||||
{
|
{
|
||||||
get
|
get { return GetParents().OfType<Folder>(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseItem GetParent()
|
||||||
{
|
{
|
||||||
var parent = Parent;
|
if (ParentId != Guid.Empty)
|
||||||
|
{
|
||||||
|
return LibraryManager.GetItemById(ParentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<BaseItem> GetParents()
|
||||||
|
{
|
||||||
|
var parent = GetParent();
|
||||||
|
|
||||||
while (parent != null)
|
while (parent != null)
|
||||||
{
|
{
|
||||||
yield return parent;
|
yield return parent;
|
||||||
|
|
||||||
parent = parent.Parent;
|
parent = parent.GetParent();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,13 +562,13 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
public T FindParent<T>()
|
public T FindParent<T>()
|
||||||
where T : Folder
|
where T : Folder
|
||||||
{
|
{
|
||||||
return Parents.OfType<T>().FirstOrDefault();
|
return GetParents().OfType<T>().FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public virtual BaseItem DisplayParent
|
public virtual BaseItem DisplayParent
|
||||||
{
|
{
|
||||||
get { return Parent; }
|
get { return GetParent(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -869,7 +868,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
protected virtual bool SupportsOwnedItems
|
protected virtual bool SupportsOwnedItems
|
||||||
{
|
{
|
||||||
get { return IsFolder || Parent != null; }
|
get { return IsFolder || GetParent() != null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
@ -894,7 +893,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
var localTrailersChanged = false;
|
var localTrailersChanged = false;
|
||||||
|
|
||||||
if (LocationType == LocationType.FileSystem && Parent != null)
|
if (LocationType == LocationType.FileSystem && GetParent() != null)
|
||||||
{
|
{
|
||||||
var hasThemeMedia = this as IHasThemeMedia;
|
var hasThemeMedia = this as IHasThemeMedia;
|
||||||
if (hasThemeMedia != null)
|
if (hasThemeMedia != null)
|
||||||
@ -1056,7 +1055,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(lang))
|
if (string.IsNullOrWhiteSpace(lang))
|
||||||
{
|
{
|
||||||
lang = Parents
|
lang = GetParents()
|
||||||
.Select(i => i.PreferredMetadataLanguage)
|
.Select(i => i.PreferredMetadataLanguage)
|
||||||
.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i));
|
.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i));
|
||||||
}
|
}
|
||||||
@ -1086,7 +1085,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(lang))
|
if (string.IsNullOrWhiteSpace(lang))
|
||||||
{
|
{
|
||||||
lang = Parents
|
lang = GetParents()
|
||||||
.Select(i => i.PreferredMetadataCountryCode)
|
.Select(i => i.PreferredMetadataCountryCode)
|
||||||
.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i));
|
.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i));
|
||||||
}
|
}
|
||||||
@ -1276,14 +1275,14 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Parents.Any(i => !i.IsVisible(user)))
|
if (GetParents().Any(i => !i.IsVisible(user)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkFolders)
|
if (checkFolders)
|
||||||
{
|
{
|
||||||
var topParent = Parents.LastOrDefault() ?? this;
|
var topParent = GetParents().LastOrDefault() ?? this;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(topParent.Path))
|
if (string.IsNullOrWhiteSpace(topParent.Path))
|
||||||
{
|
{
|
||||||
@ -1937,7 +1936,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
public virtual IEnumerable<Guid> GetAncestorIds()
|
public virtual IEnumerable<Guid> GetAncestorIds()
|
||||||
{
|
{
|
||||||
return Parents.Select(i => i.Id).Concat(LibraryManager.GetCollectionFolders(this).Select(i => i.Id));
|
return GetParents().Select(i => i.Id).Concat(LibraryManager.GetCollectionFolders(this).Select(i => i.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
|
@ -37,7 +37,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(SeriesName))
|
if (string.IsNullOrEmpty(SeriesName))
|
||||||
{
|
{
|
||||||
info.SeriesName = Parents.Select(i => i.Name).FirstOrDefault();
|
info.SeriesName = GetParents().Select(i => i.Name).FirstOrDefault();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -825,19 +825,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return UserViewBuilder.PostFilterAndSort(items, this, null, query, LibraryManager);
|
return UserViewBuilder.PostFilterAndSort(items, this, null, query, LibraryManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets allowed children of an item
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="user">The user.</param>
|
|
||||||
/// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param>
|
|
||||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
|
||||||
public virtual IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
|
public virtual IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
|
||||||
{
|
|
||||||
return GetChildren(user, includeLinkedChildren, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren, bool includeHidden)
|
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
@ -849,7 +837,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
var result = new Dictionary<Guid, BaseItem>();
|
var result = new Dictionary<Guid, BaseItem>();
|
||||||
|
|
||||||
AddChildren(user, includeLinkedChildren, result, includeHidden, false, null);
|
AddChildren(user, includeLinkedChildren, result, false, null);
|
||||||
|
|
||||||
return result.Values;
|
return result.Values;
|
||||||
}
|
}
|
||||||
@ -865,29 +853,25 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param>
|
/// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param>
|
||||||
/// <param name="result">The result.</param>
|
/// <param name="result">The result.</param>
|
||||||
/// <param name="includeHidden">if set to <c>true</c> [include hidden].</param>
|
|
||||||
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
||||||
/// <param name="filter">The filter.</param>
|
/// <param name="filter">The filter.</param>
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||||
private void AddChildren(User user, bool includeLinkedChildren, Dictionary<Guid, BaseItem> result, bool includeHidden, bool recursive, Func<BaseItem, bool> filter)
|
private void AddChildren(User user, bool includeLinkedChildren, Dictionary<Guid, BaseItem> result, bool recursive, Func<BaseItem, bool> filter)
|
||||||
{
|
{
|
||||||
foreach (var child in GetEligibleChildrenForRecursiveChildren(user))
|
foreach (var child in GetEligibleChildrenForRecursiveChildren(user))
|
||||||
{
|
{
|
||||||
if (child.IsVisible(user))
|
if (child.IsVisible(user))
|
||||||
{
|
|
||||||
if (includeHidden || !child.IsHiddenFromUser(user))
|
|
||||||
{
|
{
|
||||||
if (filter == null || filter(child))
|
if (filter == null || filter(child))
|
||||||
{
|
{
|
||||||
result[child.Id] = child;
|
result[child.Id] = child;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (recursive && child.IsFolder)
|
if (recursive && child.IsFolder)
|
||||||
{
|
{
|
||||||
var folder = (Folder)child;
|
var folder = (Folder)child;
|
||||||
|
|
||||||
folder.AddChildren(user, includeLinkedChildren, result, includeHidden, true, filter);
|
folder.AddChildren(user, includeLinkedChildren, result, true, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -928,7 +912,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
var result = new Dictionary<Guid, BaseItem>();
|
var result = new Dictionary<Guid, BaseItem>();
|
||||||
|
|
||||||
AddChildren(user, true, result, false, true, filter);
|
AddChildren(user, true, result, true, filter);
|
||||||
|
|
||||||
return result.Values;
|
return result.Values;
|
||||||
}
|
}
|
||||||
|
18
MediaBrowser.Controller/Entities/IHiddenFromDisplay.cs
Normal file
18
MediaBrowser.Controller/Entities/IHiddenFromDisplay.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Entities
|
||||||
|
{
|
||||||
|
public interface IHiddenFromDisplay
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the specified user is hidden.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user.</param>
|
||||||
|
/// <returns><c>true</c> if the specified user is hidden; otherwise, <c>false</c>.</returns>
|
||||||
|
bool IsHiddenFromUser(User user);
|
||||||
|
}
|
||||||
|
}
|
@ -130,7 +130,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||||||
|
|
||||||
// Must have a parent to have special features
|
// Must have a parent to have special features
|
||||||
// In other words, it must be part of the Parent/Child tree
|
// In other words, it must be part of the Parent/Child tree
|
||||||
if (LocationType == LocationType.FileSystem && Parent != null && !IsInMixedFolder)
|
if (LocationType == LocationType.FileSystem && GetParent() != null && !IsInMixedFolder)
|
||||||
{
|
{
|
||||||
var specialFeaturesChanged = await RefreshSpecialFeatures(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
var specialFeaturesChanged = await RefreshSpecialFeatures(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Parents.OfType<PhotoAlbum>().FirstOrDefault();
|
return GetParents().OfType<PhotoAlbum>().FirstOrDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Season ?? Parent;
|
return Season ?? GetParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public override BaseItem DisplayParent
|
public override BaseItem DisplayParent
|
||||||
{
|
{
|
||||||
get { return Series ?? Parent; }
|
get { return Series ?? GetParent(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Genre, Rating and Stuido will all be the same
|
// Genre, Rating and Stuido will all be the same
|
||||||
|
@ -73,7 +73,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
// Local trailers are not part of children
|
// Local trailers are not part of children
|
||||||
return Parent == null;
|
return GetParent() == null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,10 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
list.Add(ParentId);
|
list.Add(ParentId);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list.Add(Id);
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,10 +129,14 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
var standaloneTypes = new List<string>
|
var standaloneTypes = new List<string>
|
||||||
{
|
{
|
||||||
CollectionType.Playlists,
|
CollectionType.Playlists
|
||||||
CollectionType.BoxSets
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!ConfigurationManager.Configuration.EnableSharedCollectionViewImage)
|
||||||
|
{
|
||||||
|
standaloneTypes.Add(CollectionType.BoxSets);
|
||||||
|
}
|
||||||
|
|
||||||
var collectionFolder = folder as ICollectionFolder;
|
var collectionFolder = folder as ICollectionFolder;
|
||||||
|
|
||||||
if (collectionFolder == null)
|
if (collectionFolder == null)
|
||||||
|
@ -1073,7 +1073,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
if (query.IsInBoxSet.HasValue)
|
if (query.IsInBoxSet.HasValue)
|
||||||
{
|
{
|
||||||
var val = query.IsInBoxSet.Value;
|
var val = query.IsInBoxSet.Value;
|
||||||
if (item.Parents.OfType<BoxSet>().Any() != val)
|
if (item.GetParents().OfType<BoxSet>().Any() != val)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1511,7 +1511,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
.Where(i => !UserView.IsExcludedFromGrouping(i));
|
.Where(i => !UserView.IsExcludedFromGrouping(i));
|
||||||
}
|
}
|
||||||
return user.RootFolder
|
return user.RootFolder
|
||||||
.GetChildren(user, true, true)
|
.GetChildren(user, true)
|
||||||
.OfType<Folder>()
|
.OfType<Folder>()
|
||||||
.Where(i => user.IsFolderGrouped(i.Id) && !UserView.IsExcludedFromGrouping(i));
|
.Where(i => user.IsFolderGrouped(i.Id) && !UserView.IsExcludedFromGrouping(i));
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
// Must have a parent to have additional parts or alternate versions
|
// Must have a parent to have additional parts or alternate versions
|
||||||
// In other words, it must be part of the Parent/Child tree
|
// In other words, it must be part of the Parent/Child tree
|
||||||
// The additional parts won't have additional parts themselves
|
// The additional parts won't have additional parts themselves
|
||||||
if (LocationType == LocationType.FileSystem && Parent != null)
|
if (LocationType == LocationType.FileSystem && GetParent() != null)
|
||||||
{
|
{
|
||||||
if (!IsStacked)
|
if (!IsStacked)
|
||||||
{
|
{
|
||||||
|
@ -548,10 +548,9 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// Gets the items.
|
/// Gets the items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="query">The query.</param>
|
/// <param name="query">The query.</param>
|
||||||
/// <param name="user">The user.</param>
|
|
||||||
/// <param name="parentIds">The parent ids.</param>
|
/// <param name="parentIds">The parent ids.</param>
|
||||||
/// <returns>List<BaseItem>.</returns>
|
/// <returns>List<BaseItem>.</returns>
|
||||||
IEnumerable<BaseItem> GetItems(InternalItemsQuery query, User user, IEnumerable<string> parentIds);
|
IEnumerable<BaseItem> GetItems(InternalItemsQuery query, IEnumerable<string> parentIds);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the items result.
|
/// Gets the items result.
|
||||||
|
@ -155,7 +155,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
// Not officially supported but in some cases we can handle it.
|
// Not officially supported but in some cases we can handle it.
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
item = parent.Parents.OfType<T>().FirstOrDefault();
|
item = parent.GetParents().OfType<T>().FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
return item != null;
|
return item != null;
|
||||||
|
@ -162,6 +162,7 @@
|
|||||||
<Compile Include="Entities\IHasThemeMedia.cs" />
|
<Compile Include="Entities\IHasThemeMedia.cs" />
|
||||||
<Compile Include="Entities\IHasTrailers.cs" />
|
<Compile Include="Entities\IHasTrailers.cs" />
|
||||||
<Compile Include="Entities\IHasUserData.cs" />
|
<Compile Include="Entities\IHasUserData.cs" />
|
||||||
|
<Compile Include="Entities\IHiddenFromDisplay.cs" />
|
||||||
<Compile Include="Entities\IItemByName.cs" />
|
<Compile Include="Entities\IItemByName.cs" />
|
||||||
<Compile Include="Entities\ILibraryItem.cs" />
|
<Compile Include="Entities\ILibraryItem.cs" />
|
||||||
<Compile Include="Entities\ImageSourceInfo.cs" />
|
<Compile Include="Entities\ImageSourceInfo.cs" />
|
||||||
|
@ -959,7 +959,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item = item.Parents.FirstOrDefault(i => i.HasImage(ImageType.Primary));
|
item = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Primary));
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
|
@ -225,7 +225,6 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
|
|
||||||
public int SharingExpirationDays { get; set; }
|
public int SharingExpirationDays { get; set; }
|
||||||
|
|
||||||
public bool DisableXmlSavers { get; set; }
|
|
||||||
public bool EnableWindowsShortcuts { get; set; }
|
public bool EnableWindowsShortcuts { get; set; }
|
||||||
|
|
||||||
public bool EnableVideoFrameByFrameAnalysis { get; set; }
|
public bool EnableVideoFrameByFrameAnalysis { get; set; }
|
||||||
@ -236,6 +235,7 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
|
|
||||||
public int MigrationVersion { get; set; }
|
public int MigrationVersion { get; set; }
|
||||||
public bool EnableImagePreDownloading { get; set; }
|
public bool EnableImagePreDownloading { get; set; }
|
||||||
|
public bool EnableSharedCollectionViewImage { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
||||||
|
@ -15,6 +15,12 @@ namespace MediaBrowser.Model.Library
|
|||||||
/// <value><c>true</c> if [include external content]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [include external content]; otherwise, <c>false</c>.</value>
|
||||||
public bool IncludeExternalContent { get; set; }
|
public bool IncludeExternalContent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether [include hidden].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [include hidden]; otherwise, <c>false</c>.</value>
|
||||||
|
public bool IncludeHidden { get; set; }
|
||||||
|
|
||||||
public UserViewQuery()
|
public UserViewQuery()
|
||||||
{
|
{
|
||||||
IncludeExternalContent = true;
|
IncludeExternalContent = true;
|
||||||
|
@ -1035,7 +1035,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var musicArtists = albums
|
var musicArtists = albums
|
||||||
.Select(i => i.Parent)
|
.Select(i => i.GetParent())
|
||||||
.OfType<MusicArtist>()
|
.OfType<MusicArtist>()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.Collections
|
|||||||
return subItem;
|
return subItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = subItem.Parent;
|
var parent = subItem.GetParent();
|
||||||
|
|
||||||
if (parent != null && parent.HasImage(ImageType.Primary))
|
if (parent != null && parent.HasImage(ImageType.Primary))
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Collections
|
namespace MediaBrowser.Server.Implementations.Collections
|
||||||
{
|
{
|
||||||
public class ManualCollectionsFolder : BasePluginFolder
|
public class ManualCollectionsFolder : BasePluginFolder, IHiddenFromDisplay
|
||||||
{
|
{
|
||||||
public ManualCollectionsFolder()
|
public ManualCollectionsFolder()
|
||||||
{
|
{
|
||||||
@ -19,7 +19,7 @@ namespace MediaBrowser.Server.Implementations.Collections
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsHiddenFromUser(User user)
|
public bool IsHiddenFromUser(User user)
|
||||||
{
|
{
|
||||||
return !user.Configuration.DisplayCollectionsView;
|
return !user.Configuration.DisplayCollectionsView;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
{
|
{
|
||||||
Person = byName.Name
|
Person = byName.Name
|
||||||
|
|
||||||
}, user, new string[] { });
|
}, new string[] { });
|
||||||
|
|
||||||
return items.ToList();
|
return items.ToList();
|
||||||
}
|
}
|
||||||
@ -812,7 +812,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
/// <returns>BaseItem.</returns>
|
/// <returns>BaseItem.</returns>
|
||||||
private BaseItem GetParentBackdropItem(BaseItem item, BaseItem owner)
|
private BaseItem GetParentBackdropItem(BaseItem item, BaseItem owner)
|
||||||
{
|
{
|
||||||
var parent = item.Parent ?? owner;
|
var parent = item.GetParent() ?? owner;
|
||||||
|
|
||||||
while (parent != null)
|
while (parent != null)
|
||||||
{
|
{
|
||||||
@ -821,7 +821,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent = parent.Parent;
|
parent = parent.GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -836,7 +836,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
/// <returns>BaseItem.</returns>
|
/// <returns>BaseItem.</returns>
|
||||||
private BaseItem GetParentImageItem(BaseItem item, ImageType type, BaseItem owner)
|
private BaseItem GetParentImageItem(BaseItem item, ImageType type, BaseItem owner)
|
||||||
{
|
{
|
||||||
var parent = item.Parent ?? owner;
|
var parent = item.GetParent() ?? owner;
|
||||||
|
|
||||||
while (parent != null)
|
while (parent != null)
|
||||||
{
|
{
|
||||||
@ -845,7 +845,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent = parent.Parent;
|
parent = parent.GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -1210,15 +1210,15 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
dto.VoteCount = item.VoteCount;
|
dto.VoteCount = item.VoteCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.IsFolder)
|
//if (item.IsFolder)
|
||||||
{
|
//{
|
||||||
var folder = (Folder)item;
|
// var folder = (Folder)item;
|
||||||
|
|
||||||
if (fields.Contains(ItemFields.IndexOptions))
|
// if (fields.Contains(ItemFields.IndexOptions))
|
||||||
{
|
// {
|
||||||
dto.IndexOptions = folder.IndexByOptionStrings.ToArray();
|
// dto.IndexOptions = folder.IndexByOptionStrings.ToArray();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
var supportsPlaceHolders = item as ISupportsPlaceHolders;
|
var supportsPlaceHolders = item as ISupportsPlaceHolders;
|
||||||
if (supportsPlaceHolders != null)
|
if (supportsPlaceHolders != null)
|
||||||
|
@ -74,7 +74,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||||||
// Go up one level for indicators
|
// Go up one level for indicators
|
||||||
if (baseItem != null)
|
if (baseItem != null)
|
||||||
{
|
{
|
||||||
var parent = baseItem.Parent;
|
var parent = baseItem.GetParent();
|
||||||
|
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
{
|
{
|
||||||
|
@ -217,7 +217,7 @@ namespace MediaBrowser.Server.Implementations.IO
|
|||||||
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
|
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
|
||||||
void LibraryManager_ItemRemoved(object sender, ItemChangeEventArgs e)
|
void LibraryManager_ItemRemoved(object sender, ItemChangeEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Item.Parent is AggregateFolder)
|
if (e.Item.GetParent() is AggregateFolder)
|
||||||
{
|
{
|
||||||
StopWatchingPath(e.Item.Path);
|
StopWatchingPath(e.Item.Path);
|
||||||
}
|
}
|
||||||
@ -230,7 +230,7 @@ namespace MediaBrowser.Server.Implementations.IO
|
|||||||
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
|
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
|
||||||
void LibraryManager_ItemAdded(object sender, ItemChangeEventArgs e)
|
void LibraryManager_ItemAdded(object sender, ItemChangeEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Item.Parent is AggregateFolder)
|
if (e.Item.GetParent() is AggregateFolder)
|
||||||
{
|
{
|
||||||
StartWatchingPath(e.Item.Path);
|
StartWatchingPath(e.Item.Path);
|
||||||
}
|
}
|
||||||
@ -658,7 +658,7 @@ namespace MediaBrowser.Server.Implementations.IO
|
|||||||
// If the item has been deleted find the first valid parent that still exists
|
// If the item has been deleted find the first valid parent that still exists
|
||||||
while (!_fileSystem.DirectoryExists(item.Path) && !_fileSystem.FileExists(item.Path))
|
while (!_fileSystem.DirectoryExists(item.Path) && !_fileSystem.FileExists(item.Path))
|
||||||
{
|
{
|
||||||
item = item.Parent;
|
item = item.GetParent();
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@ namespace MediaBrowser.Server.Implementations.Intros
|
|||||||
{
|
{
|
||||||
IncludeItemTypes = new[] { typeof(Movie).Name }
|
IncludeItemTypes = new[] { typeof(Movie).Name }
|
||||||
|
|
||||||
}, user, new string[]{});
|
}, new string[]{});
|
||||||
|
|
||||||
var itemsWithTrailers = inputItems
|
var itemsWithTrailers = inputItems
|
||||||
.Where(i =>
|
.Where(i =>
|
||||||
|
@ -27,6 +27,7 @@ using MediaBrowser.Server.Implementations.Library.Validators;
|
|||||||
using MediaBrowser.Server.Implementations.Logging;
|
using MediaBrowser.Server.Implementations.Logging;
|
||||||
using MediaBrowser.Server.Implementations.ScheduledTasks;
|
using MediaBrowser.Server.Implementations.ScheduledTasks;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
@ -36,6 +37,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommonIO;
|
using CommonIO;
|
||||||
using MediaBrowser.Model.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
|
using MediaBrowser.Model.Library;
|
||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
using SortOrder = MediaBrowser.Model.Entities.SortOrder;
|
using SortOrder = MediaBrowser.Model.Entities.SortOrder;
|
||||||
|
|
||||||
@ -140,6 +142,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
private readonly Func<ILibraryMonitor> _libraryMonitorFactory;
|
private readonly Func<ILibraryMonitor> _libraryMonitorFactory;
|
||||||
private readonly Func<IProviderManager> _providerManagerFactory;
|
private readonly Func<IProviderManager> _providerManagerFactory;
|
||||||
|
private readonly Func<IUserViewManager> _userviewManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _library items cache
|
/// The _library items cache
|
||||||
@ -167,7 +170,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
/// <param name="userManager">The user manager.</param>
|
/// <param name="userManager">The user manager.</param>
|
||||||
/// <param name="configurationManager">The configuration manager.</param>
|
/// <param name="configurationManager">The configuration manager.</param>
|
||||||
/// <param name="userDataRepository">The user data repository.</param>
|
/// <param name="userDataRepository">The user data repository.</param>
|
||||||
public LibraryManager(ILogger logger, ITaskManager taskManager, IUserManager userManager, IServerConfigurationManager configurationManager, IUserDataManager userDataRepository, Func<ILibraryMonitor> libraryMonitorFactory, IFileSystem fileSystem, Func<IProviderManager> providerManagerFactory)
|
public LibraryManager(ILogger logger, ITaskManager taskManager, IUserManager userManager, IServerConfigurationManager configurationManager, IUserDataManager userDataRepository, Func<ILibraryMonitor> libraryMonitorFactory, IFileSystem fileSystem, Func<IProviderManager> providerManagerFactory, Func<IUserViewManager> userviewManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_taskManager = taskManager;
|
_taskManager = taskManager;
|
||||||
@ -177,6 +180,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
_libraryMonitorFactory = libraryMonitorFactory;
|
_libraryMonitorFactory = libraryMonitorFactory;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_providerManagerFactory = providerManagerFactory;
|
_providerManagerFactory = providerManagerFactory;
|
||||||
|
_userviewManager = userviewManager;
|
||||||
ByReferenceItems = new ConcurrentDictionary<Guid, BaseItem>();
|
ByReferenceItems = new ConcurrentDictionary<Guid, BaseItem>();
|
||||||
_libraryItemsCache = new ConcurrentDictionary<Guid, BaseItem>();
|
_libraryItemsCache = new ConcurrentDictionary<Guid, BaseItem>();
|
||||||
|
|
||||||
@ -1307,7 +1311,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
return ItemRepository.GetItemIdsList(query);
|
return ItemRepository.GetItemIdsList(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<BaseItem> GetItems(InternalItemsQuery query, User user, IEnumerable<string> parentIds)
|
public IEnumerable<BaseItem> GetItems(InternalItemsQuery query, IEnumerable<string> parentIds)
|
||||||
{
|
{
|
||||||
var parents = parentIds.Select(i => GetItemById(new Guid(i))).ToList();
|
var parents = parentIds.Select(i => GetItemById(new Guid(i))).ToList();
|
||||||
|
|
||||||
@ -1329,7 +1333,14 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
{
|
{
|
||||||
if (query.AncestorIds.Length == 0 && !query.ParentId.HasValue && query.ChannelIds.Length == 0)
|
if (query.AncestorIds.Length == 0 && !query.ParentId.HasValue && query.ChannelIds.Length == 0)
|
||||||
{
|
{
|
||||||
// TODO: Need to filter on user folders
|
//var userViews = _userviewManager().GetUserViews(new UserViewQuery
|
||||||
|
//{
|
||||||
|
// UserId = user.Id.ToString("N"),
|
||||||
|
// IncludeHidden = true
|
||||||
|
|
||||||
|
//}, CancellationToken.None).Result.ToList();
|
||||||
|
|
||||||
|
//query.AncestorIds = userViews.SelectMany(i => i.GetIdsForAncestorQuery()).Distinct().Select(i => i.ToString("N")).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: handle blocking by tags
|
// TODO: handle blocking by tags
|
||||||
@ -1634,9 +1645,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
public IEnumerable<Folder> GetCollectionFolders(BaseItem item)
|
public IEnumerable<Folder> GetCollectionFolders(BaseItem item)
|
||||||
{
|
{
|
||||||
while (!(item.Parent is AggregateFolder) && item.Parent != null)
|
while (!(item.GetParent() is AggregateFolder) && item.GetParent() != null)
|
||||||
{
|
{
|
||||||
item = item.Parent;
|
item = item.GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
@ -1673,7 +1684,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
return item.Parents
|
return item.GetParents()
|
||||||
.Select(GetConfiguredContentType)
|
.Select(GetConfiguredContentType)
|
||||||
.LastOrDefault(i => !string.IsNullOrWhiteSpace(i));
|
.LastOrDefault(i => !string.IsNullOrWhiteSpace(i));
|
||||||
}
|
}
|
||||||
@ -1710,9 +1721,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
private string GetTopFolderContentType(BaseItem item)
|
private string GetTopFolderContentType(BaseItem item)
|
||||||
{
|
{
|
||||||
while (!(item.Parent is AggregateFolder) && item.Parent != null)
|
while (!(item.GetParent() is AggregateFolder) && item.GetParent() != null)
|
||||||
{
|
{
|
||||||
item = item.Parent;
|
item = item.GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
|
@ -86,7 +86,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
Genres = genreList.ToArray()
|
Genres = genreList.ToArray()
|
||||||
|
|
||||||
}, user, new string[] { });
|
}, new string[] { });
|
||||||
|
|
||||||
var genresDictionary = genreList.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
var genresDictionary = genreList.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());
|
item.Id = libraryManager.GetNewItemId(item.Path, item.GetType());
|
||||||
|
|
||||||
item.IsLocked = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1 ||
|
item.IsLocked = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
item.Parents.Any(i => i.IsLocked);
|
item.GetParents().Any(i => i.IsLocked);
|
||||||
|
|
||||||
// Make sure DateCreated and DateModified have values
|
// Make sure DateCreated and DateModified have values
|
||||||
var fileInfo = directoryService.GetFile(item.Path);
|
var fileInfo = directoryService.GetFile(item.Path);
|
||||||
@ -78,7 +78,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
EnsureName(item, args.FileInfo);
|
EnsureName(item, args.FileInfo);
|
||||||
|
|
||||||
item.IsLocked = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1 ||
|
item.IsLocked = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
item.Parents.Any(i => i.IsLocked);
|
item.GetParents().Any(i => i.IsLocked);
|
||||||
|
|
||||||
// Make sure DateCreated and DateModified have values
|
// Make sure DateCreated and DateModified have values
|
||||||
EnsureDates(fileSystem, item, args, true);
|
EnsureDates(fileSystem, item, args, true);
|
||||||
|
@ -95,7 +95,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
return ResolveVideos<Video>(parent, files, directoryService, false);
|
return ResolveVideos<Video>(parent, files, directoryService, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent is Series || parent.Parents.OfType<Series>().Any())
|
if (parent is Series || parent.GetParents().OfType<Series>().Any())
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||||||
// Not officially supported but in some cases we can handle it.
|
// Not officially supported but in some cases we can handle it.
|
||||||
if (season == null)
|
if (season == null)
|
||||||
{
|
{
|
||||||
season = parent.Parents.OfType<Season>().FirstOrDefault();
|
season = parent.GetParents().OfType<Season>().FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
|
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
|
||||||
|
@ -164,7 +164,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
IncludeItemTypes = includeItemTypes.ToArray(),
|
IncludeItemTypes = includeItemTypes.ToArray(),
|
||||||
Limit = query.Limit,
|
Limit = query.Limit,
|
||||||
|
|
||||||
}, user, new string[] { });
|
}, new string[] { });
|
||||||
|
|
||||||
// Add search hints based on item name
|
// Add search hints based on item name
|
||||||
hints.AddRange(mediaItems.Where(IncludeInSearch).Select(item =>
|
hints.AddRange(mediaItems.Where(IncludeInSearch).Select(item =>
|
||||||
|
@ -49,6 +49,15 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
.OfType<Folder>()
|
.OfType<Folder>()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
if (!query.IncludeHidden)
|
||||||
|
{
|
||||||
|
folders = folders.Where(i =>
|
||||||
|
{
|
||||||
|
var hidden = i as IHiddenFromDisplay;
|
||||||
|
return hidden == null || !hidden.IsHiddenFromUser(user);
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
var plainFolderIds = user.Configuration.PlainFolderViews.Select(i => new Guid(i)).ToList();
|
var plainFolderIds = user.Configuration.PlainFolderViews.Select(i => new Guid(i)).ToList();
|
||||||
|
|
||||||
var standaloneFolders = folders
|
var standaloneFolders = folders
|
||||||
@ -121,7 +130,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
if (parents.Count > 0)
|
if (parents.Count > 0)
|
||||||
{
|
{
|
||||||
list.Add(await GetUserView(parents, list, CollectionType.TvShows, string.Empty, user, enableUserViews, cancellationToken).ConfigureAwait(false));
|
list.Add(await GetUserView(parents, CollectionType.TvShows, string.Empty, user, enableUserViews, cancellationToken).ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
parents = foldersWithViewTypes.Where(i => string.Equals(i.GetViewType(user), CollectionType.Movies, StringComparison.OrdinalIgnoreCase) || string.IsNullOrWhiteSpace(i.GetViewType(user)))
|
parents = foldersWithViewTypes.Where(i => string.Equals(i.GetViewType(user), CollectionType.Movies, StringComparison.OrdinalIgnoreCase) || string.IsNullOrWhiteSpace(i.GetViewType(user)))
|
||||||
@ -129,7 +138,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
if (parents.Count > 0)
|
if (parents.Count > 0)
|
||||||
{
|
{
|
||||||
list.Add(await GetUserView(parents, list, CollectionType.Movies, string.Empty, user, enableUserViews, cancellationToken).ConfigureAwait(false));
|
list.Add(await GetUserView(parents, CollectionType.Movies, string.Empty, user, enableUserViews, cancellationToken).ConfigureAwait(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.Configuration.DisplayFoldersView)
|
if (user.Configuration.DisplayFoldersView)
|
||||||
@ -194,7 +203,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
return GetUserSubView(name, parentId, type, sortName, cancellationToken);
|
return GetUserSubView(name, parentId, type, sortName, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<UserView> GetUserView(List<ICollectionFolder> parents, List<Folder> currentViews, string viewType, string sortName, User user, bool enableUserViews, CancellationToken cancellationToken)
|
private async Task<UserView> GetUserView(List<ICollectionFolder> parents, string viewType, string sortName, User user, bool enableUserViews, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (parents.Count == 1 && parents.All(i => string.Equals((enableUserViews ? i.GetViewType(user) : i.CollectionType), viewType, StringComparison.OrdinalIgnoreCase)))
|
if (parents.Count == 1 && parents.All(i => string.Equals((enableUserViews ? i.GetViewType(user) : i.CollectionType), viewType, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
@ -305,7 +314,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
ExcludeLocationTypes = new[] { LocationType.Virtual },
|
ExcludeLocationTypes = new[] { LocationType.Virtual },
|
||||||
Limit = limit * 20
|
Limit = limit * 20
|
||||||
|
|
||||||
}, user, parentIds);
|
}, parentIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1170,7 +1170,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
var list = new List<LiveTvChannel>();
|
var list = new List<LiveTvChannel>();
|
||||||
|
|
||||||
var numComplete = 0;
|
var numComplete = 0;
|
||||||
var folder = await GetInternalLiveTvFolder(cancellationToken).ConfigureAwait(false);
|
var parentFolder = await GetInternalLiveTvFolder(cancellationToken).ConfigureAwait(false);
|
||||||
|
var parentFolderId = parentFolder.Id;
|
||||||
|
|
||||||
foreach (var channelInfo in allChannelsList)
|
foreach (var channelInfo in allChannelsList)
|
||||||
{
|
{
|
||||||
@ -1178,7 +1179,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var item = await GetChannel(channelInfo.Item2, channelInfo.Item1, folder.Id, cancellationToken).ConfigureAwait(false);
|
var item = await GetChannel(channelInfo.Item2, channelInfo.Item1, parentFolderId, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
|
|
||||||
@ -1390,7 +1391,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
internalQuery.ChannelIds = new[] { query.ChannelId };
|
internalQuery.ChannelIds = new[] { query.ChannelId };
|
||||||
}
|
}
|
||||||
|
|
||||||
var queryResult = _libraryManager.GetItems(internalQuery, user, new string[] { });
|
var queryResult = _libraryManager.GetItems(internalQuery, new string[] { });
|
||||||
IEnumerable<ILiveTvRecording> recordings = queryResult.Cast<ILiveTvRecording>();
|
IEnumerable<ILiveTvRecording> recordings = queryResult.Cast<ILiveTvRecording>();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(query.Id))
|
if (!string.IsNullOrEmpty(query.Id))
|
||||||
@ -1802,7 +1803,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
Limit = 1,
|
Limit = 1,
|
||||||
SortBy = new[] { "StartDate" }
|
SortBy = new[] { "StartDate" }
|
||||||
|
|
||||||
}, user, new string[] { }).Cast<LiveTvProgram>();
|
}, new string[] { }).Cast<LiveTvProgram>();
|
||||||
|
|
||||||
var currentProgram = programs.FirstOrDefault();
|
var currentProgram = programs.FirstOrDefault();
|
||||||
|
|
||||||
@ -1826,7 +1827,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
Limit = 1,
|
Limit = 1,
|
||||||
SortBy = new[] { "StartDate" }
|
SortBy = new[] { "StartDate" }
|
||||||
|
|
||||||
}, user, new string[] { }).Cast<LiveTvProgram>();
|
}, new string[] { }).Cast<LiveTvProgram>();
|
||||||
|
|
||||||
var currentProgram = programs.FirstOrDefault();
|
var currentProgram = programs.FirstOrDefault();
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
private IDbCommand _updateInheritedRatingCommand;
|
private IDbCommand _updateInheritedRatingCommand;
|
||||||
|
|
||||||
private const int LatestSchemaVersion = 29;
|
private const int LatestSchemaVersion = 32;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||||
@ -136,7 +136,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
"create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)",
|
"create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)",
|
||||||
|
|
||||||
"create table if not exists AncestorIds (ItemId GUID, AncestorId GUID, AncestorIdText TEXT, PRIMARY KEY (ItemId, AncestorId))",
|
"create table if not exists AncestorIds (ItemId GUID, AncestorId GUID, AncestorIdText TEXT, PRIMARY KEY (ItemId, AncestorId))",
|
||||||
"create index if not exists idx_AncestorIds on AncestorIds(ItemId,AncestorId)",
|
"create index if not exists idx_AncestorIds1 on AncestorIds(AncestorId)",
|
||||||
|
"create index if not exists idx_AncestorIds2 on AncestorIds(AncestorIdText)",
|
||||||
|
|
||||||
"create table if not exists ChildrenIds (ParentId GUID, ItemId GUID, PRIMARY KEY (ParentId, ItemId))",
|
"create table if not exists ChildrenIds (ParentId GUID, ItemId GUID, PRIMARY KEY (ParentId, ItemId))",
|
||||||
"create index if not exists idx_ChildrenIds on ChildrenIds(ParentId,ItemId)",
|
"create index if not exists idx_ChildrenIds on ChildrenIds(ParentId,ItemId)",
|
||||||
|
@ -47,7 +47,7 @@ namespace MediaBrowser.Server.Implementations.Playlists
|
|||||||
return subItem;
|
return subItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = subItem.Parent;
|
var parent = subItem.GetParent();
|
||||||
|
|
||||||
if (parent != null && parent.HasImage(ImageType.Primary))
|
if (parent != null && parent.HasImage(ImageType.Primary))
|
||||||
{
|
{
|
||||||
|
@ -1621,17 +1621,17 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||||||
|
|
||||||
if (backropItem == null)
|
if (backropItem == null)
|
||||||
{
|
{
|
||||||
backropItem = item.Parents.FirstOrDefault(i => i.HasImage(ImageType.Backdrop));
|
backropItem = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Backdrop));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thumbItem == null)
|
if (thumbItem == null)
|
||||||
{
|
{
|
||||||
thumbItem = item.Parents.FirstOrDefault(i => i.HasImage(ImageType.Thumb));
|
thumbItem = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Thumb));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logoItem == null)
|
if (logoItem == null)
|
||||||
{
|
{
|
||||||
logoItem = item.Parents.FirstOrDefault(i => i.HasImage(ImageType.Logo));
|
logoItem = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Logo));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thumbItem != null)
|
if (thumbItem != null)
|
||||||
|
@ -341,7 +341,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
|
|
||||||
if (primaryImage == null)
|
if (primaryImage == null)
|
||||||
{
|
{
|
||||||
var parentWithImage = item.Parents.FirstOrDefault(i => i.HasImage(ImageType.Primary));
|
var parentWithImage = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Primary));
|
||||||
|
|
||||||
if (parentWithImage != null)
|
if (parentWithImage != null)
|
||||||
{
|
{
|
||||||
@ -380,7 +380,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||||||
|
|
||||||
if (primaryImage == null)
|
if (primaryImage == null)
|
||||||
{
|
{
|
||||||
var parentWithImage = item.Parents.FirstOrDefault(i => i.HasImage(ImageType.Primary));
|
var parentWithImage = item.GetParents().FirstOrDefault(i => i.HasImage(ImageType.Primary));
|
||||||
|
|
||||||
if (parentWithImage != null)
|
if (parentWithImage != null)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ namespace MediaBrowser.Server.Implementations.TV
|
|||||||
IncludeItemTypes = new[] { typeof(Series).Name },
|
IncludeItemTypes = new[] { typeof(Series).Name },
|
||||||
SortOrder = SortOrder.Ascending
|
SortOrder = SortOrder.Ascending
|
||||||
|
|
||||||
}, user, parentIds).Cast<Series>();
|
}, parentIds).Cast<Series>();
|
||||||
|
|
||||||
// Avoid implicitly captured closure
|
// Avoid implicitly captured closure
|
||||||
var episodes = GetNextUpEpisodes(request, user, items);
|
var episodes = GetNextUpEpisodes(request, user, items);
|
||||||
@ -63,7 +63,7 @@ namespace MediaBrowser.Server.Implementations.TV
|
|||||||
IncludeItemTypes = new[] { typeof(Series).Name },
|
IncludeItemTypes = new[] { typeof(Series).Name },
|
||||||
SortOrder = SortOrder.Ascending
|
SortOrder = SortOrder.Ascending
|
||||||
|
|
||||||
}, user, parentsFolders.Select(i => i.Id.ToString("N"))).Cast<Series>();
|
}, parentsFolders.Select(i => i.Id.ToString("N"))).Cast<Series>();
|
||||||
|
|
||||||
// Avoid implicitly captured closure
|
// Avoid implicitly captured closure
|
||||||
var episodes = GetNextUpEpisodes(request, user, items);
|
var episodes = GetNextUpEpisodes(request, user, items);
|
||||||
|
@ -419,7 +419,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager, this, JsonSerializer, FileSystemManager);
|
UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager, this, JsonSerializer, FileSystemManager);
|
||||||
RegisterSingleInstance(UserManager);
|
RegisterSingleInstance(UserManager);
|
||||||
|
|
||||||
LibraryManager = new LibraryManager(Logger, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager);
|
LibraryManager = new LibraryManager(Logger, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager, () => UserViewManager);
|
||||||
RegisterSingleInstance(LibraryManager);
|
RegisterSingleInstance(LibraryManager);
|
||||||
|
|
||||||
var musicManager = new MusicManager(LibraryManager);
|
var musicManager = new MusicManager(LibraryManager);
|
||||||
|
Loading…
Reference in New Issue
Block a user