示例#1
0
 /// <summary>
 /// Convert a <see cref="SearchCollection"/> into a <see cref="Collection"/>.
 /// </summary>
 /// <param name="collection">The collection to convert.</param>
 /// <param name="provider">The provider representing TheMovieDb.</param>
 /// <returns>The converted collection as a <see cref="Collection"/>.</returns>
 public static Collection ToCollection(this TMDbLib.Objects.Collections.Collection collection, Provider provider)
 {
     return(new Collection
     {
         Slug = Utility.ToSlug(collection.Name),
         Name = collection.Name,
         Overview = collection.Overview,
         Images = new Dictionary <int, string>
         {
             [Images.Poster] = collection.PosterPath != null
                                         ? $"https://image.tmdb.org/t/p/original{collection.PosterPath}"
                                         : null,
             [Images.Thumbnail] = collection.BackdropPath != null
                                         ? $"https://image.tmdb.org/t/p/original{collection.BackdropPath}"
                                         : null
         },
         ExternalIDs = new[]
         {
             new MetadataID
             {
                 Provider = provider,
                 Link = $"https://www.themoviedb.org/collection/{collection.Id}",
                 DataID = collection.Id.ToString()
             }
         }
     });
 }
示例#2
0
        public Dictionary <int, CachedMovieInfo> GetMovieIdsFromCollection(int collectionId)
        {
            Dictionary <int, CachedMovieInfo>?returnValue = new Dictionary <int, CachedMovieInfo>();

            TMDbLib.Objects.Collections.Collection collection = Client.GetCollectionAsync(collectionId).Result;
            if (collection == null)
            {
                return(returnValue);
            }

            foreach (var m in collection.Parts)
            {
                int             id   = m.Id;
                CachedMovieInfo info = File(m);
                returnValue.Add(id, info);
            }

            return(returnValue);
        }