fix removing emby and jellyfin libraries (#1011)

* fix removing jellyfin and emby libraries

* remove unneeded change
This commit is contained in:
Jason Dove
2022-11-04 06:25:51 -05:00
committed by GitHub
parent d8cc6b4c22
commit 7a87fb1c2e
3 changed files with 25 additions and 8 deletions
+3
View File
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Fix removing Jellyfin and Emby libraries that have been deleted from the source media server
### Added
- Add audio stream selector scripts for episodes and movies
- This will let you customize which audio stream is selected for playback
@@ -178,9 +178,16 @@ public class MediaSourceRepository : IMediaSourceRepository
dbContext.JellyfinLibraries.Add(add);
}
dbContext.JellyfinLibraries.RemoveRange(toDelete);
var libraryIds = toDelete.Map(l => l.Id).ToList();
List<int> deletedMediaIds = await dbContext.MediaItems
.Filter(mi => libraryIds.Contains(mi.LibraryPath.LibraryId))
.Map(mi => mi.Id)
.ToListAsync();
List<int> ids = await DisableJellyfinLibrarySync(toDelete.Map(l => l.Id).ToList());
foreach (JellyfinLibrary delete in toDelete)
{
dbContext.JellyfinLibraries.Remove(delete);
}
foreach (JellyfinLibrary incoming in toUpdate)
{
@@ -214,7 +221,7 @@ public class MediaSourceRepository : IMediaSourceRepository
await dbContext.SaveChangesAsync();
return ids;
return deletedMediaIds;
}
public async Task<List<int>> UpdateLibraries(
@@ -231,9 +238,16 @@ public class MediaSourceRepository : IMediaSourceRepository
dbContext.EmbyLibraries.Add(add);
}
dbContext.EmbyLibraries.RemoveRange(toDelete);
var libraryIds = toDelete.Map(l => l.Id).ToList();
List<int> deletedMediaIds = await dbContext.MediaItems
.Filter(mi => libraryIds.Contains(mi.LibraryPath.LibraryId))
.Map(mi => mi.Id)
.ToListAsync();
List<int> ids = await DisableEmbyLibrarySync(toDelete.Map(l => l.Id).ToList());
foreach (EmbyLibrary delete in toDelete)
{
dbContext.EmbyLibraries.Remove(delete);
}
foreach (EmbyLibrary incoming in toUpdate)
{
@@ -267,7 +281,7 @@ public class MediaSourceRepository : IMediaSourceRepository
await dbContext.SaveChangesAsync();
return ids;
return deletedMediaIds;
}
public async Task<Unit> UpdatePathReplacements(
+2 -2
View File
@@ -27,8 +27,8 @@ Global
{E83551AD-27E4-46E5-AD06-5B0DF797B8FF}.Release|Any CPU.Build.0 = Release|Any CPU
{E83551AD-27E4-46E5-AD06-5B0DF797B8FF}.Debug No Sync|Any CPU.ActiveCfg = Debug No Sync|Any CPU
{E83551AD-27E4-46E5-AD06-5B0DF797B8FF}.Debug No Sync|Any CPU.Build.0 = Debug No Sync|Any CPU
{E83551AD-27E4-46E5-AD06-5B0DF797B8FF}.Debug|Any CPU.ActiveCfg = Debug No Sync|Any CPU
{E83551AD-27E4-46E5-AD06-5B0DF797B8FF}.Debug|Any CPU.Build.0 = Debug No Sync|Any CPU
{E83551AD-27E4-46E5-AD06-5B0DF797B8FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E83551AD-27E4-46E5-AD06-5B0DF797B8FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C56FC23D-B863-401E-8E7C-E92BC307AFC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C56FC23D-B863-401E-8E7C-E92BC307AFC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C56FC23D-B863-401E-8E7C-E92BC307AFC1}.Release|Any CPU.ActiveCfg = Release|Any CPU