aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Devices/CameraUploadsFolder.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-08-16 13:30:16 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-08-16 13:30:16 -0400
commita57c887f7f367402cd1e3e215a8b8052f3c603da (patch)
tree750fa55f337c524728b038643fc296a6cf4b8cfe /Emby.Server.Implementations/Devices/CameraUploadsFolder.cs
parent56263a9fa26a93bbfa34f673be0e373572ec2fee (diff)
update components
Diffstat (limited to 'Emby.Server.Implementations/Devices/CameraUploadsFolder.cs')
-rw-r--r--Emby.Server.Implementations/Devices/CameraUploadsFolder.cs71
1 files changed, 71 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Devices/CameraUploadsFolder.cs b/Emby.Server.Implementations/Devices/CameraUploadsFolder.cs
new file mode 100644
index 000000000..55063872c
--- /dev/null
+++ b/Emby.Server.Implementations/Devices/CameraUploadsFolder.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Serialization;
+
+namespace Emby.Server.Implementations.Devices
+{
+ public class CameraUploadsFolder : BasePluginFolder, ISupportsUserSpecificView
+ {
+ public CameraUploadsFolder()
+ {
+ Name = "Camera Uploads";
+ }
+
+ public override bool IsVisible(User user)
+ {
+ if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
+ {
+ return false;
+ }
+
+ return base.IsVisible(user) && HasChildren();
+ }
+
+ [IgnoreDataMember]
+ public override string CollectionType
+ {
+ get { return MediaBrowser.Model.Entities.CollectionType.Photos; }
+ }
+
+ [IgnoreDataMember]
+ public override bool SupportsInheritedParentImages
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public override string GetClientTypeName()
+ {
+ return typeof(CollectionFolder).Name;
+ }
+
+ private bool? _hasChildren;
+ private bool HasChildren()
+ {
+ if (!_hasChildren.HasValue)
+ {
+ _hasChildren = LibraryManager.GetItemIds(new InternalItemsQuery { Parent = this }).Count > 0;
+ }
+
+ return _hasChildren.Value;
+ }
+
+ protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
+ {
+ _hasChildren = null;
+ return base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService);
+ }
+
+ [IgnoreDataMember]
+ public bool EnableUserSpecificView
+ {
+ get { return true; }
+ }
+ }
+}