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


C# Series.SetProviderId方法代码示例

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


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

示例1: FetchDataFromSeriesNode


//.........这里部分代码省略.........
                                        // float.TryParse is local aware, so it can be probamatic, force us culture
                                        if (float.TryParse(val, NumberStyles.AllowDecimalPoint, UsCulture, out rval))
                                        {
                                            item.CommunityRating = rval;
                                        }
                                    }
                                }
                                break;
                            }
                        case "RatingCount":
                            {
                                var val = reader.ReadElementContentAsString();

                                if (!string.IsNullOrWhiteSpace(val))
                                {
                                    int rval;

                                    // int.TryParse is local aware, so it can be probamatic, force us culture
                                    if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval))
                                    {
                                        item.VoteCount = rval;
                                    }
                                }

                                break;
                            }

                        case "IMDB_ID":
                            {
                                var val = reader.ReadElementContentAsString();

                                if (!string.IsNullOrWhiteSpace(val))
                                {
                                    item.SetProviderId(MetadataProviders.Imdb, val);
                                }

                                break;
                            }

                        case "zap2it_id":
                            {
                                var val = reader.ReadElementContentAsString();

                                if (!string.IsNullOrWhiteSpace(val))
                                {
                                    item.SetProviderId(MetadataProviders.Zap2It, val);
                                }

                                break;
                            }

                        case "Status":
                            {
                                var val = reader.ReadElementContentAsString();

                                if (!string.IsNullOrWhiteSpace(val))
                                {
                                    SeriesStatus seriesStatus;

                                    if (Enum.TryParse(val, true, out seriesStatus))
                                        item.Status = seriesStatus;
                                }

                                break;
                            }
开发者ID:jscorrea,项目名称:MediaBrowser,代码行数:66,代码来源:TvdbSeriesProvider.cs

示例2: FetchSeriesData

        /// <summary>
        /// Fetches the series data.
        /// </summary>
        /// <param name="series">The series.</param>
        /// <param name="seriesId">The series id.</param>
        /// <param name="seriesDataPath">The series data path.</param>
        /// <param name="isForcedRefresh">if set to <c>true</c> [is forced refresh].</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task{System.Boolean}.</returns>
        private async Task FetchSeriesData(Series series, string seriesId, string seriesDataPath, bool isForcedRefresh, CancellationToken cancellationToken)
        {
            Directory.CreateDirectory(seriesDataPath);

            var files = Directory.EnumerateFiles(seriesDataPath, "*.xml", SearchOption.TopDirectoryOnly)
                .Select(Path.GetFileName)
                .ToList();

            var seriesXmlFilename = series.GetPreferredMetadataLanguage().ToLower() + ".xml";

            // Only download if not already there
            // The prescan task will take care of updates so we don't need to re-download here
            if (!files.Contains("banners.xml", StringComparer.OrdinalIgnoreCase) || !files.Contains("actors.xml", StringComparer.OrdinalIgnoreCase) || !files.Contains(seriesXmlFilename, StringComparer.OrdinalIgnoreCase))
            {
                await DownloadSeriesZip(seriesId, seriesDataPath, null, series.GetPreferredMetadataLanguage(), cancellationToken).ConfigureAwait(false);
            }

            // Have to check this here since we prevent the normal enforcement through ProviderManager
            if (!series.DontFetchMeta)
            {
                // Examine if there's no local metadata, or save local is on (to get updates)
                if (isForcedRefresh || ConfigurationManager.Configuration.EnableTvDbUpdates || !HasLocalMeta(series))
                {
                    series.SetProviderId(MetadataProviders.Tvdb, seriesId);

                    var seriesXmlPath = Path.Combine(seriesDataPath, seriesXmlFilename);
                    var actorsXmlPath = Path.Combine(seriesDataPath, "actors.xml");

                    FetchSeriesInfo(series, seriesXmlPath, cancellationToken);

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

                        FetchActors(series, actorsXmlPath, cancellationToken);
                    }
                }
            }
        }
开发者ID:jscorrea,项目名称:MediaBrowser,代码行数:48,代码来源:TvdbSeriesProvider.cs


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