From 0fb78cf54b51843c54e7ff59d191c490a5b196cd Mon Sep 17 00:00:00 2001 From: Luke Foust Date: Thu, 26 Mar 2020 14:26:12 -0700 Subject: [PATCH] Add documentation around Name, Id, and Type. Changed ExternalIdType to ExternalIdMediaType --- .../Providers/ExternalIdMediaType.cs | 45 +++++++++++++++++++ .../Providers/IExternalId.cs | 27 ++++------- .../Providers/ExternalIdInfo.cs | 17 ++++--- .../Manager/ProviderManager.cs | 2 +- .../Movies/MovieExternalIds.cs | 4 +- .../Music/MusicExternalIds.cs | 2 +- .../Plugins/AudioDb/ExternalIds.cs | 8 ++-- .../Plugins/MusicBrainz/ExternalIds.cs | 12 ++--- MediaBrowser.Providers/TV/TvExternalIds.cs | 8 ++-- .../Tmdb/BoxSets/TmdbBoxSetExternalId.cs | 2 +- .../Tmdb/Movies/TmdbMovieExternalId.cs | 2 +- .../Tmdb/People/TmdbPersonExternalId.cs | 2 +- .../Tmdb/TV/TmdbSeriesExternalId.cs | 2 +- 13 files changed, 84 insertions(+), 49 deletions(-) create mode 100644 MediaBrowser.Controller/Providers/ExternalIdMediaType.cs diff --git a/MediaBrowser.Controller/Providers/ExternalIdMediaType.cs b/MediaBrowser.Controller/Providers/ExternalIdMediaType.cs new file mode 100644 index 0000000000..470f1e24c0 --- /dev/null +++ b/MediaBrowser.Controller/Providers/ExternalIdMediaType.cs @@ -0,0 +1,45 @@ +namespace MediaBrowser.Controller.Providers +{ + /// The specific media type of an . + public enum ExternalIdMediaType + { + /// There is no specific media type + None, + + /// A music album + Album, + + /// The artist of a music album + AlbumArtist, + + /// The artist of a media item + Artist, + + /// A boxed set of media + BoxSet, + + /// A series episode + Episode, + + /// A movie + Movie, + + /// An alternative artist apart from the main artist + OtherArtist, + + /// A person + Person, + + /// A release group + ReleaseGroup, + + /// A single season of a series + Season, + + /// A series + Series, + + /// A music track + Track + } +} diff --git a/MediaBrowser.Controller/Providers/IExternalId.cs b/MediaBrowser.Controller/Providers/IExternalId.cs index 157a2076eb..c877ffe1fe 100644 --- a/MediaBrowser.Controller/Providers/IExternalId.cs +++ b/MediaBrowser.Controller/Providers/IExternalId.cs @@ -2,33 +2,24 @@ using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Providers { + /// Represents and identifier for an external provider. public interface IExternalId { + /// Gets the name used to identify this provider string Name { get; } + /// Gets the unique key to distinguish this provider/type pair. This should be unique across providers. string Key { get; } - ExternalIdType Type { get; } + /// Gets the specific media type for this id. + ExternalIdMediaType Type { get; } + /// Gets the url format string for this id. string UrlFormatString { get; } + /// Determines whether this id supports a given item type. + /// The item. + /// True if this item is supported, otherwise false. 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.cs index 8d6d911434..befcc309bf 100644 --- a/MediaBrowser.Model/Providers/ExternalIdInfo.cs +++ b/MediaBrowser.Model/Providers/ExternalIdInfo.cs @@ -1,31 +1,30 @@ -#pragma warning disable CS1591 - namespace MediaBrowser.Model.Providers { + /// + /// Represents the external id information for serialization to the client. + /// public class ExternalIdInfo { /// - /// Gets or sets the name. + /// Gets or sets the name of the external id provider (IE: IMDB, MusicBrainz, etc). /// - /// The name. public string Name { get; set; } /// - /// Gets or sets the key. + /// Gets or sets the unique key for this id. This key should be unique across all providers. /// - /// The key. public string Key { get; set; } /// - /// Gets or sets the type. + /// Gets or sets the media type (Album, Artist, etc). + /// This can be null if there is no specific type. + /// This string is also used to localize the media type on the client. /// - /// The type. public string Type { get; set; } /// /// Gets or sets the URL format string. /// - /// The URL format string. public string UrlFormatString { get; set; } } } diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index 608a0cd194..fee988d50a 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -910,7 +910,7 @@ namespace MediaBrowser.Providers.Manager { Name = i.Name, Key = i.Key, - Type = i.Type == ExternalIdType.None ? null : i.Type.ToString(), + Type = i.Type == ExternalIdMediaType.None ? null : i.Type.ToString(), UrlFormatString = i.UrlFormatString }); diff --git a/MediaBrowser.Providers/Movies/MovieExternalIds.cs b/MediaBrowser.Providers/Movies/MovieExternalIds.cs index 1ede0e7a5f..a7b359a2d8 100644 --- a/MediaBrowser.Providers/Movies/MovieExternalIds.cs +++ b/MediaBrowser.Providers/Movies/MovieExternalIds.cs @@ -16,7 +16,7 @@ namespace MediaBrowser.Providers.Movies public string Key => MetadataProviders.Imdb.ToString(); /// - public ExternalIdType Type => ExternalIdType.None; + public ExternalIdMediaType Type => ExternalIdMediaType.None; /// public string UrlFormatString => "https://www.imdb.com/title/{0}"; @@ -43,7 +43,7 @@ namespace MediaBrowser.Providers.Movies public string Key => MetadataProviders.Imdb.ToString(); /// - public ExternalIdType Type => ExternalIdType.Person; + public ExternalIdMediaType Type => ExternalIdMediaType.Person; /// public string UrlFormatString => "https://www.imdb.com/name/{0}"; diff --git a/MediaBrowser.Providers/Music/MusicExternalIds.cs b/MediaBrowser.Providers/Music/MusicExternalIds.cs index 54e0347138..19879411e1 100644 --- a/MediaBrowser.Providers/Music/MusicExternalIds.cs +++ b/MediaBrowser.Providers/Music/MusicExternalIds.cs @@ -13,7 +13,7 @@ namespace MediaBrowser.Providers.Music public string Key => "IMVDb"; /// - public ExternalIdType Type => ExternalIdType.None; + public ExternalIdMediaType Type => ExternalIdMediaType.None; /// public string UrlFormatString => null; diff --git a/MediaBrowser.Providers/Plugins/AudioDb/ExternalIds.cs b/MediaBrowser.Providers/Plugins/AudioDb/ExternalIds.cs index 785185d61f..cd65acb769 100644 --- a/MediaBrowser.Providers/Plugins/AudioDb/ExternalIds.cs +++ b/MediaBrowser.Providers/Plugins/AudioDb/ExternalIds.cs @@ -13,7 +13,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDb public string Key => MetadataProviders.AudioDbAlbum.ToString(); /// - public ExternalIdType Type => ExternalIdType.None; + public ExternalIdMediaType Type => ExternalIdMediaType.None; /// public string UrlFormatString => "https://www.theaudiodb.com/album/{0}"; @@ -31,7 +31,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDb public string Key => MetadataProviders.AudioDbAlbum.ToString(); /// - public ExternalIdType Type => ExternalIdType.Album; + public ExternalIdMediaType Type => ExternalIdMediaType.Album; /// public string UrlFormatString => "https://www.theaudiodb.com/album/{0}"; @@ -49,7 +49,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDb public string Key => MetadataProviders.AudioDbArtist.ToString(); /// - public ExternalIdType Type => ExternalIdType.Artist; + public ExternalIdMediaType Type => ExternalIdMediaType.Artist; /// public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}"; @@ -67,7 +67,7 @@ namespace MediaBrowser.Providers.Plugins.AudioDb public string Key => MetadataProviders.AudioDbArtist.ToString(); /// - public ExternalIdType Type => ExternalIdType.OtherArtist; + public ExternalIdMediaType Type => ExternalIdMediaType.OtherArtist; /// public string UrlFormatString => "https://www.theaudiodb.com/artist/{0}"; diff --git a/MediaBrowser.Providers/Plugins/MusicBrainz/ExternalIds.cs b/MediaBrowser.Providers/Plugins/MusicBrainz/ExternalIds.cs index ed9fa6307f..7d74a8d351 100644 --- a/MediaBrowser.Providers/Plugins/MusicBrainz/ExternalIds.cs +++ b/MediaBrowser.Providers/Plugins/MusicBrainz/ExternalIds.cs @@ -14,7 +14,7 @@ namespace MediaBrowser.Providers.Music public string Key => MetadataProviders.MusicBrainzReleaseGroup.ToString(); /// - public ExternalIdType Type => ExternalIdType.ReleaseGroup; + public ExternalIdMediaType Type => ExternalIdMediaType.ReleaseGroup; /// public string UrlFormatString => Plugin.Instance.Configuration.Server + "/release-group/{0}"; @@ -32,7 +32,7 @@ namespace MediaBrowser.Providers.Music public string Key => MetadataProviders.MusicBrainzAlbumArtist.ToString(); /// - public ExternalIdType Type => ExternalIdType.AlbumArtist; + public ExternalIdMediaType Type => ExternalIdMediaType.AlbumArtist; /// public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}"; @@ -50,7 +50,7 @@ namespace MediaBrowser.Providers.Music public string Key => MetadataProviders.MusicBrainzAlbum.ToString(); /// - public ExternalIdType Type => ExternalIdType.Album; + public ExternalIdMediaType Type => ExternalIdMediaType.Album; /// public string UrlFormatString => Plugin.Instance.Configuration.Server + "/release/{0}"; @@ -68,7 +68,7 @@ namespace MediaBrowser.Providers.Music public string Key => MetadataProviders.MusicBrainzArtist.ToString(); /// - public ExternalIdType Type => ExternalIdType.Artist; + public ExternalIdMediaType Type => ExternalIdMediaType.Artist; /// public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}"; @@ -87,7 +87,7 @@ namespace MediaBrowser.Providers.Music public string Key => MetadataProviders.MusicBrainzArtist.ToString(); /// - public ExternalIdType Type => ExternalIdType.OtherArtist; + public ExternalIdMediaType Type => ExternalIdMediaType.OtherArtist; /// public string UrlFormatString => Plugin.Instance.Configuration.Server + "/artist/{0}"; @@ -105,7 +105,7 @@ namespace MediaBrowser.Providers.Music public string Key => MetadataProviders.MusicBrainzTrack.ToString(); /// - public ExternalIdType Type => ExternalIdType.Track; + public ExternalIdMediaType Type => ExternalIdMediaType.Track; /// public string UrlFormatString => Plugin.Instance.Configuration.Server + "/track/{0}"; diff --git a/MediaBrowser.Providers/TV/TvExternalIds.cs b/MediaBrowser.Providers/TV/TvExternalIds.cs index a3c24f7dd4..75d8b6bf58 100644 --- a/MediaBrowser.Providers/TV/TvExternalIds.cs +++ b/MediaBrowser.Providers/TV/TvExternalIds.cs @@ -14,7 +14,7 @@ namespace MediaBrowser.Providers.TV public string Key => MetadataProviders.Zap2It.ToString(); /// - public ExternalIdType Type => ExternalIdType.None; + public ExternalIdMediaType Type => ExternalIdMediaType.None; /// public string UrlFormatString => "http://tvlistings.zap2it.com/overview.html?programSeriesId={0}"; @@ -32,7 +32,7 @@ namespace MediaBrowser.Providers.TV public string Key => MetadataProviders.Tvdb.ToString(); /// - public ExternalIdType Type => ExternalIdType.None; + public ExternalIdMediaType Type => ExternalIdMediaType.None; /// public string UrlFormatString => TvdbUtils.TvdbBaseUrl + "?tab=series&id={0}"; @@ -51,7 +51,7 @@ namespace MediaBrowser.Providers.TV public string Key => MetadataProviders.Tvdb.ToString(); /// - public ExternalIdType Type => ExternalIdType.Season; + public ExternalIdMediaType Type => ExternalIdMediaType.Season; /// public string UrlFormatString => null; @@ -69,7 +69,7 @@ namespace MediaBrowser.Providers.TV public string Key => MetadataProviders.Tvdb.ToString(); /// - public ExternalIdType Type => ExternalIdType.Episode; + public ExternalIdMediaType Type => ExternalIdMediaType.Episode; /// public string UrlFormatString => TvdbUtils.TvdbBaseUrl + "?tab=episode&id={0}"; diff --git a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs index a51355254d..a83cde93c6 100644 --- a/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs +++ b/MediaBrowser.Providers/Tmdb/BoxSets/TmdbBoxSetExternalId.cs @@ -14,7 +14,7 @@ namespace MediaBrowser.Providers.Tmdb.BoxSets public string Key => MetadataProviders.TmdbCollection.ToString(); /// - public ExternalIdType Type => ExternalIdType.BoxSet; + public ExternalIdMediaType Type => ExternalIdMediaType.BoxSet; /// public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "collection/{0}"; diff --git a/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs b/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs index af565b079b..f9ea000676 100644 --- a/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs +++ b/MediaBrowser.Providers/Tmdb/Movies/TmdbMovieExternalId.cs @@ -15,7 +15,7 @@ namespace MediaBrowser.Providers.Tmdb.Movies public string Key => MetadataProviders.Tmdb.ToString(); /// - public ExternalIdType Type => ExternalIdType.Movie; + public ExternalIdMediaType Type => ExternalIdMediaType.Movie; /// public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "movie/{0}"; diff --git a/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs b/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs index 1ec43c2696..854fd41560 100644 --- a/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs +++ b/MediaBrowser.Providers/Tmdb/People/TmdbPersonExternalId.cs @@ -13,7 +13,7 @@ namespace MediaBrowser.Providers.Tmdb.People public string Key => MetadataProviders.Tmdb.ToString(); /// - public ExternalIdType Type => ExternalIdType.Person; + public ExternalIdMediaType Type => ExternalIdMediaType.Person; /// public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "person/{0}"; diff --git a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs index 43ef06bf7a..770448c7f7 100644 --- a/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs +++ b/MediaBrowser.Providers/Tmdb/TV/TmdbSeriesExternalId.cs @@ -13,7 +13,7 @@ namespace MediaBrowser.Providers.Tmdb.TV public string Key => MetadataProviders.Tmdb.ToString(); /// - public ExternalIdType Type => ExternalIdType.Series; + public ExternalIdMediaType Type => ExternalIdMediaType.Series; /// public string UrlFormatString => TmdbUtils.BaseTmdbUrl + "tv/{0}";