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


C# Title.CopyMetadata方法代码示例

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


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

示例1: MetadataSearchUsingPreferred

        /// <summary>
        /// Looksup the preferred metadata on the passed in title
        /// </summary>
        /// <param name="title"></param>
        /// <returns></returns>
        public bool MetadataSearchUsingPreferred(Title title)
        {
            Title SearchResult;
            int? SeasonNo = null;
            int? EpisodeNo = null;
            bool retval = false;

            if (((title.TitleType & TitleTypes.Episode) != 0) ||
            ((title.TitleType & TitleTypes.Season) != 0) ||
            ((title.TitleType & TitleTypes.TVShow) != 0))
            {
                // TV Search
                if (title.SeasonNumber != null) SeasonNo = title.SeasonNumber.Value;
                if (title.EpisodeNumber != null) EpisodeNo = title.EpisodeNumber.Value;
                string Showname = null;

                // Try to find show name be looking up the folder structure.
                Title parenttitle = title;
                while ((parenttitle.TitleType & TitleTypes.Root) == 0)
                {
                    // Get parent
                    parenttitle = parenttitle.ParentTitle;
                    if ((parenttitle.TitleType & TitleTypes.TVShow) != 0)
                    {
                        Showname = parenttitle.Name;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(Showname))
                {
                    // Cannot find a show name in the folder structure
                    //return StartMetadataImport(title, plugin, coverArtOnly, title.Name, "", SeasonNo, EpisodeNo);
                    retval =  MetadataSearchUsingPreferred(title.TitleType, title.Name, "", SeasonNo, EpisodeNo, out SearchResult);
                }
                else
                {
                    //return StartMetadataImport(title, plugin, coverArtOnly, Showname, title.Name, SeasonNo, EpisodeNo);
                    retval =  MetadataSearchUsingPreferred(title.TitleType, Showname, title.Name, SeasonNo, EpisodeNo, out SearchResult);
                }
            }
            else
            {
                // Movie Search
                //return StartMetadataImport(title, plugin, coverArtOnly, title.Name, "", SeasonNo, EpisodeNo);
                retval =  MetadataSearchUsingPreferred(title.TitleType, title.Name, "", SeasonNo, EpisodeNo, out SearchResult);
            }

            if (retval)
            {
                // Successful lookup, process

                if (((title.TitleType & TitleTypes.Season) != 0) ||
                    ((title.TitleType & TitleTypes.TVShow) != 0) ||
                    ((title.TitleType & TitleTypes.Episode) != 0))
                {
                    // Use the preferred overwrite settings for TV
                    title.CopyMetadata(SearchResult, OMLEngine.Settings.OMLSettings.MetadataLookupOverwriteExistingDataPrefTV,
                        OMLEngine.Settings.OMLSettings.MetadataLookupUpdateNamePrefTV,
                        OMLEngine.Settings.OMLSettings.MetadataLookupOverwriteExistingDataPrefTV);
                }
                else
                {
                    // Use the preferred overwrite settings for Movies
                    title.CopyMetadata(SearchResult, OMLEngine.Settings.OMLSettings.MetadataLookupOverwriteExistingDataPrefMovies,
                        OMLEngine.Settings.OMLSettings.MetadataLookupUpdateNamePrefMovies,
                        OMLEngine.Settings.OMLSettings.MetadataLookupOverwriteExistingDataPrefMovies);
                }

                //LoadFanart(mds.FanArt, title); -- Do this in the calling program (may need to provide user feedback of progress
            }

            return retval;
        }
开发者ID:peeboo,项目名称:open-media-library,代码行数:79,代码来源:TitleMetadataManagement.cs


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