当前位置: 首页>>代码示例>>C#>>正文


C# BaseItem.AddStudio方法代码示例

本文整理汇总了C#中BaseItem.AddStudio方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItem.AddStudio方法的具体用法?C# BaseItem.AddStudio怎么用?C# BaseItem.AddStudio使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseItem的用法示例。


在下文中一共展示了BaseItem.AddStudio方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessMainInfo


//.........这里部分代码省略.........
                        if (usRelease.release_date.Year != 1)
                        {
                            movie.PremiereDate = usRelease.release_date.ToUniversalTime();
                            movie.ProductionYear = usRelease.release_date.Year;
                        }
                    }
                    else if (minimunRelease.release_date != default(DateTime))
                    {
                        if (minimunRelease.release_date.Year != 1)
                        {

                            movie.PremiereDate = minimunRelease.release_date.ToUniversalTime();
                            movie.ProductionYear = minimunRelease.release_date.Year;
                        }
                    }
                }
                else
                {
                    if (movieData.release_date.Year != 1)
                    {
                        //no specific country release info at all
                        movie.PremiereDate = movieData.release_date.ToUniversalTime();
                        movie.ProductionYear = movieData.release_date.Year;
                    }
                }

                //if that didn't find a rating and we are a boxset, use the one from our first child
                if (movie.OfficialRating == null && movie is BoxSet)
                {
                    var boxset = movie as BoxSet;
                    Logger.Info("MovieDbProvider - Using rating of first child of boxset...");

                    var firstChild = boxset.Children.Concat(boxset.GetLinkedChildren()).FirstOrDefault();

                    boxset.OfficialRating = firstChild != null ? firstChild.OfficialRating : null;
                }

                if (movieData.runtime > 0)
                    movie.OriginalRunTimeTicks = TimeSpan.FromMinutes(movieData.runtime).Ticks;

                //studios
                if (movieData.production_companies != null && !movie.LockedFields.Contains(MetadataFields.Studios))
                {
                    movie.Studios.Clear();

                    foreach (var studio in movieData.production_companies.Select(c => c.name))
                    {
                        movie.AddStudio(studio);
                    }
                }

                //genres
                if (movieData.genres != null && !movie.LockedFields.Contains(MetadataFields.Genres))
                {
                    movie.Genres.Clear();

                    foreach (var genre in movieData.genres.Select(g => g.name))
                    {
                        movie.AddGenre(genre);
                    }
                }

                if (!movie.LockedFields.Contains(MetadataFields.Cast))
                {
                    movie.People.Clear();

                    //Actors, Directors, Writers - all in People
                    //actors come from cast
                    if (movieData.casts != null && movieData.casts.cast != null)
                    {
                        foreach (var actor in movieData.casts.cast.OrderBy(a => a.order)) movie.AddPerson(new PersonInfo { Name = actor.name.Trim(), Role = actor.character, Type = PersonType.Actor });
                    }

                    //and the rest from crew
                    if (movieData.casts != null && movieData.casts.crew != null)
                    {
                        foreach (var person in movieData.casts.crew) movie.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = person.department });
                    }
                }

                if (movieData.keywords != null && movieData.keywords.keywords != null && !movie.LockedFields.Contains(MetadataFields.Tags))
                {
                    movie.Tags = movieData.keywords.keywords.Select(i => i.name).ToList();
                }

                if (movieData.trailers != null && movieData.trailers.youtube != null &&
                    movieData.trailers.youtube.Count > 0)
                {
                    movie.RemoteTrailers = movieData.trailers.youtube.Select(i => new MediaUrl
                    {
                        Url = string.Format("http://www.youtube.com/watch?v={0}", i.source),
                        IsDirectLink = false,
                        Name = i.name,
                        VideoSize = string.Equals("hd", i.size, StringComparison.OrdinalIgnoreCase) ? VideoSize.HighDefinition : VideoSize.StandardDefinition

                    }).ToList();
                }
            }

        }
开发者ID:rrb008,项目名称:MediaBrowser,代码行数:101,代码来源:MovieDbProvider.cs

示例2: ProcessMainInfo


//.........这里部分代码省略.........
                                               : !string.IsNullOrEmpty(usRelease.certification)
                                                     ? usRelease.certification
                                                     : !string.IsNullOrEmpty(minimunRelease.certification)
                                                           ? minimunRelease.iso_3166_1 + "-" + minimunRelease.certification
                                                           : null;
                }
            }

            if (movieData.release_date.Year != 1)
            {
                //no specific country release info at all
                movie.PremiereDate = movieData.release_date.ToUniversalTime();
                movie.ProductionYear = movieData.release_date.Year;
            }

            // If that didn't find a rating and we are a boxset, use the one from our first child
            if (movie.OfficialRating == null && movie is BoxSet && !movie.LockedFields.Contains(MetadataFields.OfficialRating))
            {
                var boxset = movie as BoxSet;
                Logger.Info("MovieDbProvider - Using rating of first child of boxset...");

                var firstChild = boxset.Children.Concat(boxset.GetLinkedChildren()).FirstOrDefault();

                boxset.OfficialRating = firstChild != null ? firstChild.OfficialRating : null;
            }

            //studios
            if (movieData.production_companies != null && !movie.LockedFields.Contains(MetadataFields.Studios))
            {
                movie.Studios.Clear();

                foreach (var studio in movieData.production_companies.Select(c => c.name))
                {
                    movie.AddStudio(studio);
                }
            }

            // genres
            // Movies get this from imdb
            var genres = movieData.genres ?? new List<GenreItem>();
            if (!movie.LockedFields.Contains(MetadataFields.Genres))
            {
                // Only grab them if a boxset or there are no genres.
                // For movies and trailers we'll use imdb via omdb
                // But omdb data is for english users only so fetch if language is not english
                if (!(movie is Movie) || movie.Genres.Count == 0 || !string.Equals(movie.GetPreferredMetadataLanguage(), "en", StringComparison.OrdinalIgnoreCase))
                {
                    movie.Genres.Clear();

                    foreach (var genre in genres.Select(g => g.name))
                    {
                        movie.AddGenre(genre);
                    }
                }
            }

            if (!movie.LockedFields.Contains(MetadataFields.Cast))
            {
                movie.People.Clear();

                //Actors, Directors, Writers - all in People
                //actors come from cast
                if (movieData.casts != null && movieData.casts.cast != null)
                {
                    foreach (var actor in movieData.casts.cast.OrderBy(a => a.order)) movie.AddPerson(new PersonInfo { Name = actor.name.Trim(), Role = actor.character, Type = PersonType.Actor, SortOrder = actor.order });
                }
开发者ID:jscorrea,项目名称:MediaBrowser,代码行数:67,代码来源:MovieDbProvider.cs


注:本文中的BaseItem.AddStudio方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。