protected void LoadPlayList(string strPlayList)
        {
            IPlayListIO loader = PlayListFactory.CreateIO(strPlayList);

            if (loader == null)
            {
                return;
            }
            PlayList playlist = new PlayList();

            if (!loader.Load(playlist, strPlayList))
            {
                TellUserSomethingWentWrong();
                return;
            }

            playlistPlayer.CurrentPlaylistName = Path.GetFileNameWithoutExtension(strPlayList);
            if (playlist.Count == 1)
            {
                Log.Info("GUIVideoFiles: play single playlist item - {0}", playlist[0].FileName);
                if (g_Player.Play(playlist[0].FileName))
                {
                    if (Util.Utils.IsVideo(playlist[0].FileName))
                    {
                        g_Player.ShowFullScreenWindow();
                    }
                }
                return;
            }

            // clear current playlist
            playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).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_VIDEO).Add(playListItem);
            }

            // if we got a playlist
            if (playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Count > 0)
            {
                // then get 1st song
                playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO);
                PlayListItem item = playlist[0];

                // and start playing it
                playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO;
                playlistPlayer.Reset();
                playlistPlayer.Play(0);

                // and activate the playlist window if its not activated yet
                if (GetID == GUIWindowManager.ActiveWindow)
                {
                    GUIWindowManager.ActivateWindow((int)Window.WINDOW_VIDEO_PLAYLIST);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Gets the playlist for a given type
        /// </summary>
        /// <param name="type">Type of the playlist</param>
        /// <returns>List of all playlist items</returns>
        public static List <PlaylistEntry> GetPlaylistItems(String type)
        {
            PlayListType   plType         = GetTypeFromString(type);
            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
            PlayList       playList       = playListPlayer.GetPlaylist(plType);

            List <PlaylistEntry> retList = new List <PlaylistEntry>();

            foreach (PlayListItem item in playList)
            {
                PlaylistEntry entry = new PlaylistEntry();
                entry.FileName = item.FileName;
                entry.Name     = item.Description;
                entry.Duration = item.Duration;
                entry.Played   = item.Played;

                if (item.Type == PlayListItem.PlayListItemType.Audio)
                {
                    MpMusicHelper.AddMpExtendedInfo(item, entry);
                }

                retList.Add(entry);
            }

            return(retList);
        }
示例#3
0
        /// <summary>
        /// Save the current playlist to file
        /// </summary>
        /// <param name="name">Name of new playlist</param>
        internal static void SaveCurrentPlaylist(string name)
        {
            try
            {
                using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
                {
                    string playlistFolder = reader.GetValueAsString("music", "playlists", "");

                    if (!Path.IsPathRooted(playlistFolder))
                    {
                        playlistFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), playlistFolder);
                    }

                    PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
                    PlayList       playList       = playListPlayer.GetPlaylist(playListPlayer.CurrentPlaylistType);

                    String fileName = Path.Combine(playlistFolder, name + ".m3u");

                    PlayListM3uIO m3uPlayList = new PlayListM3uIO();
                    m3uPlayList.Save(playList, fileName);
                }
            }
            catch (Exception ex)
            {
                WifiRemote.LogMessage("Error saving playlist: " + ex.ToString(), WifiRemote.LogType.Warn);
            }
        }
示例#4
0
        /// <summary>
        /// Adds songs to a playlist by querying the music database
        /// </summary>
        /// <param name="type">Type of the playlist</param>
        /// <param name="where">SQL where condition</param>
        /// <param name="limit">Maximum number of songs</param>
        /// <param name="shuffle"><code>true</code> to shuffle the playlist</param>
        /// <param name="startIndex">Index to at the songs at</param>
        public static void AddSongsToPlaylistWithSQL(string type, string where, int limit, bool shuffle, int startIndex)
        {
            // Only works for music atm
            PlayListType plType = GetTypeFromString(type);

            if (plType == PlayListType.PLAYLIST_MUSIC)
            {
                List <Song> songs = new List <Song>();

                string sql = "select * from tracks where " + where;
                if (shuffle)
                {
                    sql += " ORDER BY random()";
                }

                MusicDatabase.Instance.GetSongsByFilter(sql, out songs, "tracks");
                if (songs.Count > 0)
                {
                    PlayListPlayer playListPlayer         = PlayListPlayer.SingletonPlayer;
                    int            numberOfSongsAvailable = songs.Count - 1;

                    // Limit 0 means unlimited
                    if (limit == 0)
                    {
                        limit = songs.Count;
                    }

                    for (int i = 0; i < limit && i < songs.Count; i++)
                    {
                        PlayListItem playListItem = ToPlayListItem(songs[i]);
                        playListPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC).Insert(playListItem, startIndex + i);
                    }
                }
            }
        }
示例#5
0
        /// <summary>
        /// Private method to start playlist (needed for the invoke callback)
        /// </summary>
        private static void StartPlayingPlaylist(bool switchToPlaylistView)
        {
            if (GUIGraphicsContext.form.InvokeRequired)
            {
                StartPlayingPlaylistDelegate d = StartPlayingPlaylist;
                GUIGraphicsContext.form.Invoke(d, new object[] { switchToPlaylistView });
            }
            else
            {
                PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer;
                PlayList       playlist       = playlistPlayer.GetPlaylist(mPlaylistStartType);
                // if we got a playlist
                if (playlist.Count > 0)
                {
                    // and activate the playlist window if its not activated yet
                    if (switchToPlaylistView)
                    {
                        if (mPlaylistStartType == PlayListType.PLAYLIST_MUSIC)
                        {
                            WindowPluginHelper.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_MUSIC_PLAYLIST);
                        }
                        else if (mPlaylistStartType == PlayListType.PLAYLIST_VIDEO)
                        {
                            WindowPluginHelper.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_VIDEO_PLAYLIST);
                        }
                    }

                    // and start playing it
                    playlistPlayer.CurrentPlaylistType = mPlaylistStartType;
                    playlistPlayer.Reset();
                    playlistPlayer.Play(mPlaylistStartIndex);
                }
            }
        }
示例#6
0
        /// <summary>
        /// Retrieves the name of the playlist
        /// </summary>
        /// <param name="type">Type of the playlist</param>
        public static String GetPlaylistName(String type)
        {
            PlayListType   plType         = GetTypeFromString(type);
            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
            PlayList       playList       = playListPlayer.GetPlaylist(plType);

            WifiRemote.LogMessage("Playlist name test:" + playList.Name, WifiRemote.LogType.Debug);

            return(playList.Name);
        }
        public void InsertItemButNotStartPlayingGivesNull()
        {
            PlayListPlayer player = new PlayListPlayer();

            player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
            PlayList     playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
            PlayListItem item1    = new PlayListItem();

            playlist.Add(item1);
            Assert.IsNull(player.GetCurrentItem());
        }
        public void GetNextReturnsFileName()
        {
            PlayListPlayer player = new PlayListPlayer();

            player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
            PlayList     playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
            PlayListItem item1    = new PlayListItem("apa", "c:\\apa.mp3");

            playlist.Add(item1);
            Assert.AreEqual("c:\\apa.mp3", player.GetNext());
        }
示例#9
0
        /// <summary>
        /// Clears the playlist (removes all entries)
        /// </summary>
        /// <param name="type">Type of the playlist</param>
        public static void ClearPlaylist(String type, bool refresh)
        {
            PlayListType   plType         = GetTypeFromString(type);
            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
            PlayList       playList       = playListPlayer.GetPlaylist(plType);

            playList.Clear();

            if (refresh)
            {
                RefreshPlaylistIfVisible();
            }
        }
示例#10
0
        /// <summary>
        /// Add or enque a song to the current playlist - call OnSongInserted() after this!!!
        /// </summary>
        /// <param name="song">the song to add</param>
        /// <returns>if the action was successful</returns>
        private bool AddSongToPlaylist(ref Song song)
        {
            PlayList playlist;

            if (PlaylistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_MUSIC_TEMP)
            {
                playlist = PlaylistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC_TEMP);
            }
            else
            {
                playlist = PlaylistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
            }

            if (playlist == null)
            {
                return(false);
            }

            //add to playlist
            PlayListItem playlistItem = new PlayListItem();

            playlistItem.Type = PlayListItem.PlayListItemType.Audio;
            StringBuilder sb = new StringBuilder();

            playlistItem.FileName = song.FileName;
            sb.Append(song.Track);
            sb.Append(". ");
            sb.Append(song.Artist);
            sb.Append(" - ");
            sb.Append(song.Title);
            playlistItem.Description = sb.ToString();
            playlistItem.Duration    = song.Duration;

            playlistItem.MusicTag = song.ToMusicTag();
            playlist.Add(playlistItem);

            OnSongInserted();
            return(true);
        }
        public void PlayMovesCurrentToItem()
        {
            PlayListPlayer player = new PlayListPlayer();

            player.g_Player            = this; //fake g_Player
            player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
            PlayList     playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
            PlayListItem item1    = new PlayListItem();

            playlist.Add(item1);
            player.PlayNext();
            Assert.AreEqual(item1, player.GetCurrentItem());
            Assert.IsTrue(hasPlayBeenCalled);
        }
示例#12
0
        /// <summary>
        /// Removes a song (identified by index in the playlist) from the playlist
        /// </summary>
        /// <param name="type">Type of the playlist</param>
        /// <param name="index">Index that should be removed</param>
        public static void RemoveItemFromPlaylist(String type, int index)
        {
            PlayListType   plType         = GetTypeFromString(type);
            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
            PlayList       playList       = playListPlayer.GetPlaylist(plType);

            if (playList.Count > index)
            {
                PlayListItem item = playList[index];
                playList.Remove(item.FileName);
            }

            RefreshPlaylistIfVisible();
        }
示例#13
0
        /// <summary>
        /// Load a playlist from disc.
        /// </summary>
        /// <param name="type">Type of the playlist</param>
        /// <param name="name">Name of the playlist (file)</param>
        /// <param name="shuffle"><code>true</code> to shuffle the playlist</param>
        public static void LoadPlaylist(string type, string name, bool shuffle)
        {
            // Only working for music atm
            PlayListType plType = GetTypeFromString(type);

            if (plType == PlayListType.PLAYLIST_MUSIC)
            {
                string playlistPath = String.Empty;

                // Playlist path supplied
                if (name.EndsWith(".m3u"))
                {
                    playlistPath = name;
                }
                // Playlist name supplied
                else
                {
                    // Get playlist folder from mp config
                    using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
                    {
                        string playlistFolder = reader.GetValueAsString("music", "playlists", "");

                        if (!Path.IsPathRooted(playlistFolder))
                        {
                            playlistFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), playlistFolder);
                        }

                        playlistPath = Path.Combine(playlistFolder, name + ".m3u");
                    }
                }

                if (File.Exists(playlistPath))
                {
                    // Load playlist from file
                    PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
                    PlayList       playList       = playListPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
                    PlayListM3uIO  m3uPlayList    = new PlayListM3uIO();
                    m3uPlayList.Load(playList, playlistPath);

                    // Shuffle playlist
                    if (shuffle)
                    {
                        Shuffle(type);
                    }
                }
            }
        }
示例#14
0
        /// <summary>
        /// Adds a song to a playlist
        /// </summary>
        /// <param name="type">Type of the playlist</param>
        /// <param name="entry">Item that gets added</param>
        /// <param name="index">Index where the item should be added</param>
        /// <param name="refresh">Should the playlist be refreshed after the item is added</param>
        public static void AddItemToPlaylist(String type, PlaylistEntry entry, int index, bool refresh)
        {
            PlayListType   plType         = GetTypeFromString(type);
            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
            PlayList       playList       = playListPlayer.GetPlaylist(plType);
            PlayListItem   item           = null;

            //If it's a music item, try to find it in the db
            if (plType == PlayListType.PLAYLIST_MUSIC)
            {
                MusicDatabase mpMusicDb = MusicDatabase.Instance;
                Song          song      = new Song();
                bool          inDb      = mpMusicDb.GetSongByFileName(entry.FileName, ref song);


                if (inDb)
                {
                    item = ToPlayListItem(song);
                }
            }
            else if (plType == PlayListType.PLAYLIST_VIDEO)
            {
                IMDBMovie movie = new IMDBMovie();
                int       id    = VideoDatabase.GetMovieInfo(entry.FileName, ref movie);

                if (id > 0)
                {
                    item = ToPlayListItem(movie);
                }
            }

            if (item == null)
            {
                item = new PlayListItem(entry.Name, entry.FileName, entry.Duration);
            }

            playList.Insert(item, index);

            if (refresh)
            {
                RefreshPlaylistIfVisible();
            }
        }
示例#15
0
        /// <summary>
        /// Add a list of playlist items to the current playlist
        /// </summary>
        /// <param name="type">Type of playlist (e.g. video/music)</param>
        /// <param name="items">Items that we want to add</param>
        /// <param name="startIndex">Where should the items be added (-1 will append them at the end)</param>
        internal static void AddPlaylistItems(PlayListType type, List <PlayListItem> items, int startIndex)
        {
            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
            PlayList       playList       = playListPlayer.GetPlaylist(type);

            if (startIndex == -1 || startIndex >= playList.Count)
            {
                startIndex = playList.Count;
            }
            else if (startIndex < 0)
            {
                startIndex = 0;
            }

            for (int i = 0; i < items.Count; i++)
            {
                //Note: we need -1 here, because Insert wants the item after which the song should be inserted, not the actual index
                playList.Insert(items[i], i + startIndex - 1);
            }
        }
示例#16
0
        /// <summary>
        /// Changes the position of an item in the playlist
        /// </summary>
        /// <param name="type">Type of the playlist</param>
        /// <param name="oldIndex">Current position of item</param>
        /// <param name="newIndex">Target position of item</param>
        public static void ChangePlaylistItemPosition(String type, int oldIndex, int newIndex)
        {
            PlayListType   plType         = GetTypeFromString(type);
            PlayListPlayer playListPlayer = PlayListPlayer.SingletonPlayer;
            PlayList       playList       = playListPlayer.GetPlaylist(plType);

            if (oldIndex >= 0 && newIndex >= 0 && playList.Count > oldIndex && playList.Count > newIndex)
            {
                WifiRemote.LogMessage("Change playlist index " + oldIndex + " to " + newIndex, WifiRemote.LogType.Debug);
                PlayListItem item = playList[oldIndex];
                playList.Remove(item.FileName);
                //Note: we need -1 here, because Insert wants the item after which the song should be inserted, not the actual index
                playList.Insert(item, newIndex - 1);

                RefreshPlaylistIfVisible();
            }
            else
            {
                WifiRemote.LogMessage("Index for changing playlistPosition invalid (old: " + oldIndex + ", new: " + newIndex + ")", WifiRemote.LogType.Warn);
            }
        }
示例#17
0
        /// <summary>
        /// Loads a playlist and starts the playback
        /// </summary>
        /// <param name="playListFileName">Filename of the playlist</param>
        private void LoadPlayList(string playListFileName)
        {
            IPlayListIO loader   = PlayListFactory.CreateIO(playListFileName);
            PlayList    playlist = new PlayList();

            if (!loader.Load(playlist, playListFileName))
            {
                GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                if (dlgOk != null)
                {
                    dlgOk.SetHeading(6);
                    dlgOk.SetLine(1, 477);
                    dlgOk.SetLine(2, String.Empty);
                    dlgOk.DoModal(GetID);
                }
                return;
            }
            if (playlist.Count == 1)
            {
                string movieFileName = playlist[0].FileName + ".mplayer";
                if (movieFileName.StartsWith("rtsp:"))
                {
                    movieFileName = "ZZZZ:" + movieFileName.Remove(0, 5);
                }
                if (g_Player.Play(movieFileName))
                {
                    if (g_Player.Player != null && g_Player.IsVideo)
                    {
                        GUIGraphicsContext.IsFullScreenVideo = true;
                        GUIWindowManager.ActivateWindow((int)Window.WINDOW_FULLSCREEN_VIDEO);
                    }
                }
                return;
            }

            PlaylistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Clear();

            for (int i = 0; i < playlist.Count; ++i)
            {
                string movieFileName = playlist[i].FileName + ".mplayer";
                if (movieFileName.StartsWith("rtsp:"))
                {
                    movieFileName = "ZZZZ:" + movieFileName.Remove(0, 5);
                }
                playlist[i].FileName = movieFileName;
                PlayListItem playListItem = playlist[i];
                playListItem.Type = PlayListItem.PlayListItemType.Unknown;
                PlaylistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Add(playListItem);
            }


            if (PlaylistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Count > 0)
            {
                PlaylistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO);
                PlaylistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO;
                PlaylistPlayer.Reset();
                PlaylistPlayer.Play(0);

                if (g_Player.Player != null && g_Player.IsVideo)
                {
                    GUIGraphicsContext.IsFullScreenVideo = true;
                    GUIWindowManager.ActivateWindow((int)Window.WINDOW_FULLSCREEN_VIDEO);
                }
            }
        }
示例#18
0
        /// <summary>
        /// Tune to a new last.fm radio station and add tracks to playlist
        /// </summary>
        /// <param name="strStation">name os station to tune to</param>
        private void TuneToStation(string strStation)
        {
            if (!Win32API.IsConnectedToInternet())
            {
                var dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_NOTIFY);
                if (null != dlgNotify)
                {
                    dlgNotify.SetHeading(GUILocalizeStrings.Get(107890));
                    dlgNotify.SetText(GUILocalizeStrings.Get(34064));
                    dlgNotify.DoModal(GetID);
                }
                return;
            }

            Log.Debug("Attempting to Tune to last.fm station: {0}", strStation);

            // Clear playlist and start playback
            var pl = _playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_LAST_FM);

            pl.Clear();
            _playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_LAST_FM;
            _playlistPlayer.Reset();

            try
            {
                LastFMLibrary.TuneRadio(strStation);
            }
            catch (LastFMException ex)
            {
                Log.Error(ex);
                var dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_NOTIFY);
                if (null != dlgNotify)
                {
                    dlgNotify.SetHeading(GUILocalizeStrings.Get(107890));
                    dlgNotify.SetText(ex.Message);
                    dlgNotify.DoModal(GetID);
                }
                return;
            }

            Log.Debug("Tuned to last.fm station: {0}", strStation);

            try
            {
                AddMoreTracks();
            }
            catch (LastFMException ex)
            {
                Log.Error("Unable to add last.fm tracks to playlist");
                var errMessage = "Unable to add last.fm tracks to playlist\n";
                if (ex.LastFMError == LastFMException.LastFMErrorCode.UnknownError)
                {
                    Log.Error(ex);
                    errMessage += "Please check logs";
                }
                else
                {
                    errMessage += ex.Message;
                }

                var dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_NOTIFY);
                if (null != dlgNotify)
                {
                    dlgNotify.SetHeading(GUILocalizeStrings.Get(107890));
                    dlgNotify.SetText(errMessage);
                    dlgNotify.DoModal(GetID);
                }
                return;
            }
            _playlistPlayer.Play(0);
        }
示例#19
0
        /// <summary>
        /// Play all episodes of a season
        /// </summary>
        /// <param name="seriesId">ID of a series</param>
        /// <param name="seasonNumber">Number of the season</param>
        /// <param name="onlyUnwatched">Play only unwatched episodes</param>
        /// <param name="autostart">If yes, automatically starts playback with the first episode</param>
        /// <param name="startIndex">Index of the item with which playback should start</param>
        /// <param name="switchToPlaylistView">If yes the playlistview will be shown</param>
        public static void PlaySeason(int seriesId, int seasonNumber, bool autostart, int startIndex, bool onlyUnwatched, bool switchToPlaylistView)
        {
            if (GUIGraphicsContext.form.InvokeRequired)
            {
                PlaySeasonAsyncDelegate d = new PlaySeasonAsyncDelegate(PlaySeason);
                GUIGraphicsContext.form.Invoke(d, new object[] { seriesId, seasonNumber, autostart, startIndex, onlyUnwatched, switchToPlaylistView });
                return;
            }

            List <DBEpisode> episodes = DBEpisode.Get(seriesId, seasonNumber);

            if (episodes == null || episodes.Count == 0)
            {
                return;
            }

            // filter out anything we can't play
            episodes.RemoveAll(e => string.IsNullOrEmpty(e[DBEpisode.cFilename]));

            // filter out watched episodes
            if (onlyUnwatched)
            {
                episodes.RemoveAll(e => e[DBOnlineEpisode.cWatched] != 0);
            }
            if (episodes.Count == 0)
            {
                return;
            }

            // Sort episodes and add them to the MP-TVSeries playlist player
            // Setup playlist player
            if (playlistPlayer == null)
            {
                playlistPlayer = PlayListPlayer.SingletonPlayer;
                playlistPlayer.PlaylistAutoPlay = true;
                playlistPlayer.RepeatPlaylist   = DBOption.GetOptions(DBOption.cRepeatPlaylist);
            }

            playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES).Clear();
            episodes.Sort();

            foreach (DBEpisode episode in episodes)
            {
                PlayListItem playlistItem = new PlayListItem(episode);
                playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES).Add(playlistItem);
            }

            //automatically start playing the playlist
            if (autostart)
            {
                // and activate the playlist window if its not activated yet
                if (switchToPlaylistView)
                {
                    GUIWindowManager.ActivateWindow(GUITVSeriesPlayList.GetWindowID);
                }

                playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_TVSERIES;
                playlistPlayer.Reset();
                playlistPlayer.Play(0);
            }
        }