aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-08-14 09:24:30 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-08-14 09:24:30 -0400
commit9c5cceb4ecc277ffb5a3a988f655ad674bf41c58 (patch)
tree0077c03cb06e2dc7700315f90db9ee51fedeb00d /MediaBrowser.Controller/Entities
parent02e25b48550ffef016d20fe3f070c8552633cbef (diff)
update translations
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs11
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs27
-rw-r--r--MediaBrowser.Controller/Entities/IHasImages.cs6
-rw-r--r--MediaBrowser.Controller/Entities/IHasMediaSources.cs6
-rw-r--r--MediaBrowser.Controller/Entities/LinkedChild.cs1
-rw-r--r--MediaBrowser.Controller/Entities/Movies/BoxSet.cs19
-rw-r--r--MediaBrowser.Controller/Entities/TV/Episode.cs14
-rw-r--r--MediaBrowser.Controller/Entities/UserView.cs32
8 files changed, 113 insertions, 3 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index fdffa60d0..e718a53ff 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Localization;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
@@ -66,6 +67,15 @@ namespace MediaBrowser.Controller.Entities
/// <value><c>true</c> if this instance is in mixed folder; otherwise, <c>false</c>.</value>
public bool IsInMixedFolder { get; set; }
+ [IgnoreDataMember]
+ public virtual bool SupportsRemoteImageDownloading
+ {
+ get
+ {
+ return true;
+ }
+ }
+
private string _name;
/// <summary>
/// Gets or sets the name.
@@ -227,6 +237,7 @@ namespace MediaBrowser.Controller.Entities
public static IItemRepository ItemRepository { get; set; }
public static IFileSystem FileSystem { get; set; }
public static IUserDataManager UserDataManager { get; set; }
+ public static ILiveTvManager LiveTvManager { get; set; }
/// <summary>
/// Returns a <see cref="System.String" /> that represents this instance.
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 243d7fd2d..96a8c579e 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -840,7 +840,7 @@ namespace MediaBrowser.Controller.Entities
if (includeLinkedChildren)
{
- foreach (var child in GetLinkedChildren())
+ foreach (var child in GetLinkedChildren(user))
{
if (child.IsVisible(user))
{
@@ -924,6 +924,31 @@ namespace MediaBrowser.Controller.Entities
.Where(i => i != null);
}
+ protected virtual bool FilterLinkedChildrenPerUser
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public IEnumerable<BaseItem> GetLinkedChildren(User user)
+ {
+ if (!FilterLinkedChildrenPerUser)
+ {
+ return GetLinkedChildren();
+ }
+
+ var locations = user.RootFolder
+ .Children
+ .OfType<CollectionFolder>()
+ .SelectMany(i => i.PhysicalLocations)
+ .ToList();
+
+ return LinkedChildren.Where(i => string.IsNullOrWhiteSpace(i.Path) || locations.Any(l => FileSystem.ContainsSubPath(l, i.Path)))
+ .Select(GetLinkedChild)
+ .Where(i => i != null);
+ }
/// <summary>
/// Gets the linked children.
diff --git a/MediaBrowser.Controller/Entities/IHasImages.cs b/MediaBrowser.Controller/Entities/IHasImages.cs
index bac226369..67acc1cae 100644
--- a/MediaBrowser.Controller/Entities/IHasImages.cs
+++ b/MediaBrowser.Controller/Entities/IHasImages.cs
@@ -154,6 +154,12 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <value><c>true</c> if this instance is locked; otherwise, <c>false</c>.</value>
bool IsLocked { get; }
+
+ /// <summary>
+ /// Gets a value indicating whether [supports remote image downloading].
+ /// </summary>
+ /// <value><c>true</c> if [supports remote image downloading]; otherwise, <c>false</c>.</value>
+ bool SupportsRemoteImageDownloading { get; }
}
public static class HasImagesExtensions
diff --git a/MediaBrowser.Controller/Entities/IHasMediaSources.cs b/MediaBrowser.Controller/Entities/IHasMediaSources.cs
index da040f296..d487362f5 100644
--- a/MediaBrowser.Controller/Entities/IHasMediaSources.cs
+++ b/MediaBrowser.Controller/Entities/IHasMediaSources.cs
@@ -10,6 +10,12 @@ namespace MediaBrowser.Controller.Entities
public interface IHasMediaSources
{
/// <summary>
+ /// Gets the identifier.
+ /// </summary>
+ /// <value>The identifier.</value>
+ Guid Id { get; }
+
+ /// <summary>
/// Gets the media sources.
/// </summary>
/// <param name="enablePathSubstitution">if set to <c>true</c> [enable path substitution].</param>
diff --git a/MediaBrowser.Controller/Entities/LinkedChild.cs b/MediaBrowser.Controller/Entities/LinkedChild.cs
index eb94b37db..78e8e4959 100644
--- a/MediaBrowser.Controller/Entities/LinkedChild.cs
+++ b/MediaBrowser.Controller/Entities/LinkedChild.cs
@@ -19,7 +19,6 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Serves as a cache
/// </summary>
- [IgnoreDataMember]
public Guid? ItemId { get; set; }
public static LinkedChild Create(BaseItem item)
diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
index 19c960167..5d8fff38f 100644
--- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
+++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
@@ -1,5 +1,6 @@
using System.Runtime.Serialization;
using MediaBrowser.Common.Progress;
+using MediaBrowser.Controller.Playlists;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
@@ -26,6 +27,14 @@ namespace MediaBrowser.Controller.Entities.Movies
Keywords = new List<string>();
}
+ protected override bool FilterLinkedChildrenPerUser
+ {
+ get
+ {
+ return true;
+ }
+ }
+
public List<Guid> LocalTrailerIds { get; set; }
/// <summary>
@@ -72,6 +81,8 @@ namespace MediaBrowser.Controller.Entities.Movies
{
var children = base.GetChildren(user, includeLinkedChildren);
+ children = Playlist.FilterInaccessibleItems(children, user);
+
if (string.Equals(DisplayOrder, ItemSortBy.SortName, StringComparison.OrdinalIgnoreCase))
{
// Sort by name
@@ -83,11 +94,17 @@ namespace MediaBrowser.Controller.Entities.Movies
// Sort by release date
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);
}
-
+
// Default sorting
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);
}
+ public override IEnumerable<BaseItem> GetRecursiveChildren(User user, bool includeLinkedChildren = true)
+ {
+ var children = base.GetRecursiveChildren(user, includeLinkedChildren);
+ return Playlist.FilterInaccessibleItems(children, user);
+ }
+
public BoxSetInfo GetLookupInfo()
{
return GetItemLookupInfo<BoxSetInfo>();
diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs
index 8a554c1d5..70577bbfd 100644
--- a/MediaBrowser.Controller/Entities/TV/Episode.cs
+++ b/MediaBrowser.Controller/Entities/TV/Episode.cs
@@ -189,6 +189,20 @@ namespace MediaBrowser.Controller.Entities.TV
}
[IgnoreDataMember]
+ public override bool SupportsRemoteImageDownloading
+ {
+ get
+ {
+ if (IsMissingEpisode)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ [IgnoreDataMember]
public bool IsMissingEpisode
{
get
diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs
index 34ca85d1d..2abc71752 100644
--- a/MediaBrowser.Controller/Entities/UserView.cs
+++ b/MediaBrowser.Controller/Entities/UserView.cs
@@ -1,15 +1,20 @@
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.LiveTv;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
namespace MediaBrowser.Controller.Entities
{
public class UserView : Folder
{
public string ViewType { get; set; }
+ public static IUserViewManager UserViewManager { get; set; }
public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
@@ -17,6 +22,23 @@ namespace MediaBrowser.Controller.Entities
switch (ViewType)
{
+ case CollectionType.LiveTvChannels:
+ return LiveTvManager.GetInternalChannels(new LiveTvChannelQuery
+ {
+ UserId = user.Id.ToString("N")
+
+ }, CancellationToken.None).Result.Items;
+ case CollectionType.LiveTvRecordingGroups:
+ return LiveTvManager.GetInternalRecordings(new RecordingQuery
+ {
+ UserId = user.Id.ToString("N"),
+ Status = RecordingStatus.Completed
+
+ }, CancellationToken.None).Result.Items;
+ case CollectionType.LiveTv:
+ return GetLiveTvFolders(user).Result;
+ case CollectionType.Folders:
+ return user.RootFolder.GetChildren(user, includeLinkedChildren);
case CollectionType.Games:
return mediaFolders.SelectMany(i => i.GetRecursiveChildren(user, includeLinkedChildren))
.OfType<GameSystem>();
@@ -34,6 +56,16 @@ namespace MediaBrowser.Controller.Entities
}
}
+ private async Task<IEnumerable<BaseItem>> GetLiveTvFolders(User user)
+ {
+ var list = new List<BaseItem>();
+
+ list.Add(await UserViewManager.GetUserView(CollectionType.LiveTvChannels, user, string.Empty, CancellationToken.None).ConfigureAwait(false));
+ list.Add(await UserViewManager.GetUserView(CollectionType.LiveTvRecordingGroups, user, string.Empty, CancellationToken.None).ConfigureAwait(false));
+
+ return list;
+ }
+
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
{
return GetChildren(user, false);