be more tolerant of media folder names with invalid url chars
This commit is contained in:
parent
3488cfecbd
commit
30b29f63c4
|
@ -28,8 +28,8 @@ namespace MediaBrowser.Api.Library
|
|||
public string UserId { get; set; }
|
||||
}
|
||||
|
||||
[Route("/Library/VirtualFolders/{Name}", "POST")]
|
||||
[Route("/Users/{UserId}/VirtualFolders/{Name}", "POST")]
|
||||
[Route("/Library/VirtualFolders", "POST")]
|
||||
[Route("/Users/{UserId}/VirtualFolders", "POST")]
|
||||
public class AddVirtualFolder : IReturnVoid
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -57,8 +57,8 @@ namespace MediaBrowser.Api.Library
|
|||
public bool RefreshLibrary { get; set; }
|
||||
}
|
||||
|
||||
[Route("/Library/VirtualFolders/{Name}", "DELETE")]
|
||||
[Route("/Users/{UserId}/VirtualFolders/{Name}", "DELETE")]
|
||||
[Route("/Library/VirtualFolders", "DELETE")]
|
||||
[Route("/Users/{UserId}/VirtualFolders", "DELETE")]
|
||||
public class RemoveVirtualFolder : IReturnVoid
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -80,8 +80,8 @@ namespace MediaBrowser.Api.Library
|
|||
public bool RefreshLibrary { get; set; }
|
||||
}
|
||||
|
||||
[Route("/Library/VirtualFolders/{Name}/Name", "POST")]
|
||||
[Route("/Users/{UserId}/VirtualFolders/{Name}/Name", "POST")]
|
||||
[Route("/Library/VirtualFolders/Name", "POST")]
|
||||
[Route("/Users/{UserId}/VirtualFolders/Name", "POST")]
|
||||
public class RenameVirtualFolder : IReturnVoid
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -109,8 +109,8 @@ namespace MediaBrowser.Api.Library
|
|||
public bool RefreshLibrary { get; set; }
|
||||
}
|
||||
|
||||
[Route("/Library/VirtualFolders/{Name}/Paths", "POST")]
|
||||
[Route("/Users/{UserId}/VirtualFolders/{Name}/Paths", "POST")]
|
||||
[Route("/Library/VirtualFolders/Paths", "POST")]
|
||||
[Route("/Users/{UserId}/VirtualFolders/Paths", "POST")]
|
||||
public class AddMediaPath : IReturnVoid
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -138,8 +138,8 @@ namespace MediaBrowser.Api.Library
|
|||
public bool RefreshLibrary { get; set; }
|
||||
}
|
||||
|
||||
[Route("/Library/VirtualFolders/{Name}/Paths", "DELETE")]
|
||||
[Route("/Users/{UserId}/VirtualFolders/{Name}/Paths", "DELETE")]
|
||||
[Route("/Library/VirtualFolders/Paths", "DELETE")]
|
||||
[Route("/Users/{UserId}/VirtualFolders/Paths", "DELETE")]
|
||||
public class RemoveMediaPath : IReturnVoid
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -243,6 +243,11 @@ namespace MediaBrowser.Api.Library
|
|||
/// <param name="request">The request.</param>
|
||||
public void Post(AddVirtualFolder request)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(request.Name))
|
||||
{
|
||||
throw new ArgumentNullException("request");
|
||||
}
|
||||
|
||||
var name = _fileSystem.GetValidFilename(request.Name);
|
||||
|
||||
string rootFolderPath;
|
||||
|
@ -307,6 +312,16 @@ namespace MediaBrowser.Api.Library
|
|||
/// <param name="request">The request.</param>
|
||||
public void Post(RenameVirtualFolder request)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(request.Name))
|
||||
{
|
||||
throw new ArgumentNullException("request");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(request.NewName))
|
||||
{
|
||||
throw new ArgumentNullException("request");
|
||||
}
|
||||
|
||||
string rootFolderPath;
|
||||
|
||||
if (string.IsNullOrEmpty(request.UserId))
|
||||
|
@ -380,6 +395,11 @@ namespace MediaBrowser.Api.Library
|
|||
/// <param name="request">The request.</param>
|
||||
public void Delete(RemoveVirtualFolder request)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(request.Name))
|
||||
{
|
||||
throw new ArgumentNullException("request");
|
||||
}
|
||||
|
||||
string rootFolderPath;
|
||||
|
||||
if (string.IsNullOrEmpty(request.UserId))
|
||||
|
@ -435,6 +455,11 @@ namespace MediaBrowser.Api.Library
|
|||
/// <param name="request">The request.</param>
|
||||
public void Post(AddMediaPath request)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(request.Name))
|
||||
{
|
||||
throw new ArgumentNullException("request");
|
||||
}
|
||||
|
||||
_directoryWatchers.Stop();
|
||||
|
||||
try
|
||||
|
@ -476,6 +501,11 @@ namespace MediaBrowser.Api.Library
|
|||
/// <param name="request">The request.</param>
|
||||
public void Delete(RemoveMediaPath request)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(request.Name))
|
||||
{
|
||||
throw new ArgumentNullException("request");
|
||||
}
|
||||
|
||||
_directoryWatchers.Stop();
|
||||
|
||||
try
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Studios\backdrops.txt" />
|
||||
<EmbeddedResource Include="Studios\thumbs.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Studios\posters.txt" />
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MediaBrowser.Providers.Studios
|
|||
|
||||
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.PrimaryImagePath) && item.BackdropImagePaths.Count == 0)
|
||||
if (item.HasImage(ImageType.Primary) && item.HasImage(ImageType.Thumb))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -75,13 +75,16 @@ namespace MediaBrowser.Providers.Studios
|
|||
|
||||
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.PrimaryImagePath) || item.BackdropImagePaths.Count == 0)
|
||||
if (item.HasImage(ImageType.Primary) && item.HasImage(ImageType.Thumb))
|
||||
{
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, StudiosManualImageProvider.ProviderName).ConfigureAwait(false);
|
||||
|
||||
await DownloadImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, StudiosManualImageProvider.ProviderName).ConfigureAwait(false);
|
||||
|
||||
await DownloadImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
|
||||
return true;
|
||||
}
|
||||
|
@ -96,6 +99,12 @@ namespace MediaBrowser.Providers.Studios
|
|||
{
|
||||
await SaveImage(item, images, ImageType.Primary, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (!item.HasImage(ImageType.Thumb))
|
||||
{
|
||||
await SaveImage(item, images, ImageType.Thumb, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!item.LockedFields.Contains(MetadataFields.Backdrops))
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace MediaBrowser.Providers.Studios
|
|||
|
||||
if (backdrops)
|
||||
{
|
||||
//list.Add(GetImage(item, "backdrops.txt", ImageType.Backdrop, "backdrop"));
|
||||
list.Add(GetImage(item, "thumbs.txt", ImageType.Thumb, "thumb"));
|
||||
}
|
||||
|
||||
return Task.FromResult(list.Where(i => i != null));
|
||||
|
|
|
@ -1328,10 +1328,9 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
|
||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
||||
|
||||
url += "/" + name;
|
||||
|
||||
url = self.getUrl(url, {
|
||||
refreshLibrary: refreshLibrary ? true : false
|
||||
refreshLibrary: refreshLibrary ? true : false,
|
||||
name: name
|
||||
});
|
||||
|
||||
return self.ajax({
|
||||
|
@ -1357,10 +1356,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
}
|
||||
|
||||
options.refreshLibrary = refreshLibrary ? true : false;
|
||||
options.name = name;
|
||||
|
||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
||||
|
||||
url += "/" + name;
|
||||
url = self.getUrl(url, options);
|
||||
|
||||
return self.ajax({
|
||||
|
@ -1381,11 +1380,12 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
|
||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
||||
|
||||
url += "/" + name + "/Name";
|
||||
url += "/Name";
|
||||
|
||||
url = self.getUrl(url, {
|
||||
refreshLibrary: refreshLibrary ? true : false,
|
||||
newName: newName
|
||||
newName: newName,
|
||||
name: name
|
||||
});
|
||||
|
||||
return self.ajax({
|
||||
|
@ -1410,11 +1410,12 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
|
||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
||||
|
||||
url += "/" + virtualFolderName + "/Paths";
|
||||
url += "/Paths";
|
||||
|
||||
url = self.getUrl(url, {
|
||||
refreshLibrary: refreshLibrary ? true : false,
|
||||
path: mediaPath
|
||||
path: mediaPath,
|
||||
name: virtualFolderName
|
||||
});
|
||||
|
||||
return self.ajax({
|
||||
|
@ -1439,11 +1440,12 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
|
||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
||||
|
||||
url += "/" + virtualFolderName + "/Paths";
|
||||
url += "/Paths";
|
||||
|
||||
url = self.getUrl(url, {
|
||||
refreshLibrary: refreshLibrary ? true : false,
|
||||
path: mediaPath
|
||||
path: mediaPath,
|
||||
name: virtualFolderName
|
||||
});
|
||||
|
||||
return self.ajax({
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.212" targetFramework="net45" />
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.213" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user