properly ignore plex other videos libraries (#801)

This commit is contained in:
Jason Dove
2022-05-13 12:31:34 -05:00
committed by GitHub
parent 6d564233ed
commit 9e0972fec0
4 changed files with 12 additions and 5 deletions
+1
View File
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Reduce memory use due to library scan operations
- Fix some instances of filler getting "stuck" when a filler item is encountered that's too long for the gap
- Properly ignore Plex `Other Videos` libraries (`movie` libraries where agent is `com.plexapp.agents.none`)
### Added
- Add `metadata_kind` field to search index to allow searching for items with a particular metdata source
@@ -148,16 +148,20 @@ public class MediaSourceRepository : IMediaSourceRepository
}
}
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();
foreach (PlexLibrary delete in toDelete)
{
dbContext.Entry(delete).State = EntityState.Deleted;
dbContext.PlexLibraries.Remove(delete);
}
List<int> ids = await DisablePlexLibrarySync(toDelete.Map(l => l.Id).ToList());
await dbContext.SaveChangesAsync();
return ids;
return deletedMediaIds;
}
public async Task<List<int>> UpdateLibraries(
@@ -5,6 +5,7 @@ public class PlexLibraryResponse
public string Key { get; set; }
public string Title { get; set; }
public string Type { get; set; }
public string Agent { get; set; }
public int Hidden { get; set; }
public string Uuid { get; set; }
}
@@ -13,8 +13,8 @@ namespace ErsatzTV.Infrastructure.Plex;
public class PlexServerApiClient : IPlexServerApiClient
{
private readonly IFallbackMetadataProvider _fallbackMetadataProvider;
private readonly PlexEtag _plexEtag;
private readonly ILogger<PlexServerApiClient> _logger;
private readonly PlexEtag _plexEtag;
public PlexServerApiClient(
IFallbackMetadataProvider fallbackMetadataProvider,
@@ -64,6 +64,7 @@ public class PlexServerApiClient : IPlexServerApiClient
await service.GetLibraries(token.AuthToken).Map(r => r.MediaContainer.Directory);
return directory
// .Filter(l => l.Hidden == 0)
.Filter(l => (l.Agent ?? string.Empty).ToLowerInvariant() is not "com.plexapp.agents.none")
.Filter(l => l.Type.ToLowerInvariant() is "movie" or "show")
.Map(Project)
.Somes()