remove deprecated flag to disable music plugins

This commit is contained in:
dkanada 2020-11-28 23:55:56 +09:00
parent f1b3811ca7
commit 8b0ef119c3
10 changed files with 11 additions and 65 deletions

View File

@ -103,6 +103,6 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
/// <inheritdoc /> /// <inheritdoc />
public bool Supports(BaseItem item) public bool Supports(BaseItem item)
=> Plugin.Instance.Configuration.Enable && item is MusicAlbum; => item is MusicAlbum;
} }
} }

View File

@ -56,13 +56,6 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public async Task<MetadataResult<MusicAlbum>> GetMetadata(AlbumInfo info, CancellationToken cancellationToken) public async Task<MetadataResult<MusicAlbum>> GetMetadata(AlbumInfo info, CancellationToken cancellationToken)
{ {
var result = new MetadataResult<MusicAlbum>(); var result = new MetadataResult<MusicAlbum>();
// TODO maybe remove when artist metadata can be disabled
if (!Plugin.Instance.Configuration.Enable)
{
return result;
}
var id = info.GetReleaseGroupId(); var id = info.GetReleaseGroupId();
if (!string.IsNullOrWhiteSpace(id)) if (!string.IsNullOrWhiteSpace(id))

View File

@ -144,6 +144,6 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
/// <inheritdoc /> /// <inheritdoc />
public bool Supports(BaseItem item) public bool Supports(BaseItem item)
=> Plugin.Instance.Configuration.Enable && item is MusicArtist; => item is MusicArtist;
} }
} }

View File

@ -57,13 +57,6 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public async Task<MetadataResult<MusicArtist>> GetMetadata(ArtistInfo info, CancellationToken cancellationToken) public async Task<MetadataResult<MusicArtist>> GetMetadata(ArtistInfo info, CancellationToken cancellationToken)
{ {
var result = new MetadataResult<MusicArtist>(); var result = new MetadataResult<MusicArtist>();
// TODO maybe remove when artist metadata can be disabled
if (!Plugin.Instance.Configuration.Enable)
{
return result;
}
var id = info.GetMusicBrainzArtistId(); var id = info.GetMusicBrainzArtistId();
if (!string.IsNullOrWhiteSpace(id)) if (!string.IsNullOrWhiteSpace(id))

View File

@ -6,8 +6,6 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
{ {
public class PluginConfiguration : BasePluginConfiguration public class PluginConfiguration : BasePluginConfiguration
{ {
public bool Enable { get; set; }
public bool ReplaceAlbumName { get; set; } public bool ReplaceAlbumName { get; set; }
} }
} }

View File

@ -8,10 +8,6 @@
<div data-role="content"> <div data-role="content">
<div class="content-primary"> <div class="content-primary">
<form class="configForm"> <form class="configForm">
<label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="enable" />
<span>Enable this provider for metadata searches on artists and albums.</span>
</label>
<label class="checkboxContainer"> <label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="replaceAlbumName" /> <input is="emby-checkbox" type="checkbox" id="replaceAlbumName" />
<span>When an album is found during a metadata search, replace the name with the value on the server.</span> <span>When an album is found during a metadata search, replace the name with the value on the server.</span>
@ -32,9 +28,8 @@
.addEventListener('pageshow', function () { .addEventListener('pageshow', function () {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) { ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
document.querySelector('#enable').checked = config.Enable;
document.querySelector('#replaceAlbumName').checked = config.ReplaceAlbumName; document.querySelector('#replaceAlbumName').checked = config.ReplaceAlbumName;
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}); });
}); });
@ -42,14 +37,13 @@
document.querySelector('.configForm') document.querySelector('.configForm')
.addEventListener('submit', function (e) { .addEventListener('submit', function (e) {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) { ApiClient.getPluginConfiguration(PluginConfig.pluginId).then(function (config) {
config.Enable = document.querySelector('#enable').checked;
config.ReplaceAlbumName = document.querySelector('#replaceAlbumName').checked; config.ReplaceAlbumName = document.querySelector('#replaceAlbumName').checked;
ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult); ApiClient.updatePluginConfiguration(PluginConfig.pluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
}); });
e.preventDefault(); e.preventDefault();
return false; return false;
}); });

View File

@ -25,12 +25,6 @@ namespace MediaBrowser.Providers.Music
/// <inheritdoc /> /// <inheritdoc />
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(ArtistInfo searchInfo, CancellationToken cancellationToken) public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(ArtistInfo searchInfo, CancellationToken cancellationToken)
{ {
// TODO maybe remove when artist metadata can be disabled
if (!Plugin.Instance.Configuration.Enable)
{
return Enumerable.Empty<RemoteSearchResult>();
}
var musicBrainzId = searchInfo.GetMusicBrainzArtistId(); var musicBrainzId = searchInfo.GetMusicBrainzArtistId();
if (!string.IsNullOrWhiteSpace(musicBrainzId)) if (!string.IsNullOrWhiteSpace(musicBrainzId))
@ -236,12 +230,6 @@ namespace MediaBrowser.Providers.Music
Item = new MusicArtist() Item = new MusicArtist()
}; };
// TODO maybe remove when artist metadata can be disabled
if (!Plugin.Instance.Configuration.Enable)
{
return result;
}
var musicBrainzId = id.GetMusicBrainzArtistId(); var musicBrainzId = id.GetMusicBrainzArtistId();
if (string.IsNullOrWhiteSpace(musicBrainzId)) if (string.IsNullOrWhiteSpace(musicBrainzId))

View File

@ -43,8 +43,6 @@ namespace MediaBrowser.Providers.Plugins.MusicBrainz
} }
} }
public bool Enable { get; set; }
public bool ReplaceArtistName { get; set; } public bool ReplaceArtistName { get; set; }
} }
} }

View File

@ -16,10 +16,6 @@
<input is="emby-input" type="number" id="rateLimit" pattern="[0-9]*" required min="0" max="10000" label="Rate Limit" /> <input is="emby-input" type="number" id="rateLimit" pattern="[0-9]*" required min="0" max="10000" label="Rate Limit" />
<div class="fieldDescription">Span of time between requests in milliseconds. The official server is limited to one request every two seconds.</div> <div class="fieldDescription">Span of time between requests in milliseconds. The official server is limited to one request every two seconds.</div>
</div> </div>
<label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="enable" />
<span>Enable this provider for metadata searches on artists and albums.</span>
</label>
<label class="checkboxContainer"> <label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="replaceArtistName" /> <input is="emby-checkbox" type="checkbox" id="replaceArtistName" />
<span>When an artist is found during a metadata search, replace the artist name with the value on the server.</span> <span>When an artist is found during a metadata search, replace the artist name with the value on the server.</span>
@ -46,7 +42,7 @@
bubbles: true, bubbles: true,
cancelable: false cancelable: false
})); }));
var rateLimit = document.querySelector('#rateLimit'); var rateLimit = document.querySelector('#rateLimit');
rateLimit.value = config.RateLimit; rateLimit.value = config.RateLimit;
rateLimit.dispatchEvent(new Event('change', { rateLimit.dispatchEvent(new Event('change', {
@ -54,26 +50,24 @@
cancelable: false cancelable: false
})); }));
document.querySelector('#enable').checked = config.Enable;
document.querySelector('#replaceArtistName').checked = config.ReplaceArtistName; document.querySelector('#replaceArtistName').checked = config.ReplaceArtistName;
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
}); });
}); });
document.querySelector('.musicBrainzConfigForm') document.querySelector('.musicBrainzConfigForm')
.addEventListener('submit', function (e) { .addEventListener('submit', function (e) {
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(MusicBrainzPluginConfig.uniquePluginId).then(function (config) { ApiClient.getPluginConfiguration(MusicBrainzPluginConfig.uniquePluginId).then(function (config) {
config.Server = document.querySelector('#server').value; config.Server = document.querySelector('#server').value;
config.RateLimit = document.querySelector('#rateLimit').value; config.RateLimit = document.querySelector('#rateLimit').value;
config.Enable = document.querySelector('#enable').checked;
config.ReplaceArtistName = document.querySelector('#replaceArtistName').checked; config.ReplaceArtistName = document.querySelector('#replaceArtistName').checked;
ApiClient.updatePluginConfiguration(MusicBrainzPluginConfig.uniquePluginId, config).then(Dashboard.processPluginConfigurationUpdateResult); ApiClient.updatePluginConfiguration(MusicBrainzPluginConfig.uniquePluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
}); });
e.preventDefault(); e.preventDefault();
return false; return false;
}); });

View File

@ -78,12 +78,6 @@ namespace MediaBrowser.Providers.Music
/// <inheritdoc /> /// <inheritdoc />
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(AlbumInfo searchInfo, CancellationToken cancellationToken) public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(AlbumInfo searchInfo, CancellationToken cancellationToken)
{ {
// TODO maybe remove when artist metadata can be disabled
if (!Plugin.Instance.Configuration.Enable)
{
return Enumerable.Empty<RemoteSearchResult>();
}
var releaseId = searchInfo.GetReleaseId(); var releaseId = searchInfo.GetReleaseId();
var releaseGroupId = searchInfo.GetReleaseGroupId(); var releaseGroupId = searchInfo.GetReleaseGroupId();
@ -194,12 +188,6 @@ namespace MediaBrowser.Providers.Music
Item = new MusicAlbum() Item = new MusicAlbum()
}; };
// TODO maybe remove when artist metadata can be disabled
if (!Plugin.Instance.Configuration.Enable)
{
return result;
}
// If we have a release group Id but not a release Id... // If we have a release group Id but not a release Id...
if (string.IsNullOrWhiteSpace(releaseId) && !string.IsNullOrWhiteSpace(releaseGroupId)) if (string.IsNullOrWhiteSpace(releaseId) && !string.IsNullOrWhiteSpace(releaseGroupId))
{ {