aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-24 17:33:26 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-24 17:33:26 -0500
commit67559378009062a26173888ad457d0c9116bfc9a (patch)
tree0bfeb5b72b6dd39d696f45840b592458390d0499 /MediaBrowser.Server.Implementations
parentee00f8bf726ae5498d64cff0086b9b7e638936ea (diff)
sync updates
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs4
-rw-r--r--MediaBrowser.Server.Implementations/FileOrganization/NameUtils.cs3
-rw-r--r--MediaBrowser.Server.Implementations/Library/UserViewManager.cs20
-rw-r--r--MediaBrowser.Server.Implementations/Localization/Server/server.json2
-rw-r--r--MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj1
-rw-r--r--MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs12
-rw-r--r--MediaBrowser.Server.Implementations/Sync/SyncRegistrationInfo.cs31
7 files changed, 51 insertions, 22 deletions
diff --git a/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs b/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs
index fa4de728b9..bbe37cb506 100644
--- a/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs
+++ b/MediaBrowser.Server.Implementations/Collections/ManualCollectionsFolder.cs
@@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.Movies;
using System.Linq;
namespace MediaBrowser.Server.Implementations.Collections
@@ -14,7 +15,8 @@ namespace MediaBrowser.Server.Implementations.Collections
public override bool IsVisible(User user)
{
return base.IsVisible(user) && GetChildren(user, false)
- .Any();
+ .OfType<BoxSet>()
+ .Any(i => i.IsVisible(user));
}
public override bool IsHidden
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/NameUtils.cs b/MediaBrowser.Server.Implementations/FileOrganization/NameUtils.cs
index 795be1e2f3..624133d4fb 100644
--- a/MediaBrowser.Server.Implementations/FileOrganization/NameUtils.cs
+++ b/MediaBrowser.Server.Implementations/FileOrganization/NameUtils.cs
@@ -54,9 +54,6 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
private static string GetComparableName(string name)
{
- // TODO: Improve this - should ignore spaces, periods, underscores, most likely all symbols and
- // possibly remove sorting words like "the", "and", etc.
-
name = RemoveDiacritics(name);
name = " " + name + " ";
diff --git a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
index bd0f44adc2..d8c5f85c02 100644
--- a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
@@ -88,24 +88,10 @@ namespace MediaBrowser.Server.Implementations.Library
list.Add(await GetUserView(CollectionType.Games, string.Empty, cancellationToken).ConfigureAwait(false));
}
- if (user.Configuration.DisplayCollectionsView)
+ if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase)))
{
- bool showCollectionView;
- if (_config.Configuration.EnableLegacyCollections)
- {
- showCollectionView = folders
- .Except(standaloneFolders)
- .SelectMany(i => i.GetRecursiveChildren(user, false)).OfType<BoxSet>().Any();
- }
- else
- {
- showCollectionView = _collectionManager.GetCollections(user).Any();
- }
-
- if (showCollectionView)
- {
- list.Add(await GetUserView(CollectionType.BoxSets, string.Empty, cancellationToken).ConfigureAwait(false));
- }
+ //list.Add(_collectionManager.GetCollectionsFolder(user.Id.ToString("N")));
+ list.Add(await GetUserView(CollectionType.BoxSets, string.Empty, cancellationToken).ConfigureAwait(false));
}
if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase)))
diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json
index 34a0b327d3..15bc624123 100644
--- a/MediaBrowser.Server.Implementations/Localization/Server/server.json
+++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json
@@ -55,6 +55,8 @@
"HeaderAudio": "Audio",
"HeaderVideo": "Video",
"HeaderPaths": "Paths",
+ "HeaderSyncRequiresSupporterMembership": "Sync Requires a Supporter Membership",
+ "HeaderEnjoyDayTrial": "Enjoy a 14 Day Free Trial",
"LabelSyncTempPath": "Temporary file path:",
"LabelSyncTempPathHelp": "Specify a custom sync working folder. Converted media created during the sync process will be stored here.",
"LabelCustomCertificatePath": "Custom certificate path:",
diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
index e95bd6503b..30384d1ffc 100644
--- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
+++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
@@ -306,6 +306,7 @@
<Compile Include="Sorting\VideoBitRateComparer.cs" />
<Compile Include="Sync\AppSyncProvider.cs" />
<Compile Include="Sync\CloudSyncProvider.cs" />
+ <Compile Include="Sync\SyncRegistrationInfo.cs" />
<Compile Include="Sync\SyncConfig.cs" />
<Compile Include="Sync\SyncJobProcessor.cs" />
<Compile Include="Sync\SyncManager.cs" />
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
index 716584084c..b926ee3388 100644
--- a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
+++ b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
@@ -90,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.Sync
continue;
}
- var index = jobItems.Count == 0 ?
+ var index = jobItems.Count == 0 ?
0 :
(jobItems.Select(i => i.JobItemIndex).Max() + 1);
@@ -348,10 +348,20 @@ namespace MediaBrowser.Server.Implementations.Sync
private void CleanDeadSyncFiles()
{
// TODO
+ // Clean files in sync temp folder that are not linked to any sync jobs
}
public async Task SyncJobItems(SyncJobItem[] items, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
{
+ if (items.Length > 0)
+ {
+ if (!SyncRegistrationInfo.Instance.IsRegistered)
+ {
+ _logger.Debug("Cancelling sync job processing. Please obtain a supporter membership.");
+ return;
+ }
+ }
+
var numComplete = 0;
foreach (var item in items)
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncRegistrationInfo.cs b/MediaBrowser.Server.Implementations/Sync/SyncRegistrationInfo.cs
new file mode 100644
index 0000000000..40b84b1c21
--- /dev/null
+++ b/MediaBrowser.Server.Implementations/Sync/SyncRegistrationInfo.cs
@@ -0,0 +1,31 @@
+using MediaBrowser.Common.Security;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Server.Implementations.Sync
+{
+ public class SyncRegistrationInfo : IRequiresRegistration
+ {
+ private readonly ISecurityManager _securityManager;
+
+ public static SyncRegistrationInfo Instance;
+
+ public SyncRegistrationInfo(ISecurityManager securityManager)
+ {
+ _securityManager = securityManager;
+ Instance = this;
+ }
+
+ private bool _registered;
+ public bool IsRegistered
+ {
+ get { return _registered; }
+ }
+
+ public async Task LoadRegistrationInfoAsync()
+ {
+ var info = await _securityManager.GetRegistrationStatus("sync").ConfigureAwait(false);
+
+ _registered = info.IsValid;
+ }
+ }
+}