add emby media source (#201)
* properly scope jellyfin disconnect * add emby entities * add emby media source page * add emby media source editor * sync emby libraries * enable emby library sync toggle * add emby path replacements editor * add emby movie synchronization * fix emby artwork * sync emby television * code cleanup * add jellyfin/emby address placeholder * tweak jellyfin/emby address form
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ErsatzTV.Infrastructure.Jellyfin.Models;
|
||||
using Refit;
|
||||
@@ -11,7 +12,8 @@ namespace ErsatzTV.Infrastructure.Jellyfin
|
||||
[Get("/System/Info")]
|
||||
public Task<JellyfinSystemInformationResponse> GetSystemInformation(
|
||||
[Header("X-Emby-Token")]
|
||||
string apiKey);
|
||||
string apiKey,
|
||||
CancellationToken cancellationToken);
|
||||
|
||||
[Get("/Users")]
|
||||
public Task<List<JellyfinUserResponse>> GetUsers(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ErsatzTV.Core;
|
||||
using ErsatzTV.Core.Domain;
|
||||
@@ -39,9 +40,16 @@ namespace ErsatzTV.Infrastructure.Jellyfin
|
||||
try
|
||||
{
|
||||
IJellyfinApi service = RestService.For<IJellyfinApi>(address);
|
||||
return await service.GetSystemInformation(apiKey)
|
||||
var cts = new CancellationTokenSource();
|
||||
cts.CancelAfter(TimeSpan.FromSeconds(5));
|
||||
return await service.GetSystemInformation(apiKey, cts.Token)
|
||||
.Map(response => new JellyfinServerInformation(response.ServerName, response.OperatingSystem));
|
||||
}
|
||||
catch (OperationCanceledException ex)
|
||||
{
|
||||
_logger.LogError(ex, "Timeout getting jellyfin server name");
|
||||
return BaseError.New("Jellyfin did not respond in time");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error getting jellyfin server name");
|
||||
|
||||
Reference in New Issue
Block a user