Przeglądaj źródła

implement option to disable audiodb for now

dkanada 5 lat temu
rodzic
commit
26c778eb16

+ 2 - 1
MediaBrowser.Providers/Plugins/AudioDb/AlbumImageProvider.cs

@@ -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;
     }
 }

+ 11 - 0
MediaBrowser.Providers/Plugins/AudioDb/AlbumProvider.cs

@@ -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 };

+ 2 - 1
MediaBrowser.Providers/Plugins/AudioDb/ArtistImageProvider.cs

@@ -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;
     }
 }

+ 6 - 0
MediaBrowser.Providers/Plugins/AudioDb/ArtistProvider.cs

@@ -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))

+ 2 - 0
MediaBrowser.Providers/Plugins/AudioDb/Configuration/PluginConfiguration.cs

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

+ 4 - 0
MediaBrowser.Providers/Plugins/AudioDb/Configuration/config.html

@@ -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>