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:
Jason Dove
2021-05-23 03:05:23 -05:00
committed by GitHub
parent 0b105bf6e1
commit 50529ee6ad
134 changed files with 7905 additions and 673 deletions
@@ -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));
}
}