-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1824 from mregni/develop
Small fixes
- Loading branch information
Showing
79 changed files
with
5,025 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using EmbyStat.Clients.Base.Metadata; | ||
using EmbyStat.Common.Enums; | ||
|
||
namespace EmbyStat.Clients.Base; | ||
|
||
public interface IMetadataClientFactory | ||
{ | ||
IMetadataClient CreateClient(); | ||
bool AppliesTo(MetadataServerType type); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using EmbyStat.Common.Models.Show; | ||
|
||
namespace EmbyStat.Clients.Base.Metadata; | ||
|
||
public interface IMetadataClient | ||
{ | ||
Task<IEnumerable<VirtualEpisode>> GetEpisodesAsync(int? id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using EmbyStat.Common.Models.Show; | ||
using EmbyStat.Clients.Base.Metadata; | ||
|
||
namespace EmbyStat.Clients.Tmdb; | ||
|
||
public interface ITmdbClient | ||
public interface ITmdbClient : IMetadataClient | ||
{ | ||
Task<IEnumerable<VirtualEpisode>> GetEpisodesAsync(int? tmdbShowId); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using EmbyStat.Clients.Base; | ||
using EmbyStat.Clients.Base.Metadata; | ||
using EmbyStat.Common.Enums; | ||
|
||
namespace EmbyStat.Clients.Tmdb; | ||
|
||
public class TmdbClientFactory : IMetadataClientFactory | ||
{ | ||
private readonly ITmdbClient _client; | ||
|
||
public TmdbClientFactory(ITmdbClient client) | ||
{ | ||
_client = client; | ||
} | ||
|
||
public IMetadataClient CreateClient() | ||
{ | ||
return _client; | ||
} | ||
|
||
public bool AppliesTo(MetadataServerType type) | ||
{ | ||
return type == MetadataServerType.Tmdb; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="TvMaze.Api.Client" Version="0.1.72" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\EmbyStat.Clients.Base\EmbyStat.Clients.Base.csproj" /> | ||
<ProjectReference Include="..\EmbyStat.Clients.Tmdb\EmbyStat.Clients.Tmdb.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using EmbyStat.Clients.Base.Metadata; | ||
|
||
namespace EmbyStat.Clients.TvMaze; | ||
|
||
public interface ITvMazeShowClient : IMetadataClient | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using EmbyStat.Clients.Base; | ||
using EmbyStat.Clients.Base.Metadata; | ||
using EmbyStat.Common.Enums; | ||
|
||
namespace EmbyStat.Clients.TvMaze; | ||
|
||
public class TvMazeClientFactory : IMetadataClientFactory | ||
{ | ||
private readonly ITvMazeShowClient _showClient; | ||
|
||
public TvMazeClientFactory(ITvMazeShowClient showClient) | ||
{ | ||
_showClient = showClient; | ||
} | ||
|
||
public IMetadataClient CreateClient() | ||
{ | ||
return _showClient; | ||
} | ||
|
||
public bool AppliesTo(MetadataServerType type) | ||
{ | ||
return type == MetadataServerType.TvMaze; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using AutoMapper; | ||
using EmbyStat.Clients.Base.Metadata; | ||
using EmbyStat.Clients.Tmdb; | ||
using EmbyStat.Common.Models.Show; | ||
using EmbyStat.Configuration; | ||
using EmbyStat.Configuration.Interfaces; | ||
using TvMaze.Api.Client; | ||
using TvMaze.Api.Client.Models; | ||
|
||
namespace EmbyStat.Clients.TvMaze; | ||
|
||
public class TvMazeShowClient : ITvMazeShowClient | ||
{ | ||
private readonly IMapper _mapper; | ||
|
||
public TvMazeShowClient(IConfigurationService configurationService, IMapper mapper) | ||
{ | ||
_mapper = mapper; | ||
} | ||
|
||
public async Task<IEnumerable<VirtualEpisode>?> GetEpisodesAsync(int? tmdbShowId) | ||
{ | ||
if (!tmdbShowId.HasValue) | ||
{ | ||
return null; | ||
} | ||
|
||
var client = new TvMazeClient(); | ||
var show = await client.Lookup.GetShowByTheTvdbIdAsync(tmdbShowId.Value); | ||
|
||
if (show == null) | ||
{ | ||
return null; | ||
} | ||
|
||
var episodes = await client.Shows.GetShowEpisodeListAsync(show.Id); | ||
return episodes? | ||
.Where(x => x.Type == EpisodeType.Regular) | ||
.Select(x => _mapper.Map<VirtualEpisode>(x)) | ||
.Where(x => x.FirstAired != null && x.FirstAired < DateTime.Now); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace EmbyStat.Common.Enums; | ||
|
||
public enum MetadataServerType | ||
{ | ||
Tmdb = 0, | ||
TvMaze = 1 | ||
} |
Oops, something went wrong.