コード例 #1
0
        private static void PopulateImagePaths(Credits credits)
        {
            if (credits != null)
            {
                if (credits.Cast != null)
                {
                    foreach (var cast in credits.Cast.Where(c => !c.ProfilePath.IsNullOrEmpty()))
                        cast.ProfilePath = PlexResources.TmdbActorImageRoot + cast.ProfilePath;
                }

                if (credits.GuestStars != null)
                {
                    foreach (var cast in credits.GuestStars.Where(c => !c.ProfilePath.IsNullOrEmpty()))
                        cast.ProfilePath = PlexResources.TmdbActorImageRoot + cast.ProfilePath;
                }
            }
        }
コード例 #2
0
        private static void MergeRoles(Video video, Credits credits)
        {
            if (video.RolesComeFromTmdb && video.Roles != null && video.Roles.Any())
                return;

            if (credits == null) return;

            var tmdbCastMembers = new List<Cast>();
            if (credits.Cast != null)
                tmdbCastMembers.AddRange(credits.Cast);
            if (credits.GuestStars != null)
                tmdbCastMembers.AddRange(credits.GuestStars);

            if (!tmdbCastMembers.Any()) return;

            if (video.Roles == null)
                video.Roles = new ObservableCollectionEx<Role>();

            var roles = new List<Role>();
            var nextId = 0;

            foreach (var actor in tmdbCastMembers)
            {
                roles.Add(new Role
                {
                    Id = nextId,
                    RoleName = actor.Character,
                    Tag = actor.Name,
                    Thumb = actor.ProfilePath,
                    ExternalIds = new ExternalIds {TmdbId = actor.Id}
                });

                nextId++;
            }

            video.Roles.ClearAndAddRange(roles);
            video.RolesComeFromTmdb = true;
        }