mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
fixes #539 - Unhanded exception when adding duplicate library path
This commit is contained in:
parent
3d02b8c6a6
commit
9a1fbcd485
@ -1,5 +1,4 @@
|
|||||||
using System.Threading.Tasks;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller;
|
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
@ -8,6 +7,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Library
|
namespace MediaBrowser.Api.Library
|
||||||
{
|
{
|
||||||
@ -34,7 +34,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
public string UserId { get; set; }
|
public string UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name.
|
/// Gets or sets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -134,7 +134,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
/// <value><c>true</c> if [refresh library]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [refresh library]; otherwise, <c>false</c>.</value>
|
||||||
public bool RefreshLibrary { get; set; }
|
public bool RefreshLibrary { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Library/VirtualFolders/{Name}/Paths", "DELETE")]
|
[Route("/Library/VirtualFolders/{Name}/Paths", "DELETE")]
|
||||||
[Route("/Users/{UserId}/VirtualFolders/{Name}/Paths", "DELETE")]
|
[Route("/Users/{UserId}/VirtualFolders/{Name}/Paths", "DELETE")]
|
||||||
public class RemoveMediaPath : IReturnVoid
|
public class RemoveMediaPath : IReturnVoid
|
||||||
@ -185,7 +185,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
private readonly IDirectoryWatchers _directoryWatchers;
|
private readonly IDirectoryWatchers _directoryWatchers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="LibraryStructureService"/> class.
|
/// Initializes a new instance of the <see cref="LibraryStructureService"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -233,7 +233,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
/// Posts the specified request.
|
/// Posts the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public async void Post(AddVirtualFolder request)
|
public void Post(AddVirtualFolder request)
|
||||||
{
|
{
|
||||||
_directoryWatchers.Stop();
|
_directoryWatchers.Stop();
|
||||||
|
|
||||||
@ -251,7 +251,9 @@ namespace MediaBrowser.Api.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to add a delay here or directory watchers may still pick up the changes
|
// Need to add a delay here or directory watchers may still pick up the changes
|
||||||
await Task.Delay(1000).ConfigureAwait(false);
|
var task = Task.Delay(1000);
|
||||||
|
// Have to block here to allow exceptions to bubble
|
||||||
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -268,7 +270,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
/// Posts the specified request.
|
/// Posts the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public async void Post(RenameVirtualFolder request)
|
public void Post(RenameVirtualFolder request)
|
||||||
{
|
{
|
||||||
_directoryWatchers.Stop();
|
_directoryWatchers.Stop();
|
||||||
|
|
||||||
@ -286,7 +288,9 @@ namespace MediaBrowser.Api.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to add a delay here or directory watchers may still pick up the changes
|
// Need to add a delay here or directory watchers may still pick up the changes
|
||||||
await Task.Delay(1000).ConfigureAwait(false);
|
var task = Task.Delay(1000);
|
||||||
|
// Have to block here to allow exceptions to bubble
|
||||||
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -298,12 +302,12 @@ namespace MediaBrowser.Api.Library
|
|||||||
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
|
_libraryManager.ValidateMediaLibrary(new Progress<double>(), CancellationToken.None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes the specified request.
|
/// Deletes the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public async void Delete(RemoveVirtualFolder request)
|
public void Delete(RemoveVirtualFolder request)
|
||||||
{
|
{
|
||||||
_directoryWatchers.Stop();
|
_directoryWatchers.Stop();
|
||||||
|
|
||||||
@ -321,7 +325,9 @@ namespace MediaBrowser.Api.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to add a delay here or directory watchers may still pick up the changes
|
// Need to add a delay here or directory watchers may still pick up the changes
|
||||||
await Task.Delay(1000).ConfigureAwait(false);
|
var task = Task.Delay(1000);
|
||||||
|
// Have to block here to allow exceptions to bubble
|
||||||
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -338,7 +344,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
/// Posts the specified request.
|
/// Posts the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public async void Post(AddMediaPath request)
|
public void Post(AddMediaPath request)
|
||||||
{
|
{
|
||||||
_directoryWatchers.Stop();
|
_directoryWatchers.Stop();
|
||||||
|
|
||||||
@ -356,7 +362,9 @@ namespace MediaBrowser.Api.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to add a delay here or directory watchers may still pick up the changes
|
// Need to add a delay here or directory watchers may still pick up the changes
|
||||||
await Task.Delay(1000).ConfigureAwait(false);
|
var task = Task.Delay(1000);
|
||||||
|
// Have to block here to allow exceptions to bubble
|
||||||
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -373,7 +381,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
/// Deletes the specified request.
|
/// Deletes the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public async void Delete(RemoveMediaPath request)
|
public void Delete(RemoveMediaPath request)
|
||||||
{
|
{
|
||||||
_directoryWatchers.Stop();
|
_directoryWatchers.Stop();
|
||||||
|
|
||||||
@ -391,7 +399,9 @@ namespace MediaBrowser.Api.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to add a delay here or directory watchers may still pick up the changes
|
// Need to add a delay here or directory watchers may still pick up the changes
|
||||||
await Task.Delay(1000).ConfigureAwait(false);
|
var task = Task.Delay(1000);
|
||||||
|
// Have to block here to allow exceptions to bubble
|
||||||
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user