aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
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
parent02e25b48550ffef016d20fe3f070c8552633cbef (diff)
update translations
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Activity/IActivityManager.cs2
-rw-r--r--MediaBrowser.Controller/Activity/IActivityRepository.cs3
-rw-r--r--MediaBrowser.Controller/Channels/ChannelFolderItem.cs1
-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
-rw-r--r--MediaBrowser.Controller/Library/IUserViewManager.cs2
-rw-r--r--MediaBrowser.Controller/LiveTv/ILiveTvManager.cs17
-rw-r--r--MediaBrowser.Controller/LiveTv/RecordingGroup.cs22
-rw-r--r--MediaBrowser.Controller/MediaBrowser.Controller.csproj1
-rw-r--r--MediaBrowser.Controller/Playlists/Playlist.cs40
16 files changed, 197 insertions, 7 deletions
diff --git a/MediaBrowser.Controller/Activity/IActivityManager.cs b/MediaBrowser.Controller/Activity/IActivityManager.cs
index 0c565ae36..728548911 100644
--- a/MediaBrowser.Controller/Activity/IActivityManager.cs
+++ b/MediaBrowser.Controller/Activity/IActivityManager.cs
@@ -12,6 +12,6 @@ namespace MediaBrowser.Controller.Activity
Task Create(ActivityLogEntry entry);
- QueryResult<ActivityLogEntry> GetActivityLogEntries(int? startIndex, int? limit);
+ QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit);
}
}
diff --git a/MediaBrowser.Controller/Activity/IActivityRepository.cs b/MediaBrowser.Controller/Activity/IActivityRepository.cs
index 29e60ff1f..7ccbc2e99 100644
--- a/MediaBrowser.Controller/Activity/IActivityRepository.cs
+++ b/MediaBrowser.Controller/Activity/IActivityRepository.cs
@@ -1,5 +1,6 @@
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Querying;
+using System;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Activity
@@ -8,6 +9,6 @@ namespace MediaBrowser.Controller.Activity
{
Task Create(ActivityLogEntry entry);
- QueryResult<ActivityLogEntry> GetActivityLogEntries(int? startIndex, int? limit);
+ QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit);
}
}
diff --git a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
index d6e315fd1..077138f3c 100644
--- a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
@@ -1,7 +1,6 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Configuration;
-using System.Collections.Generic;
namespace MediaBrowser.Controller.Channels
{
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);
diff --git a/MediaBrowser.Controller/Library/IUserViewManager.cs b/MediaBrowser.Controller/Library/IUserViewManager.cs
index 7c352d97a..908525a2f 100644
--- a/MediaBrowser.Controller/Library/IUserViewManager.cs
+++ b/MediaBrowser.Controller/Library/IUserViewManager.cs
@@ -9,5 +9,7 @@ namespace MediaBrowser.Controller.Library
public interface IUserViewManager
{
Task<IEnumerable<Folder>> GetUserViews(UserViewQuery query, CancellationToken cancellationToken);
+
+ Task<UserView> GetUserView(string type, User user, string sortName, CancellationToken cancellationToken);
}
}
diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs
index d40ecb463..b1c6ebffc 100644
--- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs
+++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs
@@ -280,5 +280,22 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <returns>IEnumerable{User}.</returns>
IEnumerable<User> GetEnabledUsers();
+
+ /// <summary>
+ /// Gets the internal channels.
+ /// </summary>
+ /// <param name="query">The query.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task&lt;QueryResult&lt;LiveTvChannel&gt;&gt;.</returns>
+ Task<QueryResult<LiveTvChannel>> GetInternalChannels(LiveTvChannelQuery query,
+ CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Gets the internal recordings.
+ /// </summary>
+ /// <param name="query">The query.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task&lt;QueryResult&lt;BaseItem&gt;&gt;.</returns>
+ Task<QueryResult<BaseItem>> GetInternalRecordings(RecordingQuery query, CancellationToken cancellationToken);
}
}
diff --git a/MediaBrowser.Controller/LiveTv/RecordingGroup.cs b/MediaBrowser.Controller/LiveTv/RecordingGroup.cs
new file mode 100644
index 000000000..7bd810b8d
--- /dev/null
+++ b/MediaBrowser.Controller/LiveTv/RecordingGroup.cs
@@ -0,0 +1,22 @@
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Model.Configuration;
+
+namespace MediaBrowser.Controller.LiveTv
+{
+ public class RecordingGroup : Folder
+ {
+ protected override bool GetBlockUnratedValue(UserConfiguration config)
+ {
+ // Don't block.
+ return false;
+ }
+
+ public override bool SupportsLocalMetadata
+ {
+ get
+ {
+ return false;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index 28e1ffb1c..d12c36fba 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -168,6 +168,7 @@
<Compile Include="Library\LibraryManagerExtensions.cs" />
<Compile Include="Library\PlaybackStopEventArgs.cs" />
<Compile Include="Library\UserDataSaveEventArgs.cs" />
+ <Compile Include="LiveTv\RecordingGroup.cs" />
<Compile Include="LiveTv\RecordingStatusChangedEventArgs.cs" />
<Compile Include="LiveTv\ILiveTvRecording.cs" />
<Compile Include="LiveTv\LiveStreamInfo.cs" />
diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs
index ec3e03339..7822623a9 100644
--- a/MediaBrowser.Controller/Playlists/Playlist.cs
+++ b/MediaBrowser.Controller/Playlists/Playlist.cs
@@ -12,6 +12,14 @@ namespace MediaBrowser.Controller.Playlists
{
public string OwnerUserId { get; set; }
+ protected override bool FilterLinkedChildrenPerUser
+ {
+ get
+ {
+ return true;
+ }
+ }
+
public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
{
return GetPlayableItems(user);
@@ -34,7 +42,12 @@ namespace MediaBrowser.Controller.Playlists
public static IEnumerable<BaseItem> GetPlaylistItems(string playlistMediaType, IEnumerable<BaseItem> inputItems, User user)
{
- return inputItems.SelectMany(i =>
+ if (user != null)
+ {
+ inputItems = inputItems.Where(i => i.IsVisible(user));
+ }
+
+ inputItems = inputItems.SelectMany(i =>
{
var folder = i as Folder;
@@ -58,6 +71,31 @@ namespace MediaBrowser.Controller.Playlists
return new[] { i };
}).Where(m => string.Equals(m.MediaType, playlistMediaType, StringComparison.OrdinalIgnoreCase));
+
+ return FilterInaccessibleItems(inputItems, user);
+ }
+
+ public static IEnumerable<BaseItem> FilterInaccessibleItems(IEnumerable<BaseItem> items, User user)
+ {
+ return items;
+ //var locations = user.RootFolder.Children.OfType<CollectionFolder>().SelectMany(i => i.PhysicalLocations).ToList();
+
+ //return items.Where(i =>
+ //{
+ // var parent = i.Parent;
+
+ // while (parent != null)
+ // {
+ // parent = parent.Parent;
+
+ // if (parent != null && parent.Parent is AggregateFolder)
+ // {
+ // break;
+ // }
+ // }
+
+ // return parent == null || locations.Contains(parent.Path, StringComparer.OrdinalIgnoreCase);
+ //});
}
[IgnoreDataMember]