Jump to content

Group Items By Library


bakes82

Recommended Posts

bakes82

How do we know the "library" an item is in when a library contain multiple paths?  I thought it was GetTopParent, but that doesnt seem to be it, I think its only returning the ID of the top folder path.

 

EX if I have a library with 3 paths, and I have the same movie in 2 of the 3 paths the GetTopParentId of the two items doesnt seem to be the same.

 

var movies = _libraryManager.GetItemList(new InternalItemsQuery
                                                 {
                                                     IncludeItemTypes = new[]
                                                                        {
                                                                            nameof(Movie)
                                                                        },
                                                     IsVirtualItem = false,
                                                     Recursive     = true
                                                 })
                                    .Select(m => m as Movie);


var duplications = movies.Where(m => m.ProviderIds != null && m.GetProviderId(MetadataProviders.Imdb) != null && m.GetProviderId(MetadataProviders.Tmdb) == null)
                                 .GroupBy(x => new
                                               {
                                                   V = x.GetProviderId(MetadataProviders.Imdb) + x.GetTopParent().Id.ToString()
                                               })
                                 .Where(x => x.Count() > 1)
                                 .ToList();

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...