private void OnShufflePlayList() { currentSelectedItem = m_Facade.SelectedListItemIndex; ClearFileItems(); PlayList playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES); if (playlist.Count <= 0) { return; } string currentItemFileName = string.Empty; if (playlistPlayer.CurrentItem >= 0) { if (g_Player.Playing && playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_TVSERIES) { PlayListItem item = playlist[playlistPlayer.CurrentItem]; currentItemFileName = item.FileName; } } playlist.Shuffle(); if (playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_TVSERIES) { playlistPlayer.Reset(); } if (currentItemFileName.Length > 0) { for (int i = 0; i < playlist.Count; i++) { PlayListItem playListItem = playlist[i]; if (playListItem.FileName == currentItemFileName) { playlistPlayer.CurrentItem = i; } } } LoadDirectory(currentFolder); }
protected void LoadPlayList(string strPlayList) { IPlayListIO loader = PlayListFactory.CreateIO(strPlayList); if (loader == null) { return; } PlayList playlist = new PlayList(); if (!loader.Load(playlist, strPlayList)) { TVSeriesPlugin.ShowDialogOk(Translation.Playlist, new string[] { GUILocalizeStrings.Get(477) }); return; } playlistPlayer.CurrentPlaylistName = System.IO.Path.GetFileNameWithoutExtension(strPlayList); if (playlist.Count == 1 && playlistPlayer.PlaylistAutoPlay) { MPTVSeriesLog.Write(string.Format("GUITVSeriesPlaylist: play single playlist item - {0}", playlist[0].FileName)); // If the file is an image file, it should be mounted before playing string filename = playlist[0].FileName; if (Helper.IsImageFile(filename)) { if (!GUIVideoFiles.MountImageFile(GUIWindowManager.ActiveWindow, filename, false)) { return; } } if (g_Player.Play(filename)) { if (MediaPortal.Util.Utils.IsVideo(filename)) { g_Player.ShowFullScreenWindow(); } } return; } // clear current playlist playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES).Clear(); // add each item of the playlist to the playlistplayer for (int i = 0; i < playlist.Count; ++i) { PlayListItem playListItem = playlist[i]; playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES).Add(playListItem); } // if we got a playlist if (playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES).Count > 0) { playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES); // autoshuffle on load if (playlistPlayer.PlaylistAutoShuffle) { playlist.Shuffle(); } // then get 1st item PlayListItem item = playlist[0]; // and start playing it if (playlistPlayer.PlaylistAutoPlay) { playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_TVSERIES; playlistPlayer.Reset(); playlistPlayer.Play(0); } // and activate the playlist window if its not activated yet if (GetID == GUIWindowManager.ActiveWindow) { GUIWindowManager.ActivateWindow(GetID); } } }