diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesImageProvider.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesImageProvider.cs
new file mode 100644
index 0000000..8b81b6d
--- /dev/null
+++ b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesImageProvider.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Net.Http;
+using System.Threading;
+using System.Threading.Tasks;
+using Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.TV;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Providers;
+
+namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers
+{
+ ///
+ /// Image provider which interacts with TubeArchivist library.
+ ///
+ public class SeriesImageProvider : IRemoteImageProvider
+ {
+ ///
+ /// Gets the provider name.
+ ///
+ public string Name => "TubeArchivist";
+
+ ///
+ public bool Supports(BaseItem item) => item is Series;
+
+ ///
+ public IEnumerable GetSupportedImages(BaseItem item)
+ {
+ return new[] { ImageType.Primary };
+ }
+
+ ///
+ public async Task> GetImages(BaseItem item, CancellationToken cancellationToken)
+ {
+ var list = new List();
+ var taApi = TubeArchivistApi.GetInstance();
+ var channelTAId = item.Path.Split("/").Last();
+ var channel = await taApi.GetChannel(channelTAId).ConfigureAwait(true);
+
+ if (channel != null)
+ {
+ list.Add(new RemoteImageInfo
+ {
+ ProviderName = Name,
+ Type = ImageType.Primary,
+ Url = channel.ThumbUrl
+ });
+ list.Add(new RemoteImageInfo
+ {
+ ProviderName = Name,
+ Type = ImageType.Art,
+ Url = channel.TvartUrl
+ });
+ list.Add(new RemoteImageInfo
+ {
+ ProviderName = Name,
+ Type = ImageType.Banner,
+ Url = channel.BannerUrl
+ });
+ }
+
+ return list;
+ }
+
+ ///
+ public async Task GetImageResponse(string url, CancellationToken cancellationToken)
+ {
+ if (Plugin.Instance == null)
+ {
+ throw new DataException("Uninitialized plugin!");
+ }
+ else
+ {
+ Console.WriteLine("Channel images: " + Plugin.Instance.Configuration.TubeArchivistUrl + url);
+ return await Plugin.Instance.HttpClient.GetAsync(new Uri(Plugin.Instance.Configuration.TubeArchivistUrl + url), cancellationToken).ConfigureAwait(false);
+ }
+ }
+ }
+}
diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesMetadataProvider.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesMetadataProvider.cs
new file mode 100644
index 0000000..b44983b
--- /dev/null
+++ b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesMetadataProvider.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Net.Http;
+using System.Threading;
+using System.Threading.Tasks;
+using Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.TV;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Providers;
+using Newtonsoft.Json;
+
+namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers
+{
+ ///
+ /// Metadata provider which interacts with TubeArchivist library.
+ ///
+ public class SeriesMetadataProvider : IRemoteMetadataProvider
+ {
+ ///
+ /// Gets the provider name.
+ ///
+ public string Name => "TubeArchivist";
+
+ ///
+ public async Task> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
+ {
+ var result = new MetadataResult();
+ var taApi = TubeArchivistApi.GetInstance();
+ var channelTAId = info.Path.Split("/").Last();
+ var channel = await taApi.GetChannel(channelTAId).ConfigureAwait(true);
+
+ if (channel != null)
+ {
+ var peopleInfo = new List();
+ PeopleHelper.AddPerson(peopleInfo, new PersonInfo
+ {
+ Name = channel.Name,
+ ImageUrl = channel.ThumbUrl,
+ Type = PersonType.Actor,
+ });
+ result.HasMetadata = true;
+ result.Item = channel.ToSeries();
+ result.Provider = Name;
+ result.People = peopleInfo;
+ }
+
+ return result;
+ }
+
+ ///
+ public async Task> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
+ {
+ var results = new List();
+
+ var taApi = TubeArchivistApi.GetInstance();
+ var channelTAId = searchInfo.Path.Split("/").Last();
+ var channel = await taApi.GetChannel(channelTAId).ConfigureAwait(true);
+ if (channel != null)
+ {
+ results.Add(channel.ToSearchResult());
+ }
+
+ return results;
+ }
+
+ ///
+ public async Task GetImageResponse(string url, CancellationToken cancellationToken)
+ {
+ if (Plugin.Instance == null)
+ {
+ throw new DataException("Uninitialized plugin!");
+ }
+ else
+ {
+ return await Plugin.Instance.HttpClient.GetAsync(url, cancellationToken).ConfigureAwait(false);
+ }
+ }
+ }
+}
diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Channel.cs b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Channel.cs
index 908d01f..0d947e6 100644
--- a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Channel.cs
+++ b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/Channel.cs
@@ -1,3 +1,8 @@
+using System.Collections.Generic;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.TV;
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Providers;
using Newtonsoft.Json;
namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
@@ -67,5 +72,47 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
///
[JsonProperty(PropertyName = "channel_tvart_url")]
public string TvartUrl { get; set; }
+
+ ///
+ /// Converts the TubeArchivist API channel to a Jellyfin object.
+ ///
+ /// The channel equivalent Jellyfin object.
+ public RemoteSearchResult ToSearchResult()
+ {
+ return new RemoteSearchResult
+ {
+ Name = Name,
+ SearchProviderName = Constants.ProviderName,
+ ImageUrl = ThumbUrl,
+ ProviderIds = new Dictionary() { { Constants.ProviderName, Id } }
+ };
+ }
+
+ ///
+ /// Converts the TubeArchivist API channel to a Jellyfin object.
+ ///
+ /// The channel equivalent Jellyfin object.
+ public Series ToSeries()
+ {
+ return new Series
+ {
+ Name = Name,
+ Studios = new[] { Name },
+ ProviderIds = new Dictionary()
+ {
+ {
+ Constants.ProviderName, Id
+ }
+ },
+ ImageInfos = new[]
+ {
+ new ItemImageInfo
+ {
+ Path = ThumbUrl,
+ Type = ImageType.Primary
+ }
+ }
+ };
+ }
}
}