Add type to externalids to distinguish them in the UI

This commit is contained in:
Luke Foust 2020-03-22 12:58:53 -07:00
parent f3213d3bef
commit 9bdb99fe92
12 changed files with 96 additions and 7 deletions

View File

@ -8,8 +8,27 @@ namespace MediaBrowser.Controller.Providers
string Key { get; } string Key { get; }
ExternalIdType Type { get; }
string UrlFormatString { get; } string UrlFormatString { get; }
bool Supports(IHasProviderIds item); bool Supports(IHasProviderIds item);
} }
public enum ExternalIdType
{
None,
Album,
AlbumArtist,
Artist,
BoxSet,
Episode,
Movie,
OtherArtist,
Person,
ReleaseGroup,
Season,
Series,
Track
}
} }

View File

@ -16,6 +16,12 @@ namespace MediaBrowser.Model.Providers
/// <value>The key.</value> /// <value>The key.</value>
public string Key { get; set; } public string Key { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public string Type { get; set; }
/// <summary> /// <summary>
/// Gets or sets the URL format string. /// Gets or sets the URL format string.
/// </summary> /// </summary>

View File

@ -910,6 +910,7 @@ namespace MediaBrowser.Providers.Manager
{ {
Name = i.Name, Name = i.Name,
Key = i.Key, Key = i.Key,
Type = i.Type == ExternalIdType.None ? null : i.Type.ToString(),
UrlFormatString = i.UrlFormatString UrlFormatString = i.UrlFormatString
}); });

View File

@ -15,6 +15,9 @@ namespace MediaBrowser.Providers.Movies
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.Imdb.ToString(); public string Key => MetadataProviders.Imdb.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.None;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => "https://www.imdb.com/title/{0}"; public string UrlFormatString => "https://www.imdb.com/title/{0}";
@ -39,6 +42,9 @@ namespace MediaBrowser.Providers.Movies
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.Imdb.ToString(); public string Key => MetadataProviders.Imdb.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Person;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => "https://www.imdb.com/name/{0}"; public string UrlFormatString => "https://www.imdb.com/name/{0}";

View File

@ -12,6 +12,9 @@ namespace MediaBrowser.Providers.Music
/// <inheritdoc /> /// <inheritdoc />
public string Key => "IMVDb"; public string Key => "IMVDb";
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.None;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => null; public string UrlFormatString => null;

View File

@ -12,6 +12,9 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.AudioDbAlbum.ToString(); public string Key => MetadataProviders.AudioDbAlbum.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.None;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => "https://www.theaudiodb.com/album/{0}"; public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";
@ -22,11 +25,14 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public class AudioDbOtherAlbumExternalId : IExternalId public class AudioDbOtherAlbumExternalId : IExternalId
{ {
/// <inheritdoc /> /// <inheritdoc />
public string Name => "TheAudioDb Album"; public string Name => "TheAudioDb";
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.AudioDbAlbum.ToString(); public string Key => MetadataProviders.AudioDbAlbum.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Album;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => "https://www.theaudiodb.com/album/{0}"; public string UrlFormatString => "https://www.theaudiodb.com/album/{0}";
@ -42,6 +48,9 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.AudioDbArtist.ToString(); public string Key => MetadataProviders.AudioDbArtist.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Artist;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}"; public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}";
@ -52,11 +61,14 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
public class AudioDbOtherArtistExternalId : IExternalId public class AudioDbOtherArtistExternalId : IExternalId
{ {
/// <inheritdoc /> /// <inheritdoc />
public string Name => "TheAudioDb Artist"; public string Name => "TheAudioDb";
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.AudioDbArtist.ToString(); public string Key => MetadataProviders.AudioDbArtist.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.OtherArtist;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}"; public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}";

View File

@ -8,11 +8,14 @@ namespace MediaBrowser.Providers.Music
public class MusicBrainzReleaseGroupExternalId : IExternalId public class MusicBrainzReleaseGroupExternalId : IExternalId
{ {
/// <inheritdoc /> /// <inheritdoc />
public string Name => "MusicBrainz Release Group"; public string Name => "MusicBrainz";
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.MusicBrainzReleaseGroup.ToString(); public string Key => MetadataProviders.MusicBrainzReleaseGroup.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.ReleaseGroup;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/release-group/{0}"; public string UrlFormatString => Plugin.Instance.Configuration.Server + "/release-group/{0}";
@ -23,11 +26,14 @@ namespace MediaBrowser.Providers.Music
public class MusicBrainzAlbumArtistExternalId : IExternalId public class MusicBrainzAlbumArtistExternalId : IExternalId
{ {
/// <inheritdoc /> /// <inheritdoc />
public string Name => "MusicBrainz Album Artist"; public string Name => "MusicBrainz";
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.MusicBrainzAlbumArtist.ToString(); public string Key => MetadataProviders.MusicBrainzAlbumArtist.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.AlbumArtist;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}"; public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";
@ -38,11 +44,14 @@ namespace MediaBrowser.Providers.Music
public class MusicBrainzAlbumExternalId : IExternalId public class MusicBrainzAlbumExternalId : IExternalId
{ {
/// <inheritdoc /> /// <inheritdoc />
public string Name => "MusicBrainz Album"; public string Name => "MusicBrainz";
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.MusicBrainzAlbum.ToString(); public string Key => MetadataProviders.MusicBrainzAlbum.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Album;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/release/{0}"; public string UrlFormatString => Plugin.Instance.Configuration.Server + "/release/{0}";
@ -58,6 +67,9 @@ namespace MediaBrowser.Providers.Music
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.MusicBrainzArtist.ToString(); public string Key => MetadataProviders.MusicBrainzArtist.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Artist;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}"; public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";
@ -68,12 +80,15 @@ namespace MediaBrowser.Providers.Music
public class MusicBrainzOtherArtistExternalId : IExternalId public class MusicBrainzOtherArtistExternalId : IExternalId
{ {
/// <inheritdoc /> /// <inheritdoc />
public string Name => "MusicBrainz Artist"; public string Name => "MusicBrainz";
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.MusicBrainzArtist.ToString(); public string Key => MetadataProviders.MusicBrainzArtist.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.OtherArtist;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}"; public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}";
@ -84,11 +99,14 @@ namespace MediaBrowser.Providers.Music
public class MusicBrainzTrackId : IExternalId public class MusicBrainzTrackId : IExternalId
{ {
/// <inheritdoc /> /// <inheritdoc />
public string Name => "MusicBrainz Track"; public string Name => "MusicBrainz";
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.MusicBrainzTrack.ToString(); public string Key => MetadataProviders.MusicBrainzTrack.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Track;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => Plugin.Instance.Configuration.Server + "/track/{0}"; public string UrlFormatString => Plugin.Instance.Configuration.Server + "/track/{0}";

View File

@ -13,6 +13,9 @@ namespace MediaBrowser.Providers.TV
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.Zap2It.ToString(); public string Key => MetadataProviders.Zap2It.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.None;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => "http://tvlistings.zap2it.com/overview.html?programSeriesId={0}"; public string UrlFormatString => "http://tvlistings.zap2it.com/overview.html?programSeriesId={0}";
@ -28,6 +31,9 @@ namespace MediaBrowser.Providers.TV
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.Tvdb.ToString(); public string Key => MetadataProviders.Tvdb.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.None;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => TvdbUtils.TvdbBaseUrl + "?tab=series&id={0}"; public string UrlFormatString => TvdbUtils.TvdbBaseUrl + "?tab=series&id={0}";
@ -44,6 +50,9 @@ namespace MediaBrowser.Providers.TV
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.Tvdb.ToString(); public string Key => MetadataProviders.Tvdb.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Season;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => null; public string UrlFormatString => null;
@ -59,6 +68,9 @@ namespace MediaBrowser.Providers.TV
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.Tvdb.ToString(); public string Key => MetadataProviders.Tvdb.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Episode;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => TvdbUtils.TvdbBaseUrl + "?tab=episode&id={0}"; public string UrlFormatString => TvdbUtils.TvdbBaseUrl + "?tab=episode&id={0}";

View File

@ -13,6 +13,9 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.TmdbCollection.ToString(); public string Key => MetadataProviders.TmdbCollection.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.BoxSet;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "collection/{0}"; public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "collection/{0}";

View File

@ -14,6 +14,9 @@ namespace MediaBrowser.Providers.Tmdb.Movies
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.Tmdb.ToString(); public string Key => MetadataProviders.Tmdb.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Movie;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "movie/{0}"; public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "movie/{0}";

View File

@ -12,6 +12,9 @@ namespace MediaBrowser.Providers.Tmdb.People
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.Tmdb.ToString(); public string Key => MetadataProviders.Tmdb.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Person;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "person/{0}"; public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "person/{0}";

View File

@ -12,6 +12,9 @@ namespace MediaBrowser.Providers.Tmdb.TV
/// <inheritdoc /> /// <inheritdoc />
public string Key => MetadataProviders.Tmdb.ToString(); public string Key => MetadataProviders.Tmdb.ToString();
/// <inheritdoc />
public ExternalIdType Type => ExternalIdType.Series;
/// <inheritdoc /> /// <inheritdoc />
public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "tv/{0}"; public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "tv/{0}";