The Free Software Media System - Server Backend & API
include external IDs and URLs for book providers
dkanada0413a8b6d29f
diff --git a/MediaBrowser.Providers/Books/Isbn/ISBNExternalId.cs b/MediaBrowser.Providers/Books/Isbn/ISBNExternalId.csnew file mode 100644index 0000000000..a86275d5ae--- /dev/null+++ b/MediaBrowser.Providers/Books/Isbn/ISBNExternalId.cs@@ -0,0 +1,23 @@+using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Providers;+using MediaBrowser.Model.Entities;+using MediaBrowser.Model.Providers;++namespace MediaBrowser.Providers.Books.Isbn+{+ /// <inheritdoc />+ public class IsbnExternalId : IExternalId+ {+ /// <inheritdoc />+ public string ProviderName => "ISBN";++ /// <inheritdoc />+ public string Key => "ISBN";++ /// <inheritdoc />+ public ExternalIdMediaType? Type => null;++ /// <inheritdoc />+ public bool Supports(IHasProviderIds item) => item is Book;+ }+}diff --git a/MediaBrowser.Providers/Books/Isbn/ISBNExternalUrlProvider.cs b/MediaBrowser.Providers/Books/Isbn/ISBNExternalUrlProvider.csnew file mode 100644index 0000000000..9d7b1ff208--- /dev/null+++ b/MediaBrowser.Providers/Books/Isbn/ISBNExternalUrlProvider.cs@@ -0,0 +1,25 @@+using System.Collections.Generic;+using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Providers;+using MediaBrowser.Model.Entities;++namespace MediaBrowser.Providers.Books.Isbn;++/// <inheritdoc/>+public class IsbnExternalUrlProvider : IExternalUrlProvider+{+ /// <inheritdoc/>+ public string Name => "ISBN";++ /// <inheritdoc />+ public IEnumerable<string> GetExternalUrls(BaseItem item)+ {+ if (item.TryGetProviderId("ISBN", out var externalId))+ {+ if (item is Book)+ {+ yield return $"https://search.worldcat.org/search?q=bn:{externalId}";+ }+ }+ }+}diff --git a/MediaBrowser.Providers/Plugins/ComicVine/ComicVineExternalId.cs b/MediaBrowser.Providers/Plugins/ComicVine/ComicVineExternalId.csnew file mode 100644index 0000000000..8cbd1f89a7--- /dev/null+++ b/MediaBrowser.Providers/Plugins/ComicVine/ComicVineExternalId.cs@@ -0,0 +1,23 @@+using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Providers;+using MediaBrowser.Model.Entities;+using MediaBrowser.Model.Providers;++namespace MediaBrowser.Providers.Plugins.ComicVine+{+ /// <inheritdoc />+ public class ComicVineExternalId : IExternalId+ {+ /// <inheritdoc />+ public string ProviderName => "Comic Vine";++ /// <inheritdoc />+ public string Key => "ComicVine";++ /// <inheritdoc />+ public ExternalIdMediaType? Type => null;++ /// <inheritdoc />+ public bool Supports(IHasProviderIds item) => item is Book;+ }+}diff --git a/MediaBrowser.Providers/Plugins/ComicVine/ComicVineExternalUrlProvider.cs b/MediaBrowser.Providers/Plugins/ComicVine/ComicVineExternalUrlProvider.csnew file mode 100644index 0000000000..9122399179--- /dev/null+++ b/MediaBrowser.Providers/Plugins/ComicVine/ComicVineExternalUrlProvider.cs@@ -0,0 +1,28 @@+using System.Collections.Generic;+using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Providers;+using MediaBrowser.Model.Entities;++namespace MediaBrowser.Providers.Plugins.ComicVine;++/// <inheritdoc/>+public class ComicVineExternalUrlProvider : IExternalUrlProvider+{+ /// <inheritdoc/>+ public string Name => "Comic Vine";++ /// <inheritdoc />+ public IEnumerable<string> GetExternalUrls(BaseItem item)+ {+ if (item.TryGetProviderId("ComicVine", out var externalId))+ {+ switch (item)+ {+ case Person:+ case Book:+ yield return $"https://comicvine.gamespot.com/{externalId}";+ break;+ }+ }+ }+}diff --git a/MediaBrowser.Providers/Plugins/ComicVine/ComicVinePersonExternalId.cs b/MediaBrowser.Providers/Plugins/ComicVine/ComicVinePersonExternalId.csnew file mode 100644index 0000000000..26b8e11380--- /dev/null+++ b/MediaBrowser.Providers/Plugins/ComicVine/ComicVinePersonExternalId.cs@@ -0,0 +1,23 @@+using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Providers;+using MediaBrowser.Model.Entities;+using MediaBrowser.Model.Providers;++namespace MediaBrowser.Providers.Plugins.ComicVine+{+ /// <inheritdoc />+ public class ComicVinePersonExternalId : IExternalId+ {+ /// <inheritdoc />+ public string ProviderName => "Comic Vine";++ /// <inheritdoc />+ public string Key => "ComicVine";++ /// <inheritdoc />+ public ExternalIdMediaType? Type => ExternalIdMediaType.Person;++ /// <inheritdoc />+ public bool Supports(IHasProviderIds item) => item is Person;+ }+}diff --git a/MediaBrowser.Providers/Plugins/GoogleBooks/GoogleBooksExternalId.cs b/MediaBrowser.Providers/Plugins/GoogleBooks/GoogleBooksExternalId.csnew file mode 100644index 0000000000..02d3b36974--- /dev/null+++ b/MediaBrowser.Providers/Plugins/GoogleBooks/GoogleBooksExternalId.cs@@ -0,0 +1,23 @@+using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Providers;+using MediaBrowser.Model.Entities;+using MediaBrowser.Model.Providers;++namespace MediaBrowser.Providers.Plugins.GoogleBooks+{+ /// <inheritdoc />+ public class GoogleBooksExternalId : IExternalId+ {+ /// <inheritdoc />+ public string ProviderName => "Google Books";++ /// <inheritdoc />+ public string Key => "GoogleBooks";++ /// <inheritdoc />+ public ExternalIdMediaType? Type => null;++ /// <inheritdoc />+ public bool Supports(IHasProviderIds item) => item is Book;+ }+}diff --git a/MediaBrowser.Providers/Plugins/GoogleBooks/GoogleBooksExternalUrlProvider.cs b/MediaBrowser.Providers/Plugins/GoogleBooks/GoogleBooksExternalUrlProvider.csnew file mode 100644index 0000000000..95047ee83e--- /dev/null+++ b/MediaBrowser.Providers/Plugins/GoogleBooks/GoogleBooksExternalUrlProvider.cs@@ -0,0 +1,25 @@+using System.Collections.Generic;+using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Providers;+using MediaBrowser.Model.Entities;++namespace MediaBrowser.Providers.Plugins.GoogleBooks;++/// <inheritdoc/>+public class GoogleBooksExternalUrlProvider : IExternalUrlProvider+{+ /// <inheritdoc />+ public string Name => "Google Books";++ /// <inheritdoc />+ public IEnumerable<string> GetExternalUrls(BaseItem item)+ {+ if (item.TryGetProviderId("GoogleBooks", out var externalId))+ {+ if (item is Book)+ {+ yield return $"https://books.google.com/books?id={externalId}";+ }+ }+ }+}