update task buttons

This commit is contained in:
Luke Pulverenti
2015-01-22 11:41:34 -05:00
parent 7bc370bdc7
commit b7e5e21c97
22 changed files with 86 additions and 324 deletions

View File

@@ -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)
{
itemsToCollapse.Add(item);
boxsets.AddRange(currentBoxSets);
results[item.Id] = item;
}
else
{
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;
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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)",

View File

@@ -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" />