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

View File

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

View File

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

View File

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

View File

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

View File

@ -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.AudioDb
public 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.AudioDb
public 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}";

View File

@ -8,11 +8,14 @@ namespace MediaBrowser.Providers.Music
public 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.Music
public 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.Music
public 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.Music
public 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.Music
public 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}";

View File

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

View File

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

View File

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

View File

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

View File

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