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


C# DBMovieInfo.AddCoverFromFile方法代码示例

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


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

示例1: getOldCovers

        // check for coverart in the coverfolder loaded from previous installs
        private bool getOldCovers(DBMovieInfo movie)
        {
            bool found = false;

            string coverartFolderPath = MovingPicturesCore.Settings.CoverArtFolder;
            DirectoryInfo coverFolder = new DirectoryInfo(coverartFolderPath);

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

            foreach (FileInfo currFile in coverFolder.GetFiles()) {
                if (oldCoverRegex.IsMatch(currFile.Name)) {
                    bool success = movie.AddCoverFromFile(currFile.FullName);
                    found = found || success;
                }
            }

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

示例2: getCoversFromMovieFolder

        // if flagged, check for covers in the movie folder based on the user defined pattern
        private bool getCoversFromMovieFolder(DBMovieInfo movie)
        {
            bool found = false;

            bool useMovieFolderCovers = MovingPicturesCore.Settings.SearchMovieFolderForCoverArt;
            string pattern = MovingPicturesCore.Settings.MovieFolderCoverArtworkFilenamePattern;

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

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

示例3: GetArtwork

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

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

            // grab coverart loading settings
            int maxCovers = MovingPicturesCore.Settings.MaxCoversPerMovie;
            int maxCoversInSession = MovingPicturesCore.Settings.MaxCoversPerSession;

            // if we have already hit our limit for the number of covers to load, quit
            if (movie.AlternateCovers.Count >= maxCovers)
                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_cover_art", paramList);
            if (results == null) {
                logger.Error(Name + " scraper script failed to execute \"get_cover_art\" node.");
                return false;
            }

            int coversAdded = 0;
            int count = 0;
            while (results.ContainsKey("cover_art[" + count + "].url") || results.ContainsKey("cover_art[" + count + "].file")) {
                // if we have hit our limit quit
                if (movie.AlternateCovers.Count >= maxCovers || coversAdded >= maxCoversInSession)
                    return true;

                // get url for cover and load it via the movie object
                if (results.ContainsKey("cover_art[" + count + "].url")) {
                    string coverPath = results["cover_art[" + count + "].url"];
                    if (coverPath.Trim() != string.Empty)
                        if (movie.AddCoverFromURL(coverPath) == ImageLoadResults.SUCCESS)
                            coversAdded++;
                }

                // get file for cover and load it via the movie object
                if (results.ContainsKey("cover_art[" + count + "].file")) {
                    string coverPath = results["cover_art[" + count + "].file"];
                    if (coverPath.Trim() != string.Empty)
                        if (movie.AddCoverFromFile(coverPath))
                            coversAdded++;
                }

                count++;
            }

            if (coversAdded > 0)
                return true;

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

示例4: getCoversFromCoverFolder

        private bool getCoversFromCoverFolder(DBMovieInfo movie)
        {
            // grab a list of possible filenames for the coverart based on the user pattern
            string pattern = MovingPicturesCore.Settings.CoverArtworkFilenamePattern;
            List<string> coverFolderFilenames = getPossibleNamesFromPattern(pattern, movie);

            // check the coverart folder for the user patterned covers
            string coverartFolderPath = MovingPicturesCore.Settings.CoverArtFolder;
            FileInfo newCover = getFirstFileFromFolder(coverartFolderPath, coverFolderFilenames);
            if (newCover != null && newCover.Exists) {
                return movie.AddCoverFromFile(newCover.FullName);
            }

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

示例5: GetArtwork

        public bool GetArtwork(DBMovieInfo movie)
        {
            string myVideoCoversFolder = Config.GetFolder(Config.Dir.Thumbs) + "\\Videos\\Title";

            Regex cleaner = new Regex("[\\\\/:*?\"<>|]");
            string cleanTitle = cleaner.Replace(movie.Title, "_");
            string id = movie.GetSourceMovieInfo(SourceInfo).Identifier;
            string filename = myVideoCoversFolder + "\\" + cleanTitle + "{" + id + "}L.jpg";

            if (System.IO.File.Exists(filename))
                return movie.AddCoverFromFile(filename);

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


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