Fix StudiosImageProvider

pull/7507/head
Cody Robibero 3 years ago
parent 5376c37d42
commit 23ba15ccfb

@ -2,7 +2,7 @@
using MediaBrowser.Model.Plugins;
namespace MediaBrowser.Providers.Plugins.StudioImages
namespace MediaBrowser.Providers.Plugins.StudioImages.Configuration
{
public class PluginConfiguration : BasePluginConfiguration
{
@ -12,12 +12,19 @@ namespace MediaBrowser.Providers.Plugins.StudioImages
{
get
{
if (string.IsNullOrEmpty(_repository))
{
_repository = Plugin.DefaultServer;
}
return _repository;
}
set
{
_repository = value.TrimEnd('/');
_repository = string.IsNullOrEmpty(value)
? Plugin.DefaultServer
: value.TrimEnd('/');
}
}
}

@ -9,8 +9,8 @@
<div class="content-primary">
<form class="configForm">
<div class="inputContainer">
<input is="emby-input" type="text" id="repository" required label="Repository" />
<div class="fieldDescription">This can be any Jellyfin-compatible artwork repository.</div>
<input is="emby-input" type="text" id="repository" label="Repository" />
<div class="fieldDescription">This can be any Jellyfin-compatible artwork repository. Leave blank to use default repository.</div>
</div>
<br />
<div>
@ -44,7 +44,7 @@
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
config.RepositoryUrl = document.querySelector('#server').value;
config.RepositoryUrl = document.querySelector('#repository').value;
ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
});

@ -7,6 +7,7 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Providers.Plugins.StudioImages.Configuration;
namespace MediaBrowser.Providers.Plugins.StudioImages
{

@ -18,29 +18,24 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Providers;
using MediaBrowser.Providers.Plugins.StudioImages;
namespace MediaBrowser.Providers.Studios
namespace MediaBrowser.Providers.Plugins.StudioImages
{
public class StudiosImageProvider : IRemoteImageProvider
{
private readonly IServerConfigurationManager _config;
private readonly IHttpClientFactory _httpClientFactory;
private readonly IFileSystem _fileSystem;
private readonly string repositoryUrl;
public StudiosImageProvider(IServerConfigurationManager config, IHttpClientFactory httpClientFactory, IFileSystem fileSystem)
{
_config = config;
_httpClientFactory = httpClientFactory;
_fileSystem = fileSystem;
repositoryUrl = Plugin.Instance.Configuration.RepositoryUrl;
}
public string Name => "Artwork Repository";
public int Order => 0;
public bool Supports(BaseItem item)
{
return item is Studio;
@ -98,12 +93,12 @@ namespace MediaBrowser.Providers.Studios
private string GetUrl(string image, string filename)
{
return string.Format(CultureInfo.InvariantCulture, "{0}/images/{1}/{2}.jpg", repositoryUrl, image, filename);
return string.Format(CultureInfo.InvariantCulture, "{0}/images/{1}/{2}.jpg", GetRepositoryUrl(), image, filename);
}
private Task<string> EnsureThumbsList(string file, CancellationToken cancellationToken)
{
string url = string.Format(CultureInfo.InvariantCulture, "{0}/thumbs.txt", repositoryUrl);
string url = string.Format(CultureInfo.InvariantCulture, "{0}/thumbs.txt", GetRepositoryUrl());
return EnsureList(url, file, _fileSystem, cancellationToken);
}
@ -169,5 +164,8 @@ namespace MediaBrowser.Providers.Studios
}
}
}
private string GetRepositoryUrl()
=> Plugin.Instance.Configuration.RepositoryUrl;
}
}

Loading…
Cancel
Save