Ejemplo n.º 1
0
        public BackdropItem GetRandomBackdrop()
        {
            BackdropItem _result = null;

            if (FileManager.Configuration.Options.IsMTNPathSpecified)
            {
                string _filePath = Helpers.GetUniqueFilename(".jpg");
                try
                {
                    if (VideoScreenShot.MakeBackdropSnapshot(MoviePath, _filePath))
                    {
                        if (File.Exists(_filePath))
                        {
                            _result = PrepareBackdropItem(_filePath, true);
                        }
                    }
                }
                finally
                {
                    FileManager.AddToGarbageFiles(_filePath);
                }
            }

            return(_result);
        }
Ejemplo n.º 2
0
        private bool ProcessWallpaper(string Link, MovieInfo movieInfo, string id)
        {
            bool _result = false;

            string _page = Helpers.GetPage(Link);

            if (!string.IsNullOrEmpty(_page))
            {
                Regex _reg = new Regex(WallpapersRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                if (_reg.IsMatch(_page))
                {
                    foreach (Match _m2 in _reg.Matches(_page))
                    {
                        string _thumbUrl    = string.Format("http://www.outnow.ch{0}", _m2.Groups["Backdrop"].Value);
                        string _originalUrl = null;

                        if (!string.IsNullOrEmpty(movieInfo.Name) && !string.IsNullOrEmpty(_thumbUrl))
                        {
                            BackdropItem _bi = new BackdropItem(id, movieInfo.IMDBID, this.CollectorName, _thumbUrl, _originalUrl);
                            _bi.GetOriginalUrl = new BackdropBase.GetOriginalUrlHandler(GetWallpaperLink);
                            BackdropsList.Add(_bi);
                        }
                    }
                }
            }

            return(_result);
        }
Ejemplo n.º 3
0
        private bool ProcessVisualSection(MovieInfo movieInfo, string id)
        {
            bool _result = false;

            // first posters
            string _page = Helpers.GetPage(string.Format("http://www.kinopoisk.ru/level/17/film/{0}", id), null, Encoding.GetEncoding("Windows-1251"), "", true, true);

            if (!string.IsNullOrEmpty(_page))
            {
                if (_page.Contains("<title>Архив постеров на КиноПоиск.ru</title>"))
                {
                    // movie has no posters
                    return(_result);
                }
                Regex _reg = new Regex(PostersRegex, RegexOptions.IgnoreCase | RegexOptions.Multiline);
                if (_reg.IsMatch(_page))
                {
                    for (int _i = 0; _i <= (_reg.Matches(_page).Count - 1); _i++)
                    {
                        string _imageUrl = string.Format("{0}", _reg.Matches(_page)[_i].Groups["Cover"].Value.Replace("sm_", ""));

                        ResultMovieItem _movieItem = new ResultMovieItem(id, movieInfo.Name, _imageUrl, this.CollectorName);
                        _movieItem.CollectorMovieUrl = string.Format("http://www.kinopoisk.ru/level/1/film/{0}/sr/1/", id);
                        _movieItem.MovieInfo         = movieInfo;

                        ResultsList.Add(_movieItem);
                        _result = true;
                    }
                }
            }

            //then backdrops
            _page = Helpers.GetPage(string.Format("http://www.kinopoisk.ru/level/13/film/{0}", id), null, Encoding.GetEncoding("Windows-1251"), "", true, true);

            if (!string.IsNullOrEmpty(_page))
            {
                Regex _reg = new Regex(BackdropsRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                if (_reg.IsMatch(_page))
                {
                    foreach (Match _m2 in _reg.Matches(_page))
                    {
                        string _thumbUrl    = string.Format("http://www.kinopoisk.ru/{0}", _m2.Groups["Backdrop"].Value);
                        string _originalUrl = _thumbUrl.Replace("sm_", "");

                        if (!string.IsNullOrEmpty(movieInfo.Name) && !string.IsNullOrEmpty(_thumbUrl) && !string.IsNullOrEmpty(_originalUrl))
                        {
                            string _width  = _m2.Groups["Width"].Value;
                            string _height = _m2.Groups["Height"].Value;

                            BackdropItem _bi = new BackdropItem(id, movieInfo.IMDBID, this.CollectorName, _thumbUrl, _originalUrl);
                            _bi.SetSize(_width, _height);
                            BackdropsList.Add(_bi);
                        }
                    }
                }
            }

            return(_result);
        }
Ejemplo n.º 4
0
 private void AddBackdropToLists(BackdropItem item, bool asFirst)
 {
     if (item != null)
     {
         (Backdrops as List <BackdropBase>).Insert(asFirst ? 0 : Math.Max(0, Backdrops.Count() - 1), item);
         (OwnBackdrops as List <BackdropBase>).Insert(asFirst ? 0 : Math.Max(0, OwnBackdrops.Count() - 1), item);
     }
 }
Ejemplo n.º 5
0
 private bool GetResults(IEnumerable <TmdbMovie> searchResults)
 {
     foreach (var item in searchResults)
     {
         if (item == null)
         {
             continue;
         }
         if (FileManager.CancellationPending)
         {
             return(ResultsList.Count != 0);
         }
         // get movie info
         MovieInfo movieInfo = GetMovieInfo(item);
         if (string.IsNullOrEmpty(movieInfo.IMDBID) && !IsValidYear(movieInfo.Year))
         {
             continue;
         }
         // having the tmdbid, call getimages
         var imagesData = api.GetMovieImages(item.id, "ALL");
         // posters
         if (imagesData.posters.Any())
         {
             foreach (var poster in imagesData.posters.OrderByDescending(x => x.vote_average))
             {
                 var imageUrl = string.Format("{0}{1}{2}", configuration.images.base_url, "original", poster.file_path);
                 AddResultItem(item.id.ToString(CultureInfo.InvariantCulture), movieInfo, imageUrl);
             }
         }
         else
         {
             // no poster found, add anyway the movie without image
             if (!string.IsNullOrEmpty(movieInfo.Name))
             {
                 AddResultItem(item.id.ToString(CultureInfo.InvariantCulture), movieInfo, null);
             }
         }
         // backdrops
         if (imagesData.backdrops.Any())
         {
             foreach (var backdrop in imagesData.backdrops.OrderByDescending(x => x.vote_average))
             {
                 var thumbUrl    = string.Format("{0}{1}{2}", configuration.images.base_url, configuration.images.backdrop_sizes.First(), backdrop.file_path);
                 var originalUrl = string.Format("{0}{1}{2}", configuration.images.base_url, "original", backdrop.file_path);
                 var bi          = new BackdropItem(item.id.ToString(CultureInfo.InvariantCulture), item.imdb_id, CollectorName, thumbUrl, originalUrl);
                 bi.SetSize(backdrop.width.ToString(CultureInfo.InvariantCulture), backdrop.height.ToString(CultureInfo.InvariantCulture));
                 BackdropsList.Add(bi);
             }
         }
     }
     return(ResultsList.Count != 0);
 }
Ejemplo n.º 6
0
        private BackdropItem PrepareBackdropItem(string filePath, bool isScreenshot)
        {
            // create the item
            BackdropItem _result = new BackdropItem(null, null, string.Empty, filePath, filePath);

            // mark it as screenshot
            _result.IsScreenshot = isScreenshot;
            // detect imagesize
            System.Drawing.Size _size = Helpers.GetImageSize(filePath);
            if (_size.Height != 0 && _size.Width != 0)
            {
                _result.Width  = _size.Width.ToString();
                _result.Height = _size.Height.ToString();
            }
            return(_result);
        }
Ejemplo n.º 7
0
        protected override bool ProcessVisualSection(string relLink, MovieInfo movieInfo, string id)
        {
            bool _result = false;

            List <string> _cache = new List <string>();

            // process backdrops here
            //string _backdropsLink = relLink.Insert(relLink.LastIndexOf('/'), "-Screenshots");
            string _backdropsLink = relLink + "#Screenshots";
            string _backdropPage  = Helpers.GetPage(_backdropsLink, Encoding.UTF8, true);

            if (!string.IsNullOrEmpty(_backdropPage))
            {
                Regex _reg = new Regex(VisualSectionRegex, RegexOptions.IgnoreCase);
                foreach (Match _m2 in _reg.Matches(_backdropPage))
                {
                    string _originalUrl = null;
                    string _thumbUrl    = _m2.Groups["Link"].Value;
                    if (!string.IsNullOrEmpty(_thumbUrl))
                    {
                        _originalUrl = _thumbUrl.Insert(_thumbUrl.LastIndexOf('.'), "_large");
                    }

                    // avoid duplicates returned by regex
                    if (!_cache.Contains(_thumbUrl))
                    {
                        if (!string.IsNullOrEmpty(movieInfo.Name) && !string.IsNullOrEmpty(_thumbUrl) && !string.IsNullOrEmpty(_originalUrl))
                        {
                            BackdropItem _bi = new BackdropItem(id, null, this.CollectorName, _thumbUrl, _originalUrl);
                            _bi.SetSize("1280", "720");
                            BackdropsList.Add(_bi);
                            _result = true;
                            _cache.Add(_thumbUrl);
                        }
                    }
                }
            }

            return(_result);
        }
Ejemplo n.º 8
0
 private void ImportFromMetadata(MoviesheetsUpdateManager metadatamanager)
 {
     // if there is a .tgmd file add images from inside to the own backdrops pool
     if (metadatamanager != null && File.Exists(metadatamanager.TargetFilename))
     {
         string _path = Helpers.GetUniqueFilename(".jpg");
         if (metadatamanager.GetImage(MoviesheetsUpdateManager.BACKGROUND_STREAM_NAME, _path))
         {
             FileManager.AddToGarbageFiles(_path);
             // add it to the pool too
             BackdropItem _item = PrepareBackdropItem(_path, false);
             AddBackdropToLists(_item, true);
         }
         _path = Helpers.GetUniqueFilename(".jpg");
         if (metadatamanager.GetImage(MoviesheetsUpdateManager.FANART1_STREAM_NAME, _path))
         {
             FileManager.AddToGarbageFiles(_path);
             // add it to the pool too
             BackdropItem _item = PrepareBackdropItem(_path, false);
             AddBackdropToLists(_item, true);
         }
         _path = Helpers.GetUniqueFilename(".jpg");
         if (metadatamanager.GetImage(MoviesheetsUpdateManager.FANART2_STREAM_NAME, _path))
         {
             FileManager.AddToGarbageFiles(_path);
             // add it to the pool too
             BackdropItem _item = PrepareBackdropItem(_path, false);
             AddBackdropToLists(_item, true);
         }
         _path = Helpers.GetUniqueFilename(".jpg");
         if (metadatamanager.GetImage(MoviesheetsUpdateManager.FANART3_STREAM_NAME, _path))
         {
             FileManager.AddToGarbageFiles(_path);
             // add it to the pool too
             BackdropItem _item = PrepareBackdropItem(_path, false);
             AddBackdropToLists(_item, true);
         }
     }
 }
Ejemplo n.º 9
0
        private bool GetMovieDetails(string movieId, bool onlyInfo, out MovieInfo movieInfo)
        {
            bool _result = false;

            movieInfo = null;

            if (!string.IsNullOrEmpty(movieId))
            {
                XmlDocument _docDetails = new XmlDocument();
                try
                {
                    _docDetails.Load(this.GetInfoUrl(movieId));
                }
                catch { }
                XmlNode _movie = _docDetails.SelectSingleNode("//movie");

                if (_movie != null)
                {
                    MovieInfo _movieInfo = GetMovieInfo(_movie);
                    movieInfo = _movieInfo;

                    if (!onlyInfo)
                    {
                        // get posters
                        if (_movie != null)
                        {
                            XmlNodeList _images = _movie.SelectNodes("//image[@type='Poster' and @size='original']");
                            if (_images.Count != 0)
                            {
                                foreach (XmlNode _image in _images)
                                {
                                    string          _imageUrl  = Helpers.GetAttributeFromXmlNode(_image, "url");
                                    ResultMovieItem _movieItem = new ResultMovieItem(movieId, _movieInfo.Name, _imageUrl, this.CollectorName);
                                    _movieItem.CollectorMovieUrl = Helpers.GetValueFromXmlNode(_movie, "url");
                                    _movieItem.MovieInfo         = _movieInfo;
                                    ResultsList.Add(_movieItem);
                                    _result = true;
                                }
                            }
                            else
                            {
                                ResultMovieItem _movieItem = new ResultMovieItem(movieId, _movieInfo.Name, null, this.CollectorName);
                                _movieItem.CollectorMovieUrl = Helpers.GetValueFromXmlNode(_movie, "url");
                                _movieItem.MovieInfo         = _movieInfo;
                                ResultsList.Add(_movieItem);
                                _result = true;
                            }
                            // get fanart/backdrops
                            XmlNodeList _fanarts = _movie.SelectNodes("//image[@type='Fanart' and @size='preview']");
                            if (_fanarts.Count != 0)
                            {
                                foreach (XmlNode _fanart in _fanarts)
                                {
                                    string _fanartId = Helpers.GetAttributeFromXmlNode(_fanart, "id");
                                    if (!string.IsNullOrEmpty(_fanartId))
                                    {
                                        string  _thumbUrl     = Helpers.GetAttributeFromXmlNode(_movie.SelectSingleNode(string.Format("//image[@id='{0}' and @size='preview']", _fanartId)), "url");
                                        XmlNode _originalNode = _movie.SelectSingleNode(string.Format("//image[@id='{0}' and @size='original']", _fanartId));
                                        string  _originalUrl  = Helpers.GetAttributeFromXmlNode(_originalNode, "url");
                                        string  _width        = _originalNode != null ? _originalNode.Attributes["width"].Value : null;
                                        string  _height       = _originalNode != null ? _originalNode.Attributes["height"].Value : null;


                                        if (!string.IsNullOrEmpty(_thumbUrl) && !string.IsNullOrEmpty(_originalUrl))
                                        {
                                            BackdropItem _bi = new BackdropItem(movieId, _movieInfo.IMDBID, this.CollectorName, _thumbUrl, _originalUrl);
                                            _bi.SetSize(_width, _height);
                                            this.BackdropsList.Add(_bi);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(_result);
        }
Ejemplo n.º 10
0
        private void GetEpisodes(TheTVDBSerieItem serieItem)
        {
            XmlDocument  _doc    = new XmlDocument();
            MemoryStream _stream = null;

            // check if cache has the current series XML
            if (CurrentSeriesHelper.GetEpisodesData.ContainsKey(serieItem.ID))
            {
                _doc.LoadXml(CurrentSeriesHelper.GetEpisodesData[serieItem.ID]);
            }
            else
            {
                string _episodesUrl = string.Format("{0}{1}/all/{2}.xml", BaseUrl, serieItem.ID, FileManager.Configuration.Options.MovieSheetsOptions.TVShowsLanguage);
                _stream = SendRequest(_episodesUrl);
                if (_stream == null || _stream.Length == 0)
                {
                    _episodesUrl = string.Format("{0}{1}/all/", BaseUrl, serieItem.ID);
                    _stream      = SendRequest(_episodesUrl);
                }
                if (_stream != null && _stream.Length > 0)
                {
                    try
                    {
                        _doc.Load(_stream);
                        _stream.Dispose();
                        _stream = null;

                        // update cache
                        if (!CurrentSeriesHelper.GetEpisodesData.ContainsKey(serieItem.ID))
                        {
                            CurrentSeriesHelper.GetEpisodesData.Add(serieItem.ID, _doc.OuterXml.ToString());
                        }
                        else
                        {
                            CurrentSeriesHelper.GetEpisodesData[serieItem.ID] = _doc.OuterXml.ToString();
                        }
                    }
                    catch { }
                }
            }

            // take just poster and season that is not seasonwide
            XmlNodeList _episodes = _doc.SelectNodes("//Episode");

            if (_episodes.Count != 0)
            {
                string _episodeField = null;
                string _seasonField  = null;
                switch (m_EpisodeData.Type)
                {
                default:
                case EpisodeType.AiredOrder:
                    _episodeField = "EpisodeNumber";
                    _seasonField  = "SeasonNumber";
                    break;

                case EpisodeType.DVDOrder:
                    _episodeField = "DVD_episodenumber";
                    _seasonField  = "DVD_season";
                    break;

                case EpisodeType.Absolute:
                    _episodeField = "absolute_number";
                    _seasonField  = string.Empty;
                    break;
                }

                foreach (XmlNode _item in _episodes)
                {
                    string _relPath  = Helpers.GetValueFromXmlNode(_item.SelectSingleNode("filename"));
                    string _imageUrl = string.Format("{0}/banners/{1}", m_MirrorPath, _relPath);

                    string _seasonNumber  = string.IsNullOrEmpty(_seasonField) ? string.Empty : Helpers.GetValueFromXmlNode(_item.SelectSingleNode(_seasonField));
                    string _episodeNumber = Helpers.GetValueFromXmlNode(_item.SelectSingleNode(_episodeField));
                    // remove trailing numbers like 2.0 -> 2
                    _seasonNumber  = TrimValue(_seasonNumber);
                    _episodeNumber = TrimValue(_episodeNumber);

                    // if same episode and (if defined) same season
                    if ((_episodeNumber == m_EpisodeData.Episode) &&
                        ((!string.IsNullOrEmpty(_seasonNumber) && (_seasonNumber == m_EpisodeData.Season)) || string.IsNullOrEmpty(_seasonNumber))
                        )
                    {
                        string _episodeName = Helpers.GetValueFromXmlNode(_item.SelectSingleNode("EpisodeName"));
                        _episodeName = string.IsNullOrEmpty(_episodeName) ? string.Empty : string.Format(" - {0}", _episodeName);
                        string _id        = serieItem.ID.ToString();
                        string _title     = serieItem.Title;
                        string _extraText = _seasonNumber != null?string.Format(" [Season {0}]", _seasonNumber) : string.Empty;

                        //_extraText = _episodeNumber != null && _episodeNumber != "0" ? string.Format("{0} [Episode {1}{2}] (screenshot)", _extraText, _episodeNumber, _episodeName) : _extraText;
                        _extraText = _episodeNumber != null && _episodeNumber != "0" ? string.Format("{0} [Episode {1}]", _extraText, _episodeNumber) : _extraText;

                        if (!string.IsNullOrEmpty(_title) /*&& !string.IsNullOrEmpty(_relPath)*/)
                        {
                            ResultMovieItem _movieItem = new ResultMovieItem(_id, _title, _imageUrl, CollectorName);
                            _movieItem.ExtraText         = _extraText;
                            _movieItem.MovieInfo         = serieItem.MovieInfo;
                            _movieItem.CollectorMovieUrl = _id != null?string.Format("http://thetvdb.com/index.php?tab=series&id={0}", _id) : null;

                            ResultsList.Add(_movieItem);

                            if (!string.IsNullOrEmpty(_relPath))
                            {
                                BackdropItem _bi = new BackdropItem(serieItem.ID.ToString(), (serieItem != null ? serieItem.IMDBId : string.Empty), this.CollectorName, _imageUrl, _imageUrl);
                                _bi.Episode      = m_EpisodeData.Episode;
                                _bi.Season       = m_EpisodeData.Season;
                                _bi.IsScreenshot = true;
                                this.BackdropsList.Insert(0, _bi);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        private void GetPosters(TheTVDBSerieItem serieItem)
        {
            XmlDocument  _doc    = new XmlDocument();
            MemoryStream _stream = null;

            SetCurrentEpisodeRelatedInfo(serieItem.ID, serieItem.MovieInfo);

            // check if cache has the current series XML
            if (CurrentSeriesHelper.GetPostersData.ContainsKey(serieItem.ID))
            {
                _doc.LoadXml(CurrentSeriesHelper.GetPostersData[serieItem.ID]);
            }
            else
            {
                string _postersUrl = string.Format("{0}{1}/banners.xml", BaseUrl, serieItem.ID);
                _stream = SendRequest(_postersUrl);
                if (_stream != null && _stream.Length > 0)
                {
                    //SetCurrentEpisodeRelatedInfo(serieItem.ID, serieItem.MovieInfo);

                    _stream.Position = 0;

                    try
                    {
                        _doc.Load(_stream);
                        _stream.Dispose();
                        _stream = null;

                        // update cache
                        if (!CurrentSeriesHelper.GetPostersData.ContainsKey(serieItem.ID))
                        {
                            CurrentSeriesHelper.GetPostersData.Add(serieItem.ID, _doc.OuterXml.ToString());
                        }
                        else
                        {
                            CurrentSeriesHelper.GetPostersData[serieItem.ID] = _doc.OuterXml.ToString();
                        }
                    }
                    catch { }
                }
            }
            // take just poster and season that is not seasonwide
            //XmlNodeList _images = _doc.SelectNodes("//Banner[BannerType='poster' or (BannerType='season' and BannerType2='season')]");
            //XmlNodeList _images = _doc.SelectNodes("//Banner[BannerType='poster' or (BannerType='season' ) or BannerType='fanart' or BannerType='series']");
            XmlNodeList _images = null;

            if (FileManager.Configuration.Options.RetrieveBannersAsBackdrops)
            {
                _images = _doc.SelectNodes("//Banner");
            }
            else
            {
                _images = _doc.SelectNodes("//Banner[BannerType='poster' or (BannerType='season' and BannerType2='season') or BannerType='fanart']");
            }
            if (_images.Count != 0)
            {
                foreach (XmlNode _item in _images)
                {
                    // process posters
                    string _type  = Helpers.GetValueFromXmlNode(_item, "BannerType");
                    string _type2 = Helpers.GetValueFromXmlNode(_item, "BannerType2");
                    if ((string.Compare(_type, "poster") == 0) || ((string.Compare(_type, "season") == 0) && (string.Compare(_type2, "seasonwide") != 0)))
                    {
                        string _relPath      = Helpers.GetValueFromXmlNode(_item.SelectSingleNode("BannerPath"));
                        string _imageUrl     = string.Format("{0}/banners/{1}", m_MirrorPath, _relPath);
                        string _seasonNumber = Helpers.GetValueFromXmlNode(_item.SelectSingleNode("Season"));
                        if (!IsSameSeason(_seasonNumber, m_EpisodeData.Season))
                        {
                            continue;
                        }

                        string _id        = serieItem.ID.ToString();
                        string _title     = serieItem.Title;
                        string _extraText = !string.IsNullOrEmpty(_seasonNumber) ? string.Format(" [Season {0}]", _seasonNumber) : string.Empty;
                        int    _seasonNr  = 0;
                        try
                        {
                            _seasonNr = !string.IsNullOrEmpty(_seasonNumber) ? Int32.Parse(_seasonNumber) : 0;
                        }
                        catch { }

                        if (!string.IsNullOrEmpty(_title) && !string.IsNullOrEmpty(_relPath))
                        {
                            ResultMovieItem _movieItem = new ResultMovieItem(_id, _title, _imageUrl, CollectorName);
                            _movieItem.ExtraText         = _extraText;
                            _movieItem.IsSeasonCover     = !string.IsNullOrEmpty(_movieItem.ExtraText);
                            _movieItem.Season            = _seasonNr;
                            _movieItem.MovieInfo         = serieItem.MovieInfo;
                            _movieItem.CollectorMovieUrl = _id != null?string.Format("http://thetvdb.com/index.php?tab=series&id={0}", _id) : null;

                            ResultsList.Insert(Math.Max(0, ResultsList.Count - 1), _movieItem);
                        }
                    }
                    else // must be a fanart
                    {
                        string _relPath      = Helpers.GetValueFromXmlNode(_item.SelectSingleNode("ThumbnailPath"));
                        string _thumbUrl     = string.Format("{0}/banners/{1}", m_MirrorPath, _relPath);
                        string _relPath2     = Helpers.GetValueFromXmlNode(_item.SelectSingleNode("BannerPath"));
                        string _originalUrl  = string.Format("{0}/banners/{1}", m_MirrorPath, _relPath2);
                        bool   _isWideBanner = Helpers.GetValueFromXmlNode(_item, "BannerType2") == "graphical" || Helpers.GetValueFromXmlNode(_item, "BannerType2") == "blank";
                        if (string.IsNullOrEmpty(_relPath))
                        {
                            _relPath  = _relPath2;
                            _thumbUrl = _originalUrl;
                        }

                        string _width  = null;
                        string _height = null;
                        string _s      = Helpers.GetValueFromXmlNode(_item, "BannerType2");
                        if (!string.IsNullOrEmpty(_s))
                        {
                            Match _m = Regex.Match(_s, "(?<Width>[0-9]+?)x(?<Height>([0-9]*)?)", RegexOptions.Singleline | RegexOptions.IgnoreCase);
                            _width  = _m.Success ? _m.Groups["Width"].Value : null;
                            _height = _m.Success ? _m.Groups["Height"].Value : null;
                        }

                        if (!string.IsNullOrEmpty(_relPath) && !string.IsNullOrEmpty(_relPath2))
                        {
                            BackdropItem _bi = new BackdropItem(serieItem.ID.ToString(), (serieItem != null ? serieItem.IMDBId : string.Empty), this.CollectorName, _thumbUrl, _originalUrl);
                            _bi.Season   = m_EpisodeData.Season;
                            _bi.Episode  = m_EpisodeData.Episode;
                            _bi.IsBanner = _isWideBanner;
                            _bi.SetSize(_width, _height);
                            this.BackdropsList.Add(_bi);
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
        private bool AutoloadBackdrop(MovieSheetsGenerator generator, bool loadFromMetadata, MoviesheetsUpdateManager metadatamanager, bool doSelect,
                                      string mask, MoviesheetImageType imgType)
        {
            bool _result = false;

            // check if must populate from masked existing file
            if (doSelect && !string.IsNullOrEmpty(mask))
            {
                string _jpgPath = null;
                if (ConfigHelpers.CheckIfFileExists(MoviePath, mask, out _jpgPath))
                {
                    generator.UpdateBackdrop(imgType, _jpgPath);
                    // add it to the pool too
                    BackdropItem _item = PrepareBackdropItem(_jpgPath, false);
                    AddBackdropToLists(_item, true);
                    _result = true;
                }
            }

            // check if must populate from metadata
            if (!_result && loadFromMetadata && metadatamanager != null)
            {
                string _itemType = null;
                string _path     = null;
                switch (imgType)
                {
                case MoviesheetImageType.Background:
                    _itemType = MoviesheetsUpdateManager.BACKGROUND_STREAM_NAME;
                    _path     = generator.BackdropTempPath;
                    break;

                case MoviesheetImageType.Fanart1:
                    _itemType = MoviesheetsUpdateManager.FANART1_STREAM_NAME;
                    _path     = generator.Fanart1TempPath;
                    break;

                case MoviesheetImageType.Fanart2:
                    _itemType = MoviesheetsUpdateManager.FANART2_STREAM_NAME;
                    _path     = generator.Fanart2TempPath;
                    break;

                case MoviesheetImageType.Fanart3:
                    _itemType = MoviesheetsUpdateManager.FANART3_STREAM_NAME;
                    _path     = generator.Fanart3TempPath;
                    break;
                }

                if (!string.IsNullOrEmpty(_itemType))
                {
                    _result = metadatamanager.GetImage(_itemType, _path);
                    if (_result && File.Exists(_path))
                    {
                        generator.UpdateBackdrop(imgType, _path);
                        // add it to the pool too
                        BackdropItem _item = PrepareBackdropItem(_path, false);
                        AddBackdropToLists(_item, true);
                    }
                }
            }

            return(_result);
        }
Ejemplo n.º 13
0
        private void AddRandomBackdrop()
        {
            BackdropItem _item = GetRandomBackdrop();

            AddBackdropToLists(_item, false);
        }