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:
@@ -0,0 +1,26 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using ErsatzTV.Core;
|
||||
using ErsatzTV.Core.Emby;
|
||||
using ErsatzTV.Core.Interfaces.Emby;
|
||||
using LanguageExt;
|
||||
using Newtonsoft.Json;
|
||||
using static LanguageExt.Prelude;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Emby
|
||||
{
|
||||
public class EmbySecretStore : IEmbySecretStore
|
||||
{
|
||||
public Task<Unit> DeleteAll() => SaveSecrets(new EmbySecrets());
|
||||
|
||||
public Task<EmbySecrets> ReadSecrets() =>
|
||||
File.ReadAllTextAsync(FileSystemLayout.EmbySecretsPath)
|
||||
.Map(JsonConvert.DeserializeObject<EmbySecrets>)
|
||||
.Map(s => Optional(s).IfNone(new EmbySecrets()));
|
||||
|
||||
public Task<Unit> SaveSecrets(EmbySecrets embySecrets) =>
|
||||
Some(JsonConvert.SerializeObject(embySecrets)).Match(
|
||||
s => File.WriteAllTextAsync(FileSystemLayout.EmbySecretsPath, s).ToUnit(),
|
||||
Task.FromResult(Unit.Default));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user