MediaPortal.Plugins.MovingPictures.DataProviders.DataProviderManager.Update C# (CSharp) Method

Update() public method

public Update ( DBMovieInfo movie ) : void
movie MediaPortal.Plugins.MovingPictures.Database.DBMovieInfo
return void
        public void Update(DBMovieInfo movie)
        {
            List<DBSourceInfo> sources;
            lock (detailSources) sources = new List<DBSourceInfo>(detailSources);

            // unlock the movie fields for the first iteration
            movie.ProtectExistingValuesFromCopy(false);

            // first update from the primary source of this data
            int providerCount = 0;
            if (movie.PrimarySource != null && movie.PrimarySource.Provider != null) {
                UpdateResults success = movie.PrimarySource.Provider.Update(movie);
                logger.Debug("UPDATE: Title='{0}', Provider='{1}', Version={2}, Result={3}", movie.Title, movie.PrimarySource.Provider.Name, movie.PrimarySource.Provider.Version, success.ToString());
                providerCount++;
            }

            foreach (DBSourceInfo currSource in sources) {
                if (movie.IsFullyPopulated()) {
                    logger.Debug("UPDATE: All fields are populated. Done updating '" + movie.Title + "'.");
                    break;
                }

                if (currSource.IsDisabled(DataType.DETAILS))
                    continue;

                if (currSource == movie.PrimarySource)
                    continue;

                providerCount++;

                if (providerCount <= MovingPicturesCore.Settings.DataProviderRequestLimit || MovingPicturesCore.Settings.DataProviderRequestLimit == 0) {
                    UpdateResults success = currSource.Provider.Update(movie);
                    logger.Debug("UPDATE: Title='{0}', Provider='{1}', Version={2}, Result={3}", movie.Title, currSource.Provider.Name, currSource.Provider.Version, success.ToString());
                }
                else {
                    // stop update
                    break;
                }

                if (MovingPicturesCore.Settings.UseTranslator) {
                    movie.Translate();
                }
            }
        }