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


C# BaseItem.AddTagline方法代码示例

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


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

示例1: ProcessMainInfo

        /// <summary>
        /// Processes the main info.
        /// </summary>
        /// <param name="movie">The movie.</param>
        /// <param name="movieData">The movie data.</param>
        protected virtual void ProcessMainInfo(BaseItem movie, CompleteMovieData movieData)
        {
            if (movie != null && movieData != null)
            {
                if (!movie.LockedFields.Contains(MetadataFields.Name))
                {
                    movie.Name = movieData.title ?? movieData.original_title ?? movie.Name;
                }
                if (!movie.LockedFields.Contains(MetadataFields.Overview))
                {
                    movie.Overview = WebUtility.HtmlDecode(movieData.overview);
                }
                movie.Overview = movie.Overview != null ? movie.Overview.Replace("\n\n", "\n") : null;
                movie.HomePageUrl = movieData.homepage;
                movie.Budget = movieData.budget;
                movie.Revenue = movieData.revenue;

                if (!string.IsNullOrEmpty(movieData.tagline))
                {
                    movie.Taglines.Clear();
                    movie.AddTagline(movieData.tagline);
                }

                movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id);

                if (movieData.belongs_to_collection != null)
                {
                    movie.SetProviderId(MetadataProviders.TmdbCollection, movieData.belongs_to_collection.id.ToString(CultureInfo.InvariantCulture));
                }

                float rating;
                string voteAvg = movieData.vote_average.ToString(CultureInfo.InvariantCulture);

                //tmdb appears to have unified their numbers to always report "7.3" regardless of country
                // so I removed the culture-specific processing here because it was not working for other countries -ebr
                if (float.TryParse(voteAvg, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out rating))
                    movie.CommunityRating = rating;

                movie.VoteCount = movieData.vote_count;

                //release date and certification are retrieved based on configured country and we fall back on US if not there and to minimun release date if still no match
                if (movieData.releases != null && movieData.releases.countries != null)
                {
                    var ourRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals(ConfigurationManager.Configuration.MetadataCountryCode, StringComparison.OrdinalIgnoreCase)) ?? new Country();
                    var usRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals("US", StringComparison.OrdinalIgnoreCase)) ?? new Country();
                    var minimunRelease = movieData.releases.countries.OrderBy(c => c.release_date).FirstOrDefault() ?? new Country();
                    var ratingPrefix = ConfigurationManager.Configuration.MetadataCountryCode.Equals("us", StringComparison.OrdinalIgnoreCase) ? "" : ConfigurationManager.Configuration.MetadataCountryCode + "-";
                    movie.OfficialRating = !string.IsNullOrEmpty(ourRelease.certification)
                                               ? ratingPrefix + ourRelease.certification
                                               : !string.IsNullOrEmpty(usRelease.certification)
                                                     ? usRelease.certification
                                                     : !string.IsNullOrEmpty(minimunRelease.certification)
                                                           ? minimunRelease.iso_3166_1 + "-" + minimunRelease.certification
                                                           : null;

                    if (ourRelease.release_date != default(DateTime))
                    {
                        if (ourRelease.release_date.Year != 1)
                        {
                            movie.PremiereDate = ourRelease.release_date.ToUniversalTime();
                            movie.ProductionYear = ourRelease.release_date.Year;
                        }
                    }
                    else if (usRelease.release_date != default(DateTime))
                    {
                        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;
//.........这里部分代码省略.........
开发者ID:rrb008,项目名称:MediaBrowser,代码行数:101,代码来源:MovieDbProvider.cs


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