The Free Software Media System - Server Backend & API
Add type to externalids to distinguish them in the UI
Luke Foust9bdb99fe92ed
diff --git a/MediaBrowser.Controller/Providers/IExternalId.cs b/MediaBrowser.Controller/Providers/IExternalId.csindex d7e337bdab..157a2076eb 100644--- a/MediaBrowser.Controller/Providers/IExternalId.cs+++ b/MediaBrowser.Controller/Providers/IExternalId.cs@@ -8,8 +8,27 @@ namespace MediaBrowser.Controller.Providersstring Key { get; }+ ExternalIdType Type { get; }+string UrlFormatString { get; }bool Supports(IHasProviderIds item);}++ public enum ExternalIdType+ {+ None,+ Album,+ AlbumArtist,+ Artist,+ BoxSet,+ Episode,+ Movie,+ OtherArtist,+ Person,+ ReleaseGroup,+ Season,+ Series,+ Track+ }}diff --git a/MediaBrowser.Model/Providers/ExternalIdInfo.cs b/MediaBrowser.Model/Providers/ExternalIdInfo.csindex 2b481ad7ed..8d6d911434 100644--- a/MediaBrowser.Model/Providers/ExternalIdInfo.cs+++ b/MediaBrowser.Model/Providers/ExternalIdInfo.cs@@ -16,6 +16,12 @@ namespace MediaBrowser.Model.Providers/// <value>The key.</value>public string Key { get; set; }+ /// <summary>+ /// Gets or sets the type.+ /// </summary>+ /// <value>The type.</value>+ public string Type { get; set; }+/// <summary>/// Gets or sets the URL format string./// </summary>diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.csindex e7b349f67b..608a0cd194 100644--- a/MediaBrowser.Providers/Manager/ProviderManager.cs+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs@@ -910,6 +910,7 @@ namespace MediaBrowser.Providers.Manager{Name = i.Name,Key = i.Key,+ Type = i.Type == ExternalIdType.None ? null : i.Type.ToString(),UrlFormatString = i.UrlFormatString});diff --git a/MediaBrowser.Providers/Movies/MovieExternalIds.cs b/MediaBrowser.Providers/Movies/MovieExternalIds.csindex 55810b1ed8..1ede0e7a5f 100644--- a/MediaBrowser.Providers/Movies/MovieExternalIds.cs+++ b/MediaBrowser.Providers/Movies/MovieExternalIds.cs@@ -15,6 +15,9 @@ namespace MediaBrowser.Providers.Movies/// <inheritdoc />public string Key => MetadataProviders.Imdb.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.None;+/// <inheritdoc />public string UrlFormatString => "https://www.imdb.com/title/{0}";@@ -39,6 +42,9 @@ namespace MediaBrowser.Providers.Movies/// <inheritdoc />public string Key => MetadataProviders.Imdb.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Person;+/// <inheritdoc />public string UrlFormatString => "https://www.imdb.com/name/{0}";diff --git a/MediaBrowser.Providers/Music/MusicExternalIds.cs b/MediaBrowser.Providers/Music/MusicExternalIds.csindex 628b9a9a10..54e0347138 100644--- a/MediaBrowser.Providers/Music/MusicExternalIds.cs+++ b/MediaBrowser.Providers/Music/MusicExternalIds.cs@@ -12,6 +12,9 @@ namespace MediaBrowser.Providers.Music/// <inheritdoc />public string Key => "IMVDb";+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.None;+/// <inheritdoc />public string UrlFormatString => null;diff --git a/MediaBrowser.Providers/Plugins/AudioDb/ExternalIds.cs b/MediaBrowser.Providers/Plugins/AudioDb/ExternalIds.csindex 2d8cb431ca..785185d61f 100644--- a/MediaBrowser.Providers/Plugins/AudioDb/ExternalIds.cs+++ b/MediaBrowser.Providers/Plugins/AudioDb/ExternalIds.cs@@ -12,6 +12,9 @@ namespace MediaBrowser.Providers.Plugins.AudioDb/// <inheritdoc />public string Key => MetadataProviders.AudioDbAlbum.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.None;+/// <inheritdoc />public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";@@ -22,11 +25,14 @@ namespace MediaBrowser.Providers.Plugins.AudioDbpublic class AudioDbOtherAlbumExternalId : IExternalId{/// <inheritdoc />- public string Name => "TheAudioDb Album";+ public string Name => "TheAudioDb";/// <inheritdoc />public string Key => MetadataProviders.AudioDbAlbum.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Album;+/// <inheritdoc />public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";@@ -42,6 +48,9 @@ namespace MediaBrowser.Providers.Plugins.AudioDb/// <inheritdoc />public string Key => MetadataProviders.AudioDbArtist.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Artist;+/// <inheritdoc />public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}";@@ -52,11 +61,14 @@ namespace MediaBrowser.Providers.Plugins.AudioDbpublic class AudioDbOtherArtistExternalId : IExternalId{/// <inheritdoc />- public string Name => "TheAudioDb Artist";+ public string Name => "TheAudioDb";/// <inheritdoc />public string Key => MetadataProviders.AudioDbArtist.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.OtherArtist;+/// <inheritdoc />public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}";diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/ExternalIds.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/ExternalIds.csindex 03565a34c4..ed9fa6307f 100644--- a/MediaBrowser.Providers/Plugins/MusicBrainz/ExternalIds.cs+++ b/MediaBrowser.Providers/Plugins/MusicBrainz/ExternalIds.cs@@ -8,11 +8,14 @@ namespace MediaBrowser.Providers.Musicpublic class MusicBrainzReleaseGroupExternalId : IExternalId{/// <inheritdoc />- public string Name => "MusicBrainz Release Group";+ public string Name => "MusicBrainz";/// <inheritdoc />public string Key => MetadataProviders.MusicBrainzReleaseGroup.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.ReleaseGroup;+/// <inheritdoc />public string UrlFormatString => Plugin.Instance.Configuration.Server + "/release-group/{0}";@@ -23,11 +26,14 @@ namespace MediaBrowser.Providers.Musicpublic class MusicBrainzAlbumArtistExternalId : IExternalId{/// <inheritdoc />- public string Name => "MusicBrainz Album Artist";+ public string Name => "MusicBrainz";/// <inheritdoc />public string Key => MetadataProviders.MusicBrainzAlbumArtist.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.AlbumArtist;+/// <inheritdoc />public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";@@ -38,11 +44,14 @@ namespace MediaBrowser.Providers.Musicpublic class MusicBrainzAlbumExternalId : IExternalId{/// <inheritdoc />- public string Name => "MusicBrainz Album";+ public string Name => "MusicBrainz";/// <inheritdoc />public string Key => MetadataProviders.MusicBrainzAlbum.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Album;+/// <inheritdoc />public string UrlFormatString => Plugin.Instance.Configuration.Server + "/release/{0}";@@ -58,6 +67,9 @@ namespace MediaBrowser.Providers.Music/// <inheritdoc />public string Key => MetadataProviders.MusicBrainzArtist.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Artist;+/// <inheritdoc />public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";@@ -68,12 +80,15 @@ namespace MediaBrowser.Providers.Musicpublic class MusicBrainzOtherArtistExternalId : IExternalId{/// <inheritdoc />- public string Name => "MusicBrainz Artist";+ public string Name => "MusicBrainz";/// <inheritdoc />public string Key => MetadataProviders.MusicBrainzArtist.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.OtherArtist;+/// <inheritdoc />public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";@@ -84,11 +99,14 @@ namespace MediaBrowser.Providers.Musicpublic class MusicBrainzTrackId : IExternalId{/// <inheritdoc />- public string Name => "MusicBrainz Track";+ public string Name => "MusicBrainz";/// <inheritdoc />public string Key => MetadataProviders.MusicBrainzTrack.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Track;+/// <inheritdoc />public string UrlFormatString => Plugin.Instance.Configuration.Server + "/track/{0}";diff --git a/MediaBrowser.Providers/TV/TvExternalIds.cs b/MediaBrowser.Providers/TV/TvExternalIds.csindex baf8542851..a3c24f7dd4 100644--- a/MediaBrowser.Providers/TV/TvExternalIds.cs+++ b/MediaBrowser.Providers/TV/TvExternalIds.cs@@ -13,6 +13,9 @@ namespace MediaBrowser.Providers.TV/// <inheritdoc />public string Key => MetadataProviders.Zap2It.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.None;+/// <inheritdoc />public string UrlFormatString => "http://tvlistings.zap2it.com/overview.html?programSeriesId={0}";@@ -28,6 +31,9 @@ namespace MediaBrowser.Providers.TV/// <inheritdoc />public string Key => MetadataProviders.Tvdb.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.None;+/// <inheritdoc />public string UrlFormatString => TvdbUtils.TvdbBaseUrl + "?tab=series&id={0}";@@ -44,6 +50,9 @@ namespace MediaBrowser.Providers.TV/// <inheritdoc />public string Key => MetadataProviders.Tvdb.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Season;+/// <inheritdoc />public string UrlFormatString => null;@@ -59,6 +68,9 @@ namespace MediaBrowser.Providers.TV/// <inheritdoc />public string Key => MetadataProviders.Tvdb.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Episode;+/// <inheritdoc />public string UrlFormatString => TvdbUtils.TvdbBaseUrl + "?tab=episode&id={0}";diff --git a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.csindex 187295e1e4..a51355254d 100644--- a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs+++ b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs@@ -13,6 +13,9 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets/// <inheritdoc />public string Key => MetadataProviders.TmdbCollection.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.BoxSet;+/// <inheritdoc />public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "collection/{0}";diff --git a/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs b/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.csindex fc7a4583fd..af565b079b 100644--- a/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs+++ b/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs@@ -14,6 +14,9 @@ namespace MediaBrowser.Providers.Tmdb.Movies/// <inheritdoc />public string Key => MetadataProviders.Tmdb.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Movie;+/// <inheritdoc />public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "movie/{0}";diff --git a/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs b/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.csindex 2c61bc70aa..1ec43c2696 100644--- a/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs+++ b/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs@@ -12,6 +12,9 @@ namespace MediaBrowser.Providers.Tmdb.People/// <inheritdoc />public string Key => MetadataProviders.Tmdb.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Person;+/// <inheritdoc />public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "person/{0}";diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.csindex 524a3b05e2..43ef06bf7a 100644--- a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs+++ b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs@@ -12,6 +12,9 @@ namespace MediaBrowser.Providers.Tmdb.TV/// <inheritdoc />public string Key => MetadataProviders.Tmdb.ToString();+ /// <inheritdoc />+ public ExternalIdType Type => ExternalIdType.Series;+/// <inheritdoc />public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "tv/{0}";