mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-17 11:43:44 +01:00
@@ -23,16 +23,14 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
{
|
||||
public class AudioDbArtistProvider : IRemoteMetadataProvider<MusicArtist, ArtistInfo>, IHasOrder
|
||||
{
|
||||
private const string ApiKey = "195003";
|
||||
public const string BaseUrl = "https://www.theaudiodb.com/api/v1/json/" + ApiKey;
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly IJsonSerializer _json;
|
||||
|
||||
public static AudioDbArtistProvider Current;
|
||||
|
||||
private const string ApiKey = "195003";
|
||||
public const string BaseUrl = "https://www.theaudiodb.com/api/v1/json/" + ApiKey;
|
||||
|
||||
public AudioDbArtistProvider(IServerConfigurationManager config, IFileSystem fileSystem, IHttpClientFactory httpClientFactory, IJsonSerializer json)
|
||||
{
|
||||
_config = config;
|
||||
@@ -42,6 +40,8 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
Current = this;
|
||||
}
|
||||
|
||||
public static AudioDbArtistProvider Current { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "TheAudioDB";
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
{
|
||||
public class AudioDbAlbumExternalId : IExternalId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string ProviderName => "TheAudioDb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => MetadataProvider.AudioDbAlbum.ToString();
|
||||
|
||||
/// <inheritdoc />
|
||||
public ExternalIdMediaType? Type => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Supports(IHasProviderIds item) => item is MusicAlbum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
{
|
||||
public class AudioDbArtistExternalId : IExternalId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string ProviderName => "TheAudioDb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => MetadataProvider.AudioDbArtist.ToString();
|
||||
|
||||
/// <inheritdoc />
|
||||
public ExternalIdMediaType? Type => ExternalIdMediaType.Artist;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Supports(IHasProviderIds item) => item is MusicArtist;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
{
|
||||
public class AudioDbOtherAlbumExternalId : IExternalId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string ProviderName => "TheAudioDb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => MetadataProvider.AudioDbAlbum.ToString();
|
||||
|
||||
/// <inheritdoc />
|
||||
public ExternalIdMediaType? Type => ExternalIdMediaType.Album;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Supports(IHasProviderIds item) => item is Audio;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
{
|
||||
public class AudioDbOtherArtistExternalId : IExternalId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string ProviderName => "TheAudioDb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => MetadataProvider.AudioDbArtist.ToString();
|
||||
|
||||
/// <inheritdoc />
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
{
|
||||
public class AudioDbAlbumExternalId : IExternalId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string ProviderName => "TheAudioDb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => MetadataProvider.AudioDbAlbum.ToString();
|
||||
|
||||
/// <inheritdoc />
|
||||
public ExternalIdMediaType? Type => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Supports(IHasProviderIds item) => item is MusicAlbum;
|
||||
}
|
||||
|
||||
public class AudioDbOtherAlbumExternalId : IExternalId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string ProviderName => "TheAudioDb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => MetadataProvider.AudioDbAlbum.ToString();
|
||||
|
||||
/// <inheritdoc />
|
||||
public ExternalIdMediaType? Type => ExternalIdMediaType.Album;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Supports(IHasProviderIds item) => item is Audio;
|
||||
}
|
||||
|
||||
public class AudioDbArtistExternalId : IExternalId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string ProviderName => "TheAudioDb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => MetadataProvider.AudioDbArtist.ToString();
|
||||
|
||||
/// <inheritdoc />
|
||||
public ExternalIdMediaType? Type => ExternalIdMediaType.Artist;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Supports(IHasProviderIds item) => item is MusicArtist;
|
||||
}
|
||||
|
||||
public class AudioDbOtherArtistExternalId : IExternalId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string ProviderName => "TheAudioDb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Key => MetadataProvider.AudioDbArtist.ToString();
|
||||
|
||||
/// <inheritdoc />
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,12 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
{
|
||||
public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
|
||||
{
|
||||
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
|
||||
: base(applicationPaths, xmlSerializer)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public static Plugin Instance { get; private set; }
|
||||
|
||||
public override Guid Id => new Guid("a629c0da-fac5-4c7e-931a-7174223f14c8");
|
||||
@@ -22,12 +28,6 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
// TODO remove when plugin removed from server.
|
||||
public override string ConfigurationFileName => "Jellyfin.Plugin.AudioDb.xml";
|
||||
|
||||
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
|
||||
: base(applicationPaths, xmlSerializer)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public IEnumerable<PluginPageInfo> GetPages()
|
||||
{
|
||||
yield return new PluginPageInfo
|
||||
|
||||
@@ -8,7 +8,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -26,14 +25,6 @@ namespace MediaBrowser.Providers.Music
|
||||
{
|
||||
public class MusicBrainzAlbumProvider : IRemoteMetadataProvider<MusicAlbum, AlbumInfo>, IHasOrder
|
||||
{
|
||||
/// <summary>
|
||||
/// The Jellyfin user-agent is unrestricted but source IP must not exceed
|
||||
/// one request per second, therefore we rate limit to avoid throttling.
|
||||
/// Be prudent, use a value slightly above the minimun required.
|
||||
/// https://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting
|
||||
/// </summary>
|
||||
private readonly long _musicBrainzQueryIntervalMs;
|
||||
|
||||
/// <summary>
|
||||
/// For each single MB lookup/search, this is the maximum number of
|
||||
/// attempts that shall be made whilst receiving a 503 Server
|
||||
@@ -41,7 +32,13 @@ namespace MediaBrowser.Providers.Music
|
||||
/// </summary>
|
||||
private const uint MusicBrainzQueryAttempts = 5u;
|
||||
|
||||
internal static MusicBrainzAlbumProvider Current;
|
||||
/// <summary>
|
||||
/// The Jellyfin user-agent is unrestricted but source IP must not exceed
|
||||
/// one request per second, therefore we rate limit to avoid throttling.
|
||||
/// Be prudent, use a value slightly above the minimun required.
|
||||
/// https://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting
|
||||
/// </summary>
|
||||
private readonly long _musicBrainzQueryIntervalMs;
|
||||
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly IApplicationHost _appHost;
|
||||
@@ -69,6 +66,8 @@ namespace MediaBrowser.Providers.Music
|
||||
Current = this;
|
||||
}
|
||||
|
||||
internal static MusicBrainzAlbumProvider Current { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "MusicBrainz";
|
||||
|
||||
@@ -112,7 +111,7 @@ namespace MediaBrowser.Providers.Music
|
||||
else
|
||||
{
|
||||
// I'm sure there is a better way but for now it resolves search for 12" Mixes
|
||||
var queryName = searchInfo.Name.Replace("\"", string.Empty);
|
||||
var queryName = searchInfo.Name.Replace("\"", string.Empty, StringComparison.Ordinal);
|
||||
|
||||
url = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
@@ -277,7 +276,9 @@ namespace MediaBrowser.Providers.Music
|
||||
|
||||
private async Task<ReleaseResult> GetReleaseResult(string albumName, string artistId, CancellationToken cancellationToken)
|
||||
{
|
||||
var url = string.Format(CultureInfo.InvariantCulture, "/ws/2/release/?query=\"{0}\" AND arid:{1}",
|
||||
var url = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"/ws/2/release/?query=\"{0}\" AND arid:{1}",
|
||||
WebUtility.UrlEncode(albumName),
|
||||
artistId);
|
||||
|
||||
@@ -496,7 +497,7 @@ namespace MediaBrowser.Providers.Music
|
||||
}
|
||||
}
|
||||
|
||||
private static ValueTuple<string, string> ParseArtistCredit(XmlReader reader)
|
||||
private static (string, string) ParseArtistCredit(XmlReader reader)
|
||||
{
|
||||
reader.MoveToContent();
|
||||
reader.Read();
|
||||
@@ -531,7 +532,7 @@ namespace MediaBrowser.Providers.Music
|
||||
}
|
||||
}
|
||||
|
||||
return new ValueTuple<string, string>();
|
||||
return default;
|
||||
}
|
||||
|
||||
private static (string, string) ParseArtistNameCredit(XmlReader reader)
|
||||
@@ -36,6 +36,12 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||
_appHost = appHost;
|
||||
}
|
||||
|
||||
public string Name => "The Open Movie Database";
|
||||
|
||||
// After other internet providers, because they're better
|
||||
// But before fallback providers like screengrab
|
||||
public int Order => 90;
|
||||
|
||||
public IEnumerable<ImageType> GetSupportedImages(BaseItem item)
|
||||
{
|
||||
return new List<ImageType>
|
||||
@@ -86,15 +92,9 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||
}
|
||||
|
||||
public string Name => "The Open Movie Database";
|
||||
|
||||
public bool Supports(BaseItem item)
|
||||
{
|
||||
return item is Movie || item is Trailer || item is Episode;
|
||||
}
|
||||
|
||||
// After other internet providers, because they're better
|
||||
// But before fallback providers like screengrab
|
||||
public int Order => 90;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||
_appHost = appHost;
|
||||
}
|
||||
|
||||
public string Name => "The Open Movie Database";
|
||||
|
||||
// After primary option
|
||||
public int Order => 2;
|
||||
|
||||
@@ -199,8 +201,6 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||
return GetSearchResults(searchInfo, "movie", cancellationToken);
|
||||
}
|
||||
|
||||
public string Name => "The Open Movie Database";
|
||||
|
||||
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = new MetadataResult<Series>
|
||||
@@ -263,14 +263,14 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||
{
|
||||
var results = await GetSearchResultsInternal(info, "movie", false, cancellationToken).ConfigureAwait(false);
|
||||
var first = results.FirstOrDefault();
|
||||
return first == null ? null : first.GetProviderId(MetadataProvider.Imdb);
|
||||
return first?.GetProviderId(MetadataProvider.Imdb);
|
||||
}
|
||||
|
||||
private async Task<string> GetSeriesImdbId(SeriesInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
var results = await GetSearchResultsInternal(info, "series", false, cancellationToken).ConfigureAwait(false);
|
||||
var first = results.FirstOrDefault();
|
||||
return first == null ? null : first.GetProviderId(MetadataProvider.Imdb);
|
||||
return first?.GetProviderId(MetadataProvider.Imdb);
|
||||
}
|
||||
|
||||
public Task<HttpResponseMessage> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||
@@ -278,7 +278,7 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||
return _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken);
|
||||
}
|
||||
|
||||
class SearchResult
|
||||
private class SearchResult
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user