Ejemplo n.º 1
0
        private void DoDeleteItem(GUIListItem item)
        {
            IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;

            if (movie == null)
            {
                return;
            }
            if (movie.ID < 0)
            {
                return;
            }
            if (item.IsFolder)
            {
                return;
            }
            if (!item.IsRemote)
            {
                // Delete covers
                FanArt.DeleteCovers(movie.Title, movie.ID);
                // Delete fanarts
                FanArt.DeleteFanarts(movie.File, movie.Title);
                VideoDatabase.DeleteMovieInfoById(movie.ID);
            }
        }
Ejemplo n.º 2
0
        // Changed - covers and the same movie name
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            base.OnClicked(controlId, control, actionType);
            if (control == btnRefresh)
            {
                // Check Internet connection
                if (!Win32API.IsConnectedToInternet())
                {
                    GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    dlgOk.SetHeading(257);
                    dlgOk.SetLine(1, GUILocalizeStrings.Get(703));
                    dlgOk.DoModal(GUIWindowManager.ActiveWindow);
                    return;
                }
                string title = currentMovie.Title;
                int    id    = currentMovie.ID;
                string file  = currentMovie.Path + "\\" + currentMovie.File;
                // Delete covers
                FanArt.DeleteCovers(title, id);
                //Delete fanarts
                FanArt.DeleteFanarts(file, title);

                if (IMDBFetcher.RefreshIMDB(this, ref currentMovie, false, false, true))
                {
                    if ((imageSearchThread != null) && (imageSearchThread.IsAlive))
                    {
                        imageSearchThread.Abort();
                        imageSearchThread = null;
                    }

                    imdbCoverArtUrl = currentMovie.ThumbURL;
                    coverArtUrls    = new string[1];
                    coverArtUrls[0] = imdbCoverArtUrl;

                    ResetSpinControl();

                    Refresh(false);
                    Update();
                    // Start images search thread
                    SearchImages();
                }
                return;
            }

            if (control == spinImages)
            {
                int item = spinImages.Value - 1;
                if (item < 0 || item >= coverArtUrls.Length)
                {
                    item = 0;
                }
                if (currentMovie.ThumbURL == coverArtUrls[item])
                {
                    return;
                }

                currentMovie.ThumbURL = coverArtUrls[item];
                // Title suffix for problem with covers and movie with the same name
                string titleExt           = currentMovie.Title + "{" + currentMovie.ID + "}";
                string coverArtImage      = Util.Utils.GetCoverArtName(Thumbs.MovieTitle, titleExt);
                string largeCoverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt);
                Util.Utils.FileDelete(coverArtImage);
                //
                // 07.11.2010 Deda: Cache entry Flag change for cover thumb file
                //
                Util.Utils.DoInsertNonExistingFileIntoCache(coverArtImage);
                //
                Util.Utils.FileDelete(largeCoverArtImage);
                Refresh(false);
                Update();
                int idMovie = currentMovie.ID;
                if (idMovie >= 0)
                {
                    VideoDatabase.SetThumbURL(idMovie, currentMovie.ThumbURL);
                }
                return;
            }

            if (control == btnCast)
            {
                viewmode = ViewMode.Cast;
                Update();
            }

            if (control == btnPlot)
            {
                viewmode = ViewMode.Plot;
                Update();
            }

            if (control == btnReview)
            {
                viewmode = ViewMode.Review;
                Update();
            }

            if (control == btnWatched)
            {
                if (currentMovie.Watched > 0)
                {
                    GUIPropertyManager.SetProperty("#iswatched", "no");
                    currentMovie.Watched = 0;
                    VideoDatabase.SetMovieWatchedStatus(currentMovie.ID, false);
                    ArrayList files = new ArrayList();
                    VideoDatabase.GetFiles(currentMovie.ID, ref files);

                    foreach (string file in files)
                    {
                        int fileId = VideoDatabase.GetFileId(file);
                        VideoDatabase.DeleteMovieStopTime(fileId);
                    }
                }
                else
                {
                    GUIPropertyManager.SetProperty("#iswatched", "yes");
                    currentMovie.Watched = 1;
                    VideoDatabase.SetMovieWatchedStatus(currentMovie.ID, true);
                }
                VideoDatabase.SetWatched(currentMovie);
            }

            if (control == spinDisc)
            {
                string selectedItem = spinDisc.GetLabel();
                int    idMovie      = currentMovie.ID;
                if (idMovie > 0)
                {
                    if (selectedItem != "HD" && selectedItem != "share")
                    {
                        VideoDatabase.SetDVDLabel(idMovie, selectedItem);
                    }
                    else
                    {
                        VideoDatabase.SetDVDLabel(idMovie, "HD");
                    }
                }
            }

            if (control == btnPlay)
            {
                int id = currentMovie.ID;

                ArrayList files = new ArrayList();
                VideoDatabase.GetFiles(id, ref files);

                if (files.Count > 1)
                {
                    GUIVideoFiles._stackedMovieFiles = files;
                    GUIVideoFiles._isStacked         = true;
                    GUIVideoFiles.MovieDuration(files);
                }

                GUIVideoFiles.PlayMovie(id, false);
                return;
            }
        }