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


C# DBMovieInfo.AddBackdropFromFile方法代码示例

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


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

示例1: getBackdropsFromMovieFolder

        // if flagged, check for backdrops in the movie folder based on the user defined pattern
        private bool getBackdropsFromMovieFolder(DBMovieInfo movie)
        {
            // should never really happen, but if the database is corrupt,
            // we dont want to crash, so just quit.
            if (movie.LocalMedia.Count == 0)
                return false;

            bool found = false;

            bool useMovieFolderBackdrops = MovingPicturesCore.Settings.SearchMovieFolderForBackdrops;
            string pattern = MovingPicturesCore.Settings.MovieFolderBackdropFilenamePattern;

            if (useMovieFolderBackdrops) {
                List<string> movieFolderFilenames = getPossibleNamesFromPattern(pattern, movie);
                foreach (string currFile in movieFolderFilenames) {
                    FileInfo newBackdrop = new FileInfo(Utility.GetMovieBaseDirectory(movie.LocalMedia[0].File.Directory).FullName + "\\" + currFile);
                    if (newBackdrop.Exists)
                        found |= movie.AddBackdropFromFile(newBackdrop.FullName);
                }
            }

            return found;
        }
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:24,代码来源:LocalProvider.cs

示例2: getOldBackdrops

        // check for backdrops in the backdrop folder loaded from previous installs
        private bool getOldBackdrops(DBMovieInfo movie)
        {
            bool found = false;

            string backdropFolderPath = MovingPicturesCore.Settings.BackdropFolder;
            DirectoryInfo backdropFolder = new DirectoryInfo(backdropFolderPath);

            string safeName = movie.Title.Replace(' ', '.').ToValidFilename();
            Regex oldBackdropRegex = new Regex("^{?" + Regex.Escape(safeName) + "}? \\[-?\\d+\\]\\.(jpg|png)");

            foreach (FileInfo currFile in backdropFolder.GetFiles()) {
                if (oldBackdropRegex.IsMatch(currFile.Name)) {
                    found |= movie.AddBackdropFromFile(currFile.FullName);
                }
            }

            return found;
        }
开发者ID:MichelZ,项目名称:moving-pictures-michelz,代码行数:19,代码来源:LocalProvider.cs

示例3: GetBackdrop

        public bool GetBackdrop(DBMovieInfo movie)
        {
            if (scraper == null)
                return false;

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

            // if we already have a backdrop move on for now
            if (movie.BackdropFullPath.Trim().Length > 0)
                return true;

            // try to load the id for the movie for this script
            DBSourceMovieInfo idObj = movie.GetSourceMovieInfo(ScriptID);
            if (idObj != null && idObj.Identifier != null)
                paramList["movie.site_id"] = idObj.Identifier;

            // load params for scraper
            foreach (DBField currField in DBField.GetFieldList(typeof(DBMovieInfo)))
                if (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);

            // run the scraper
            results = scraper.Execute("get_backdrop", paramList);
            if (results == null) {
                logger.Error(Name + " scraper script failed to execute \"get_backdrop\" node.");
                return false;
            }

            // Loop through all the results until a valid backdrop is found
            int count = 0;
            while (results.ContainsKey("backdrop[" + count + "].url") || results.ContainsKey("backdrop[" + count + "].file")) {

                // attempt to load via a URL
                if (results.ContainsKey("backdrop[" + count + "].url")) {
                    string backdropURL = results["backdrop[" + count + "].url"];
                    if (backdropURL.Trim().Length > 0)
                        if (movie.AddBackdropFromURL(backdropURL) == ImageLoadResults.SUCCESS)
                            return true;
                }

                // attempt to load via a file
                if (results.ContainsKey("backdrop[" + count + "].file")) {
                    string backdropFile = results["backdrop[" + count + "].file"];
                    if (backdropFile.Trim().Length > 0)
                        if (movie.AddBackdropFromFile(backdropFile))
                            return true;
                }

                count++;
            }

            // no valid backdrop found
            return false;
        }
开发者ID:damienhaynes,项目名称:moving-pictures,代码行数:59,代码来源:ScriptableProvider.cs


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