Exemplo n.º 1
0
        private void SetThumb(ref GUIListItem item, string thumb)
        {
            // Save image (large and small)
            string filenameL = string.Empty;

            if (VideoDatabase.CheckMovieImdbId(ListItemMovieInfo(item).MovieImdbID))
            {
                string ttFolder  = Regex.Replace(ListItemMovieInfo(item).MovieImdbID, "(tt(0*))", string.Empty);
                int    ittFolder = 0;
                int.TryParse(ttFolder, out ittFolder);
                ittFolder = ittFolder / 25000;
                ttFolder  = ittFolder.ToString();

                string path = Config.GetFolder(Config.Dir.Thumbs) + @"\Videos\Actors\ActorsMovies\" + ittFolder + @"\";

                if (ListItemMovieInfo(item).MovieImdbID != string.Empty)
                {
                    filenameL = ListItemMovieInfo(item).MovieImdbID;
                }

                if (filenameL != string.Empty)
                {
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }

                    filenameL = path + filenameL + @".jpg";

                    string temporaryFilename = Path.GetTempFileName();
                    string tmpFile           = temporaryFilename;
                    temporaryFilename += ".jpg";
                    string temporaryFilenameLarge = Util.Utils.ConvertToLargeCoverArt(temporaryFilename);
                    temporaryFilenameLarge += ".jpg";
                    Util.Utils.FileDelete(tmpFile);
                    Util.Utils.FileDelete(temporaryFilenameLarge);

                    if (!string.IsNullOrEmpty(thumb))
                    {
                        Util.Utils.DownLoadAndOverwriteCachedImage(thumb, temporaryFilename);
                        // Convert downloaded image to large and small file and save on disk
                        SaveCover(temporaryFilename, filenameL); // Temp file is deleted in SetCover method
                    }
                    else
                    {
                        Util.Utils.FileDelete(filenameL);
                        filenameL = string.Empty;
                    }

                    // Update database
                    ExecuteSql("strPictureURL", thumb, item);
                    item.RefreshCoverArt();
                    item.IconImage      = filenameL;
                    item.ThumbnailImage = filenameL;
                }
            }
        }
Exemplo n.º 2
0
        private void SetNewproperties()
        {
            _currentActor.SortActorMoviesByYear();

            for (int i = 0; i < _currentActor.Count; ++i)
            {
                string line = String.Format("{0}. {1} ({2})",
                                            _currentActor[i].Year,
                                            _currentActor[i].MovieTitle,
                                            _currentActor[i].Role);
                //List view
                var item = new GUIListItem();
                item.ItemId = i;
                item.Label  = line.Replace("()", string.Empty).Trim(); // Year+Title+Role (visible on screen item)

                if (_currentActor[i].MoviePlot == "-" || _currentActor[i].MoviePlot == Strings.Unknown)
                {
                    _currentActor[i].MoviePlot = string.Empty; // Plot
                }
                item.AlbumInfoTag = Actor[i];

                string filenameL = string.Empty;
                string path      = string.Empty;
                // Find image
                if (VideoDatabase.CheckMovieImdbId(_currentActor[i].MovieImdbID))
                {
                    string ttFolder   = Regex.Replace(_currentActor[i].MovieImdbID, "(tt(0*))", string.Empty);
                    int    i_ttFolder = 0;
                    int.TryParse(ttFolder, out i_ttFolder);
                    i_ttFolder = i_ttFolder / 25000; // 25000 thumbs in one folder
                    ttFolder   = i_ttFolder.ToString();
                    path       = string.Format(@"{0}\Videos\Actors\ActorsMovies\{1}\", Config.GetFolder(Config.Dir.Thumbs), ttFolder);
                    filenameL  = _currentActor[i].MovieImdbID + ".jpg";

                    if (File.Exists(path + filenameL))
                    {
                        filenameL      = path + filenameL; // Movie cover file
                        item.IconImage = filenameL;
                    }
                    else
                    {
                        filenameL      = string.Empty; // Movie cover file
                        item.IconImage = string.Empty;
                    }
                }

                // Show in list if user have that movie in collection (played property = true)
                ArrayList movies = new ArrayList();
                string    sql    = string.Format("SELECT * FROM movieinfo WHERE IMDBID = '{0}'", _currentActor[i].MovieImdbID);
                VideoDatabase.GetMoviesByFilter(sql, out movies, false, true, false, false, false);

                if (movies.Count > 0) // We have a movie, color normal or color played for watched
                {
                    IMDBMovie movie = new IMDBMovie();
                    movie         = (IMDBMovie)movies[0];
                    item.DVDLabel = movie.ID.ToString(); // DVD label holds videodatabase movieID
                    item.IsPlayed = true;
                }

                item.ThumbnailImage  = filenameL;
                item.OnItemSelected += OnItemSelected;
                listActorMovies.Add(item);
            }


            if (listActorMovies.ListItems.Count == 0)
            {
                GUIListItem item = new GUIListItem();
                item.Label = GUILocalizeStrings.Get(284);
                IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;
                movie             = new IMDBMovie();
                item.AlbumInfoTag = movie;
                listActorMovies.Add(item);
            }

            _currentSelectedItem = 0;
            string largeCoverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieActors, _currentActor.ID.ToString());

            if (imgCoverArt != null)
            {
                imgCoverArt.Dispose();
                imgCoverArt.SetFileName(largeCoverArtImage);
                imgCoverArt.AllocResources();
            }

            // Update skin controls visibility
            Update();

            // Restore screen from last session if needed
            LoadState();
        }