aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-22 11:41:34 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-22 11:41:34 -0500
commitb7e5e21c975cc4953764d48c1dacbcd4dc149de9 (patch)
tree1bf66f65eb3a11b095b83c2d116fd70db919ba27 /MediaBrowser.Server.Implementations
parent7bc370bdc72df5dac395b8fee805284b845ed911 (diff)
update task buttons
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/Collections/CollectionManager.cs64
-rw-r--r--MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs50
-rw-r--r--MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json8
-rw-r--r--MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj1
4 files changed, 32 insertions, 91 deletions
diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
index d92db34e3..6100e3f5d 100644
--- a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
+++ b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs
@@ -167,18 +167,6 @@ namespace MediaBrowser.Server.Implementations.Collections
}
list.Add(LinkedChild.Create(item));
-
- var supportsGrouping = item as ISupportsBoxSetGrouping;
-
- if (supportsGrouping != null)
- {
- var boxsetIdList = supportsGrouping.BoxSetIdList.ToList();
- if (!boxsetIdList.Contains(collectionId))
- {
- boxsetIdList.Add(collectionId);
- }
- supportsGrouping.BoxSetIdList = boxsetIdList;
- }
}
collection.LinkedChildren.AddRange(list);
@@ -228,15 +216,6 @@ namespace MediaBrowser.Server.Implementations.Collections
{
itemList.Add(childItem);
}
-
- var supportsGrouping = childItem as ISupportsBoxSetGrouping;
-
- if (supportsGrouping != null)
- {
- var boxsetIdList = supportsGrouping.BoxSetIdList.ToList();
- boxsetIdList.Remove(collectionId);
- supportsGrouping.BoxSetIdList = boxsetIdList;
- }
}
var shortcutFiles = Directory
@@ -289,29 +268,40 @@ namespace MediaBrowser.Server.Implementations.Collections
public IEnumerable<BaseItem> CollapseItemsWithinBoxSets(IEnumerable<BaseItem> items, User user)
{
- var itemsToCollapse = new List<ISupportsBoxSetGrouping>();
- var boxsets = new List<BaseItem>();
+ var results = new Dictionary<Guid, BaseItem>();
+ var allBoxsets = new List<BoxSet>();
- var list = items.ToList();
-
- foreach (var item in list.OfType<ISupportsBoxSetGrouping>())
+ foreach (var item in items)
{
- var currentBoxSets = item.BoxSetIdList
- .Select(i => _libraryManager.GetItemById(i))
- .Where(i => i != null && i.IsVisible(user))
- .ToList();
+ var grouping = item as ISupportsBoxSetGrouping;
- if (currentBoxSets.Count > 0)
+ if (grouping == null)
+ {
+ results[item.Id] = item;
+ }
+ else
{
- itemsToCollapse.Add(item);
- boxsets.AddRange(currentBoxSets);
+ var itemId = item.Id;
+
+ var currentBoxSets = allBoxsets
+ .Where(i => i.GetLinkedChildren().Any(j => j.Id == itemId))
+ .ToList();
+
+ if (currentBoxSets.Count > 0)
+ {
+ foreach (var boxset in currentBoxSets)
+ {
+ results[boxset.Id] = boxset;
+ }
+ }
+ else
+ {
+ results[item.Id] = item;
+ }
}
}
- return list
- .Except(itemsToCollapse.Cast<BaseItem>())
- .Concat(boxsets)
- .DistinctBy(i => i.Id);
+ return results.Values;
}
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs b/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs
deleted file mode 100644
index 86d88f7e0..000000000
--- a/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Entities.Movies;
-using MediaBrowser.Controller.Library;
-using System;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace MediaBrowser.Server.Implementations.Library.Validators
-{
- public class BoxSetPostScanTask : ILibraryPostScanTask
- {
- private readonly ILibraryManager _libraryManager;
-
- public BoxSetPostScanTask(ILibraryManager libraryManager)
- {
- _libraryManager = libraryManager;
- }
-
- public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
- {
- var items = _libraryManager.RootFolder.RecursiveChildren.ToList();
-
- var boxsets = items.OfType<BoxSet>().ToList();
-
- var numComplete = 0;
-
- foreach (var boxset in boxsets)
- {
- foreach (var child in boxset.Children.Concat(boxset.GetLinkedChildren()).OfType<ISupportsBoxSetGrouping>())
- {
- var boxsetIdList = child.BoxSetIdList.ToList();
- if (!boxsetIdList.Contains(boxset.Id))
- {
- boxsetIdList.Add(boxset.Id);
- }
- child.BoxSetIdList = boxsetIdList;
- }
-
- numComplete++;
- double percent = numComplete;
- percent /= boxsets.Count;
- progress.Report(percent * 100);
- }
-
- progress.Report(100);
- return Task.FromResult(true);
- }
- }
-}
diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json
index 62619a567..4206ccf59 100644
--- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json
+++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json
@@ -45,6 +45,8 @@
"ButtonHelp": "Help",
"ButtonSave": "Save",
"HeaderDevices": "Devices",
+ "ButtonScheduledTasks": "Scheduled tasks",
+ "ConfirmMessageScheduledTaskButton": "This operation normally runs automatically as a scheduled task. It can also be run manually here. To configure the scheduled task, see:",
"HeaderSupporterBenefit": "A supporter membership provides additional benefits such as access to premium plugins, internet channel content, and more. {0}Learn more{1}.",
"HeaderWelcomeToMediaBrowserServerDashboard": "Welcome to the Media Browser Dashboard",
"HeaderWelcomeToMediaBrowserWebClient": "Welcome to the Media Browser Web Client",
@@ -59,7 +61,7 @@
"ButtonCancelItem": "Cancel item",
"ButtonQueueForRetry": "Queue for retry",
"ButtonReenable": "Re-enable",
- "SyncJobItemStatusSyncedMarkForRemoval": "Marked for removal",
+ "SyncJobItemStatusSyncedMarkForRemoval": "Marked for removal",
"LabelAbortedByServerShutdown": "(Aborted by server shutdown)",
"LabelScheduledTaskLastRan": "Last ran {0}, taking {1}.",
"HeaderDeleteTaskTrigger": "Delete Task Trigger",
@@ -71,8 +73,8 @@
"LabelFree": "Free",
"HeaderSelectAudio": "Select Audio",
"HeaderSelectSubtitles": "Select Subtitles",
- "ButtonMarkForRemoval": "Mark for removal from device",
- "ButtonUnmarkForRemoval": "Unmark for removal from device",
+ "ButtonMarkForRemoval": "Mark for removal from device",
+ "ButtonUnmarkForRemoval": "Unmark for removal from device",
"LabelDefaultStream": "(Default)",
"LabelForcedStream": "(Forced)",
"LabelDefaultForcedStream": "(Default/Forced)",
diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
index 548ac07aa..fe5642dbc 100644
--- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
+++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
@@ -209,7 +209,6 @@
<Compile Include="Library\UserViewManager.cs" />
<Compile Include="Library\Validators\ArtistsPostScanTask.cs" />
<Compile Include="Library\Validators\ArtistsValidator.cs" />
- <Compile Include="Library\Validators\BoxSetPostScanTask.cs" />
<Compile Include="Library\Validators\GameGenresPostScanTask.cs" />
<Compile Include="Library\Validators\GameGenresValidator.cs" />
<Compile Include="Library\Validators\GenresPostScanTask.cs" />