fixes #519 - Add third wizard page

This commit is contained in:
Luke Pulverenti 2013-09-05 13:05:39 -04:00
parent 7b6bf545da
commit 6d407033ce
6 changed files with 112 additions and 22 deletions

View File

@ -1,4 +1,5 @@
using MediaBrowser.Controller;
using System.Threading.Tasks;
using MediaBrowser.Controller;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
@ -45,6 +46,12 @@ namespace MediaBrowser.Api.Library
/// </summary>
/// <value>The type of the collection.</value>
public string CollectionType { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [refresh library].
/// </summary>
/// <value><c>true</c> if [refresh library]; otherwise, <c>false</c>.</value>
public bool RefreshLibrary { get; set; }
}
[Route("/Library/VirtualFolders/{Name}", "DELETE")]
@ -62,6 +69,12 @@ namespace MediaBrowser.Api.Library
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [refresh library].
/// </summary>
/// <value><c>true</c> if [refresh library]; otherwise, <c>false</c>.</value>
public bool RefreshLibrary { get; set; }
}
[Route("/Library/VirtualFolders/{Name}/Name", "POST")]
@ -85,6 +98,12 @@ namespace MediaBrowser.Api.Library
/// </summary>
/// <value>The name.</value>
public string NewName { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [refresh library].
/// </summary>
/// <value><c>true</c> if [refresh library]; otherwise, <c>false</c>.</value>
public bool RefreshLibrary { get; set; }
}
[Route("/Library/VirtualFolders/{Name}/Paths", "POST")]
@ -108,6 +127,12 @@ namespace MediaBrowser.Api.Library
/// </summary>
/// <value>The name.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [refresh library].
/// </summary>
/// <value><c>true</c> if [refresh library]; otherwise, <c>false</c>.</value>
public bool RefreshLibrary { get; set; }
}
[Route("/Library/VirtualFolders/{Name}/Paths", "DELETE")]
@ -131,6 +156,12 @@ namespace MediaBrowser.Api.Library
/// </summary>
/// <value>The name.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [refresh library].
/// </summary>
/// <value><c>true</c> if [refresh library]; otherwise, <c>false</c>.</value>
public bool RefreshLibrary { get; set; }
}
/// <summary>
@ -202,7 +233,7 @@ namespace MediaBrowser.Api.Library
/// Posts the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(AddVirtualFolder request)
public async void Post(AddVirtualFolder request)
{
_directoryWatchers.Stop();
@ -218,20 +249,26 @@ namespace MediaBrowser.Api.Library
LibraryHelpers.AddVirtualFolder(request.Name, request.CollectionType, user, _appPaths);
}
// Need to add a delay here or directory watchers may still pick up the changes
await Task.Delay(1000).ConfigureAwait(false);
}
finally
{
_directoryWatchers.Start();
}
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
if (request.RefreshLibrary)
{
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
}
}
/// <summary>
/// Posts the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(RenameVirtualFolder request)
public async void Post(RenameVirtualFolder request)
{
_directoryWatchers.Stop();
@ -247,20 +284,26 @@ namespace MediaBrowser.Api.Library
LibraryHelpers.RenameVirtualFolder(request.Name, request.NewName, user, _appPaths);
}
// Need to add a delay here or directory watchers may still pick up the changes
await Task.Delay(1000).ConfigureAwait(false);
}
finally
{
_directoryWatchers.Start();
}
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
if (request.RefreshLibrary)
{
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
}
}
/// <summary>
/// Deletes the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Delete(RemoveVirtualFolder request)
public async void Delete(RemoveVirtualFolder request)
{
_directoryWatchers.Stop();
@ -276,20 +319,26 @@ namespace MediaBrowser.Api.Library
LibraryHelpers.RemoveVirtualFolder(request.Name, user, _appPaths);
}
// Need to add a delay here or directory watchers may still pick up the changes
await Task.Delay(1000).ConfigureAwait(false);
}
finally
{
_directoryWatchers.Start();
}
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
if (request.RefreshLibrary)
{
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
}
}
/// <summary>
/// Posts the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Post(AddMediaPath request)
public async void Post(AddMediaPath request)
{
_directoryWatchers.Stop();
@ -305,20 +354,26 @@ namespace MediaBrowser.Api.Library
LibraryHelpers.AddMediaPath(request.Name, request.Path, user, _appPaths);
}
// Need to add a delay here or directory watchers may still pick up the changes
await Task.Delay(1000).ConfigureAwait(false);
}
finally
{
_directoryWatchers.Start();
}
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
if (request.RefreshLibrary)
{
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
}
}
/// <summary>
/// Deletes the specified request.
/// </summary>
/// <param name="request">The request.</param>
public void Delete(RemoveMediaPath request)
public async void Delete(RemoveMediaPath request)
{
_directoryWatchers.Stop();
@ -334,13 +389,19 @@ namespace MediaBrowser.Api.Library
LibraryHelpers.RemoveMediaPath(request.Name, request.Path, user, _appPaths);
}
// Need to add a delay here or directory watchers may still pick up the changes
await Task.Delay(1000).ConfigureAwait(false);
}
finally
{
_directoryWatchers.Start();
}
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
if (request.RefreshLibrary)
{
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
}
}
}
}

View File

@ -123,6 +123,8 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<ITaskTrigger> GetDefaultTriggers()
{
// IMPORTANT: Make sure to update the dashboard "wizardsettings" page if this default ever changes
return new ITaskTrigger[]
{
new DailyTrigger { TimeOfDay = TimeSpan.FromHours(4) }
@ -198,7 +200,11 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
/// <value>The name.</value>
public string Name
{
get { return "Chapter image extraction"; }
get
{
// IMPORTANT: Make sure to update the dashboard "wizardsettings" page if this name ever changes
return "Chapter image extraction";
}
}
/// <summary>

View File

@ -509,6 +509,7 @@ namespace MediaBrowser.WebDashboard.Api
"userprofilespage.js",
"wizardfinishpage.js",
"wizardstartpage.js",
"wizardsettings.js",
"wizarduserpage.js"
};

View File

@ -910,7 +910,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
* Removes a virtual folder from either the default view or a user view
* @param {String} name
*/
self.removeVirtualFolder = function (name, userId) {
self.removeVirtualFolder = function (name, userId, refreshLibrary) {
if (!name) {
throw new Error("null name");
@ -919,7 +919,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
url += "/" + name;
url = self.getUrl(url);
url = self.getUrl(url, {
refreshLibrary: refreshLibrary ? true : false
});
return self.ajax({
type: "DELETE",
@ -931,7 +934,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
* Adds a virtual folder to either the default view or a user view
* @param {String} name
*/
self.addVirtualFolder = function (name, type, userId) {
self.addVirtualFolder = function (name, type, userId, refreshLibrary) {
if (!name) {
throw new Error("null name");
@ -943,6 +946,8 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
options.collectionType = type;
}
options.refreshLibrary = refreshLibrary ? true : false;
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
url += "/" + name;
@ -958,7 +963,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
* Renames a virtual folder, within either the default view or a user view
* @param {String} name
*/
self.renameVirtualFolder = function (name, newName, userId) {
self.renameVirtualFolder = function (name, newName, userId, refreshLibrary) {
if (!name) {
throw new Error("null name");
@ -968,7 +973,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
url += "/" + name + "/Name";
url = self.getUrl(url, { newName: newName });
url = self.getUrl(url, {
refreshLibrary: refreshLibrary ? true : false,
newName: newName
});
return self.ajax({
type: "POST",
@ -980,7 +988,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
* Adds an additional mediaPath to an existing virtual folder, within either the default view or a user view
* @param {String} name
*/
self.addMediaPath = function (virtualFolderName, mediaPath, userId) {
self.addMediaPath = function (virtualFolderName, mediaPath, userId, refreshLibrary) {
if (!virtualFolderName) {
throw new Error("null virtualFolderName");
@ -994,7 +1002,11 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
url += "/" + virtualFolderName + "/Paths";
url = self.getUrl(url, { path: mediaPath });
url = self.getUrl(url, {
refreshLibrary: refreshLibrary ? true : false,
path: mediaPath
});
return self.ajax({
type: "POST",
@ -1006,7 +1018,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
* Removes a media path from a virtual folder, within either the default view or a user view
* @param {String} name
*/
self.removeMediaPath = function (virtualFolderName, mediaPath, userId) {
self.removeMediaPath = function (virtualFolderName, mediaPath, userId, refreshLibrary) {
if (!virtualFolderName) {
throw new Error("null virtualFolderName");
@ -1020,7 +1032,11 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
url += "/" + virtualFolderName + "/Paths";
url = self.getUrl(url, { path: mediaPath });
url = self.getUrl(url, {
refreshLibrary: refreshLibrary ? true : false,
path: mediaPath
});
return self.ajax({
type: "DELETE",

View File

@ -318,6 +318,12 @@
<Content Include="dashboard-ui\gamesystems.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\wizardsettings.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\wizardsettings.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\index.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.168" targetFramework="net45" />
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.169" targetFramework="net45" />
<package id="ServiceStack.Common" version="3.9.58" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.58" targetFramework="net45" />
</packages>