コード例 #1
0
        protected override void OnPageLoad()
        {
            base.OnPageLoad();

            currentLayout = Layout.Playlist;
            facadeLayout.CurrentLayout = currentLayout;

            LoadDirectory(string.Empty);
            if (g_Player.Playing && playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO)
            {
                int iSong = playlistPlayer.CurrentSong;
                if (iSong >= 0 && iSong <= facadeLayout.Count)
                {
                    GUIControl.SelectItemControl(GetID, facadeLayout.GetID, iSong);
                }
            }
            if (facadeLayout.Count <= 0)
            {
                GUIControl.FocusControl(GetID, btnLayouts.GetID);
                IMDBMovie movie = new IMDBMovie();
                movie.SetProperties(false, string.Empty);
            }


            using (Profile.Settings settings = new Profile.MPSettings())
            {
                playlistPlayer.RepeatPlaylist = settings.GetValueAsBool("movies", "repeat", true);
            }

            if (btnRepeatPlaylist != null)
            {
                btnRepeatPlaylist.Selected = playlistPlayer.RepeatPlaylist;
            }
        }
コード例 #2
0
        private void OnItemSelected(GUIListItem item, GUIControl parent)
        {
            if (item.Label == "..")
            {
                IMDBMovie notMovie = new IMDBMovie();
                notMovie.SetProperties(true, string.Empty);
                IMDBActor notActor = new IMDBActor();
                notActor.SetProperties();
                return;
            }
            IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;

            if (movie == null)
            {
                movie = new IMDBMovie();
            }

            ArrayList files = new ArrayList();

            VideoDatabase.GetFilesForMovie(movie.ID, ref files);

            if (files.Count > 0)
            {
                movie.SetProperties(false, (string)files[0]);
            }
            else
            {
                movie.SetProperties(false, string.Empty);
            }

            if (movie.ID >= 0)
            {
                string titleExt      = movie.Title + "{" + movie.ID + "}";
                string coverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt);

                if (Util.Utils.FileExistsInCache(coverArtImage))
                {
                    facadeLayout.FilmstripLayout.InfoImageFileName = coverArtImage;
                }
            }
        }
コード例 #3
0
        protected override void LoadDirectory(string strNewDirectory)
        {
            if (facadeLayout != null)
            {
                GUIWaitCursor.Show();
                try
                {
                    GUIListItem SelectedItem = facadeLayout.SelectedListItem;
                    if (SelectedItem != null)
                    {
                        if (SelectedItem.IsFolder && SelectedItem.Label != "..")
                        {
                            m_history.Set(SelectedItem.Label, currentFolder);
                        }
                    }
                    currentFolder = strNewDirectory;
                    facadeLayout.Clear();

                    string strObjects = string.Empty;

                    ArrayList itemlist = new ArrayList();

                    PlayList playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO);
                    /* copy playlist from general playlist*/
                    int iCurrentSong = -1;
                    if (playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO)
                    {
                        iCurrentSong = playlistPlayer.CurrentSong;
                    }

                    string strFileName;
                    for (int i = 0; i < playlist.Count; ++i)
                    {
                        PlayListItem item = playlist[i];
                        strFileName = item.FileName;

                        GUIListItem pItem = new GUIListItem(item.Description);
                        pItem.Path     = strFileName;
                        pItem.IsFolder = false;
                        //pItem.m_bIsShareOrDrive = false;

                        if (item.Duration > 0)
                        {
                            int nDuration = item.Duration;
                            if (nDuration > 0)
                            {
                                string str = Util.Utils.SecondsToHMSString(nDuration);
                                pItem.Label2 = str;
                            }
                            else
                            {
                                pItem.Label2 = string.Empty;
                            }
                        }
                        pItem.OnItemSelected += OnItemSelected;
                        itemlist.Add(pItem);
                        Util.Utils.SetDefaultIcons(pItem);
                    }

                    iCurrentSong = 0;
                    strFileName  = string.Empty;
                    //	Search current playlist item
                    if ((m_nTempPlayListWindow == GetID && m_strTempPlayListDirectory.IndexOf(currentFolder) >= 0 &&
                         g_Player.Playing &&
                         playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO_TEMP)
                        ||
                        (GetID == (int)Window.WINDOW_VIDEO_PLAYLIST &&
                         playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO &&
                         g_Player.Playing))
                    {
                        iCurrentSong = playlistPlayer.CurrentSong;
                        if (iCurrentSong >= 0)
                        {
                            playlist = playlistPlayer.GetPlaylist(playlistPlayer.CurrentPlaylistType);
                            if (iCurrentSong < playlist.Count)
                            {
                                PlayListItem item = playlist[iCurrentSong];
                                strFileName = item.FileName;
                            }
                        }
                    }

                    SetIMDBThumbs(itemlist);

                    string strSelectedItem = m_history.Get(currentFolder);
                    int    iItem           = 0;
                    foreach (GUIListItem item in itemlist)
                    {
                        facadeLayout.Add(item);

                        //	synchronize playlist with current directory
                        if (strFileName.Length > 0 && item.Path == strFileName)
                        {
                            item.Selected = true;
                        }
                    }
                    for (int i = 0; i < facadeLayout.Count; ++i)
                    {
                        GUIListItem item = facadeLayout[i];
                        if (item.Label == strSelectedItem)
                        {
                            GUIControl.SelectItemControl(GetID, facadeLayout.GetID, iItem);
                            break;
                        }
                        iItem++;
                    }
                    int iTotalItems = itemlist.Count;
                    if (itemlist.Count > 0)
                    {
                        GUIListItem rootItem = (GUIListItem)itemlist[0];
                        if (rootItem.Label == "..")
                        {
                            iTotalItems--;
                        }
                    }

                    //set object count label
                    GUIPropertyManager.SetProperty("#itemcount", Util.Utils.GetObjectCountLabel(iTotalItems));

                    if (currentSelectedItem >= 0)
                    {
                        GUIControl.SelectItemControl(GetID, facadeLayout.GetID, currentSelectedItem);
                    }
                    else if (itemlist.Count > 0)
                    {
                        GUIControl.SelectItemControl(GetID, facadeLayout.GetID, 0);
                    }
                    else
                    {
                        IMDBMovie movie = new IMDBMovie();
                        movie.SetProperties(false, string.Empty);
                    }
                    UpdateButtonStates();
                    GUIWaitCursor.Hide();
                }
                catch (Exception ex)
                {
                    GUIWaitCursor.Hide();
                    Log.Error("GUIVideoPlaylist: An error occured while loading the directory - {0}", ex.Message);
                }
            }
        }
コード例 #4
0
        protected override void LoadDirectory(string strNewDirectory)
        {
            GUIWaitCursor.Show();

            currentFolder = strNewDirectory;

            GUIControl.ClearControl(GetID, facadeLayout.GetID);

            ArrayList itemlist = new ArrayList();
            ArrayList movies   = ((VideoViewHandler)handler).Execute();

            if (handler.CurrentLevel > 0)
            {
                GUIListItem listItem = new GUIListItem("..");
                listItem.Path     = string.Empty;
                listItem.IsFolder = true;
                Util.Utils.SetDefaultIcons(listItem);
                itemlist.Add(listItem);
            }

            foreach (IMDBMovie movie in movies)
            {
                GUIListItem item = new GUIListItem();
                item.Label = movie.Title;
                if (handler.CurrentLevel + 1 < handler.MaxLevels)
                {
                    item.IsFolder = true;
                }
                else
                {
                    item.IsFolder = false;
                }

                item.Path = movie.File;

                // Protected movies validation, checks item and if it is inside protected shares.
                // If item is inside PIN protected share, checks if user validate PIN with Unlock
                // command from context menu and returns "True" if all is ok and item will be visible
                // in movie list. Non-protected item will skip check and will be always visible.
                if (!string.IsNullOrEmpty(item.Path) && !CheckItem(item))
                {
                    continue;
                }
                //
                item.Duration     = movie.RunTime * 60;
                item.AlbumInfoTag = movie;
                item.Year         = movie.Year;
                item.DVDLabel     = movie.DVDLabel;
                item.Rating       = movie.Rating;
                item.IsPlayed     = movie.Watched > 0 ? true : false;

                item.OnItemSelected += new GUIListItem.ItemSelectedHandler(item_OnItemSelected);

                itemlist.Add(item);
            }

            int itemIndex = 0;

            foreach (GUIListItem item in itemlist)
            {
                facadeLayout.Add(item);
            }
            // Set selected item history
            string viewFolder;

            if (handler.CurrentLevelWhere.ToLower() == "genre")
            {
                viewFolder = "genre";
            }
            else if (handler.CurrentLevelWhere.ToLower() == "actor")
            {
                viewFolder = "actor";
            }
            else if (handler.CurrentLevelWhere.ToLower() == "year")
            {
                viewFolder = "year";
            }
            else
            {
                viewFolder = "title";
            }

            string selectedItemLabel = m_history.Get(viewFolder);

            // Sort
            OnSort();

            if (string.IsNullOrEmpty(selectedItemLabel) && facadeLayout.SelectedListItem != null)
            {
                selectedItemLabel = facadeLayout.SelectedListItem.Label;
            }

            int itemCount = itemlist.Count;

            if (itemlist.Count > 0)
            {
                GUIListItem rootItem = (GUIListItem)itemlist[0];
                if (rootItem.Label == "..")
                {
                    itemCount--;
                }
            }

            //set object count label
            GUIPropertyManager.SetProperty("#itemcount", Util.Utils.GetObjectCountLabel(itemCount));

            // Clear info for zero result
            if (itemlist.Count == 0)
            {
                GUIListItem item = new GUIListItem();
                item.Label = GUILocalizeStrings.Get(284);
                IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;
                movie             = new IMDBMovie();
                item.AlbumInfoTag = movie;
                movie.SetProperties(false);
                itemlist.Add(item);
                facadeLayout.Add(item);
            }

            SwitchLayout();
            UpdateButtonStates();

            if (handler.CurrentLevel == 0)
            {
                for (int i = 0; i < facadeLayout.Count; ++i)
                {
                    GUIListItem item = facadeLayout[itemIndex];
                    if (item.Label == selectedItemLabel)
                    {
                        currentSelectedItem = itemIndex;
                        SelectItem();
                        break;
                    }
                    itemIndex++;
                }
            }
            // Set thumbs - also do a Item select
            if (handler.CurrentLevel < handler.MaxLevels)
            {
                if (handler.CurrentLevelWhere.ToLower() == "genre")
                {
                    SetGenreThumbs(itemlist);
                    SelectItem();
                }
                else if (handler.CurrentLevelWhere.ToLower() == "actor")
                {
                    SetActorThumbs(itemlist);
                }
                else if (handler.CurrentLevelWhere.ToLower() == "year")
                {
                    SetYearThumbs(itemlist);
                    SelectItem();
                }
                else
                {
                    // Assign thumbnails also for the custom views. Bugfix for Mantis 0001471:
                    // Cover image thumbs missing in My Videos when view Selection is by "watched"
                    SetIMDBThumbs(itemlist);
                }
            }
            else
            {
                SetIMDBThumbs(itemlist);
            }

            GUIWaitCursor.Hide();
        }
コード例 #5
0
        private void Update()
        {
            if (currentMovie == null)
            {
                return;
            }

            // Cast
            if (viewmode == ViewMode.Cast)
            {
                if (tbPlotArea != null)
                {
                    tbPlotArea.IsVisible = false;
                }
                if (tbReviwArea != null)
                {
                    tbReviwArea.IsVisible = false;
                }
                if (tbTextArea != null)
                {
                    tbTextArea.IsVisible = true;
                }
                if (imgCoverArt != null)
                {
                    imgCoverArt.IsVisible = true;
                }
                if (lblDisc != null)
                {
                    lblDisc.IsVisible = false;
                }
                if (spinDisc != null)
                {
                    spinDisc.IsVisible = false;
                }
                if (btnPlot != null)
                {
                    btnPlot.Selected = false;
                }
                if (btnReview != null)
                {
                    btnReview.Selected = false;
                }
                if (btnCast != null)
                {
                    btnCast.Selected = true;
                }
            }
            // Plot
            if (viewmode == ViewMode.Plot)
            {
                if (tbPlotArea != null)
                {
                    tbPlotArea.IsVisible = true;
                }
                if (tbReviwArea != null)
                {
                    tbReviwArea.IsVisible = false;
                }
                if (tbTextArea != null)
                {
                    tbTextArea.IsVisible = false;
                }
                if (imgCoverArt != null)
                {
                    imgCoverArt.IsVisible = true;
                }
                if (lblDisc != null)
                {
                    lblDisc.IsVisible = true;
                }
                if (spinDisc != null)
                {
                    spinDisc.IsVisible = true;
                }
                if (btnPlot != null)
                {
                    btnPlot.Selected = true;
                }
                if (btnReview != null)
                {
                    btnReview.Selected = false;
                }
                if (btnCast != null)
                {
                    btnCast.Selected = false;
                }
            }
            // Review
            if (viewmode == ViewMode.Review)
            {
                if (tbPlotArea != null)
                {
                    tbPlotArea.IsVisible = false;
                }
                if (tbReviwArea != null)
                {
                    tbReviwArea.IsVisible = true;
                }
                if (tbTextArea != null)
                {
                    tbTextArea.IsVisible = false;
                }
                if (imgCoverArt != null)
                {
                    imgCoverArt.IsVisible = true;
                }
                if (lblDisc != null)
                {
                    lblDisc.IsVisible = true;
                }
                if (spinDisc != null)
                {
                    spinDisc.IsVisible = true;
                }
                if (btnPlot != null)
                {
                    btnPlot.Selected = false;
                }
                if (btnReview != null)
                {
                    btnReview.Selected = true;
                }
                if (btnCast != null)
                {
                    btnCast.Selected = false;
                }
            }

            btnWatched.Selected = (currentMovie.Watched != 0);
            currentMovie.SetProperties(false);

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