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


C# DBMovieInfo.CopyUpdatableValues方法代码示例

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


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

示例1: Update

        public UpdateResults Update(DBMovieInfo movie)
        {
            if (movie == null)
                return UpdateResults.FAILED;

            string tmdbId = getTheMovieDbId(movie, false);
            // check if TMDb id is still null, if so request id.
            if (string.IsNullOrEmpty(tmdbId))
                return UpdateResults.FAILED_NEED_ID;

            // Grab the movie using the TMDb ID
            DBMovieInfo newMovie = getMovieInformation(tmdbId);
            if (newMovie != null) {
                movie.GetSourceMovieInfo(SourceInfo).Identifier = tmdbId;
                movie.CopyUpdatableValues(newMovie);
                return UpdateResults.SUCCESS;
            }
            else {
                return UpdateResults.FAILED;
            }
        }
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:21,代码来源:TheMovieDbProvider.cs

示例2: Update

        public UpdateResults Update(DBMovieInfo movie)
        {
            if (scraper == null)
                return UpdateResults.FAILED;

            Dictionary<string, string> paramList = new Dictionary<string, string>();
            Dictionary<string, string> results;
            bool hasSiteId = false;

            // try to load the id for the movie for this script
            // if we have no site id still continue as we might still
            // be able to grab details using another identifier such as imdb_id
            DBSourceMovieInfo idObj = movie.GetSourceMovieInfo(ScriptID);
            if (idObj != null && idObj.Identifier != null) {
                paramList["movie.site_id"] = idObj.Identifier;
                hasSiteId = true;
            }

            // load params
            foreach (DBField currField in DBField.GetFieldList(typeof(DBMovieInfo))) {
                if (currField.AutoUpdate && currField.GetValue(movie) != null)
                    paramList["movie." + currField.FieldName] = currField.GetValue(movie).ToString().Trim();
            }

            //set higher level settings for script to use
            paramList["settings.defaultuseragent"] = MovingPicturesCore.Settings.UserAgent;
            paramList["settings.mepo_data"] = Config.GetFolder(Config.Dir.Config);

            // try to retrieve results
            results = scraper.Execute("get_details", paramList);
            if (results == null) {
                logger.Error(Name + " scraper script failed to execute \"get_details\" node.");
                return UpdateResults.FAILED;
            }

            if (!hasSiteId) {
                // if we started out without a site id
                // try to get it from the details response
                string siteId;
                if (results.TryGetValue("movie.site_id", out siteId))
                    movie.GetSourceMovieInfo(ScriptID).Identifier = siteId;
                else
                    // still no site id, so we are returning
                    return UpdateResults.FAILED_NEED_ID;
            }

            // get our new movie details
            DBMovieInfo newMovie = new DBMovieInfo();
            foreach (DBField currField in DBField.GetFieldList(typeof(DBMovieInfo))) {
                string value;
                bool success = results.TryGetValue("movie." + currField.FieldName, out value);

                if (success && value.Trim().Length > 0)
                    currField.SetValue(newMovie, value.Trim());
            }

            // and update as necessary
            movie.CopyUpdatableValues(newMovie);

            return UpdateResults.SUCCESS;
        }
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:61,代码来源:ScriptableProvider.cs

示例3: Update

        public UpdateResults Update(DBMovieInfo movie)
        {
            if (movie == null)
                return UpdateResults.FAILED;

            string mmId = getMovieMeterID(movie);
            if (mmId == null) {
                // Need id
                return UpdateResults.FAILED_NEED_ID;
            }
            else {
                // Update the movie
                DBMovieInfo newMovie = getMovieDetails(mmId);
                if (newMovie != null) {
                    movie.CopyUpdatableValues(newMovie);
                    return UpdateResults.SUCCESS;
                }
            }

            return UpdateResults.FAILED;
        }
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:21,代码来源:MovieMeterProvider.cs

示例4: Update

        public UpdateResults Update(DBMovieInfo movie)
        {
            if (movie == null)
                return UpdateResults.FAILED;

            if (movie != null)
            {
                movie.CopyUpdatableValues(movie);
                return UpdateResults.SUCCESS;
            }
            return UpdateResults.FAILED;
        }
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:12,代码来源:MyVideosProvider.cs


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