add button to refresh list of libraries (#226)

* add button to refresh list of libraries

* code cleanup
This commit is contained in:
Jason Dove
2021-05-28 15:28:45 -05:00
committed by GitHub
parent e841c9c53b
commit bbd8bc6c7e
11 changed files with 97 additions and 22 deletions
@@ -206,7 +206,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
}
}
public async Task<Unit> UpdateLibraries(
public async Task<List<int>> UpdateLibraries(
int plexMediaSourceId,
List<PlexLibrary> toAdd,
List<PlexLibrary> toDelete)
@@ -228,12 +228,14 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
dbContext.Entry(delete).State = EntityState.Deleted;
}
List<int> ids = await DisablePlexLibrarySync(toDelete.Map(l => l.Id).ToList());
await dbContext.SaveChangesAsync();
return Unit.Default;
return ids;
}
public async Task<Unit> UpdateLibraries(
public async Task<List<int>> UpdateLibraries(
int jellyfinMediaSourceId,
List<JellyfinLibrary> toAdd,
List<JellyfinLibrary> toDelete)
@@ -255,12 +257,14 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
dbContext.Entry(delete).State = EntityState.Deleted;
}
List<int> ids = await DisableJellyfinLibrarySync(toDelete.Map(l => l.Id).ToList());
await dbContext.SaveChangesAsync();
return Unit.Default;
return ids;
}
public async Task<Unit> UpdateLibraries(
public async Task<List<int>> UpdateLibraries(
int embyMediaSourceId,
List<EmbyLibrary> toAdd,
List<EmbyLibrary> toDelete)
@@ -282,9 +286,11 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
dbContext.Entry(delete).State = EntityState.Deleted;
}
List<int> ids = await DisableEmbyLibrarySync(toDelete.Map(l => l.Id).ToList());
await dbContext.SaveChangesAsync();
return Unit.Default;
return ids;
}
public async Task<Unit> UpdatePathReplacements(
@@ -71,6 +71,9 @@ namespace ErsatzTV.Infrastructure.Locking
public bool IsPlexLocked() => _plex;
public bool IsRemoteMediaSourceLocked<TMediaSource>() =>
_lockedRemoteMediaSourceTypes.ContainsKey(typeof(TMediaSource));
public bool LockRemoteMediaSource<TMediaSource>()
{
Type mediaSourceType = typeof(TMediaSource);