aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/Plugins/AudioDb
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2024-12-07 19:26:58 +0100
committerShadowghost <Ghost_of_Stone@web.de>2025-02-20 10:13:27 +0100
commit5303445c9b4c9934145151f20c084033ffd1e7c6 (patch)
tree17d8d313947dbe97efd9398cb31e0a188b124388 /MediaBrowser.Providers/Plugins/AudioDb
parent712908d53c7ca38d13e03ea7809e0c40e862a5fb (diff)
Migrate to IExternalUrlProvider
Diffstat (limited to 'MediaBrowser.Providers/Plugins/AudioDb')
-rw-r--r--MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumExternalId.cs3
-rw-r--r--MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumExternalUrlProvider.cs32
-rw-r--r--MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistExternalId.cs3
-rw-r--r--MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistExternalUrlProvider.cs33
-rw-r--r--MediaBrowser.Providers/Plugins/AudioDb/AudioDbOtherAlbumExternalId.cs3
-rw-r--r--MediaBrowser.Providers/Plugins/AudioDb/AudioDbOtherArtistExternalId.cs3
6 files changed, 65 insertions, 12 deletions
diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumExternalId.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumExternalId.cs
index 138cfef19a..622bb1dba4 100644
--- a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumExternalId.cs
+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumExternalId.cs
@@ -19,9 +19,6 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public ExternalIdMediaType? Type => null;
/// <inheritdoc />
- public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";
-
- /// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is MusicAlbum;
}
}
diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumExternalUrlProvider.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumExternalUrlProvider.cs
new file mode 100644
index 0000000000..1615f1ce59
--- /dev/null
+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbAlbumExternalUrlProvider.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.Audio;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Providers.Plugins.AudioDb;
+
+/// <summary>
+/// External artist URLs for AudioDb.
+/// </summary>
+public class AudioDbAlbumExternalUrlProvider : IExternalUrlProvider
+{
+ /// <inheritdoc/>
+ public string Name => "TheAudioDb Album";
+
+ /// <inheritdoc/>
+ public IEnumerable<string> GetExternalUrls(BaseItem item)
+ {
+ var externalId = item.GetProviderId(MetadataProvider.AudioDbAlbum);
+ if (!string.IsNullOrEmpty(externalId))
+ {
+ var baseUrl = "https://www.theaudiodb.com/";
+ switch (item)
+ {
+ case MusicAlbum:
+ yield return baseUrl + $"album/{externalId}";
+ break;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistExternalId.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistExternalId.cs
index 8aceb48c0c..3b5955b5be 100644
--- a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistExternalId.cs
+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistExternalId.cs
@@ -19,9 +19,6 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public ExternalIdMediaType? Type => ExternalIdMediaType.Artist;
/// <inheritdoc />
- public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}";
-
- /// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is MusicArtist;
}
}
diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistExternalUrlProvider.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistExternalUrlProvider.cs
new file mode 100644
index 0000000000..5c5057fa1a
--- /dev/null
+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistExternalUrlProvider.cs
@@ -0,0 +1,33 @@
+using System.Collections.Generic;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.Audio;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Providers.Plugins.AudioDb;
+
+/// <summary>
+/// External artist URLs for AudioDb.
+/// </summary>
+public class AudioDbArtistExternalUrlProvider : IExternalUrlProvider
+{
+ /// <inheritdoc/>
+ public string Name => "TheAudioDb Artist";
+
+ /// <inheritdoc/>
+ public IEnumerable<string> GetExternalUrls(BaseItem item)
+ {
+ var externalId = item.GetProviderId(MetadataProvider.AudioDbArtist);
+ if (!string.IsNullOrEmpty(externalId))
+ {
+ var baseUrl = "https://www.theaudiodb.com/";
+ switch (item)
+ {
+ case MusicAlbum:
+ case Person:
+ yield return baseUrl + $"artist/{externalId}";
+ break;
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbOtherAlbumExternalId.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbOtherAlbumExternalId.cs
index 014481da24..fdfd330cd3 100644
--- a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbOtherAlbumExternalId.cs
+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbOtherAlbumExternalId.cs
@@ -19,9 +19,6 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public ExternalIdMediaType? Type => ExternalIdMediaType.Album;
/// <inheritdoc />
- public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";
-
- /// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Audio;
}
}
diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbOtherArtistExternalId.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbOtherArtistExternalId.cs
index 7875391043..5a39ec1cd9 100644
--- a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbOtherArtistExternalId.cs
+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbOtherArtistExternalId.cs
@@ -19,9 +19,6 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public ExternalIdMediaType? Type => ExternalIdMediaType.OtherArtist;
/// <inheritdoc />
- public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}";
-
- /// <inheritdoc />
public bool Supports(IHasProviderIds item) => item is Audio || item is MusicAlbum;
}
}