implement option to disable audiodb for now

This commit is contained in:
dkanada 2020-03-08 12:10:25 +09:00
parent 76e49a1eb7
commit 26c778eb16
6 changed files with 27 additions and 2 deletions

View File

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

View File

@ -55,6 +55,12 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
{
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();
if (!string.IsNullOrWhiteSpace(id))
@ -78,6 +84,11 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
private void ProcessResult(MusicAlbum item, Album result, string preferredLanguage)
{
if (Plugin.Instance.Configuration.ReplaceAlbumName && !string.IsNullOrWhiteSpace(result.strAlbum))
{
item.Album = result.strAlbum;
}
if (!string.IsNullOrWhiteSpace(result.strArtist))
{
item.AlbumArtists = new string[] { result.strArtist };

View File

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

View File

@ -56,6 +56,12 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
{
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();
if (!string.IsNullOrWhiteSpace(id))

View File

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

View File

@ -12,6 +12,10 @@
<input is="emby-checkbox" type="checkbox" id="enable" />
<span>Enable this provider for metadata searches on artists and albums.</span>
</label>
<label class="checkboxContainer">
<input is="emby-checkbox" type="checkbox" id="replaceArtistName" />
<span>When an album is found during a metadata search, replace the name with the value on the server.</span>
</label>
<br />
<div>
<button is="emby-button" type="submit" class="raised button-submit block"><span>Save</span></button>