private void SavePlayList()
        {
            string strNewFileName = playlistPlayer.CurrentPlaylistName;

            if (VirtualKeyboard.GetKeyboard(ref strNewFileName, GetID))
            {
                string strPath         = Path.GetFileNameWithoutExtension(strNewFileName);
                string strPlayListPath = string.Empty;
                using (Profile.Settings xmlreader = new Profile.MPSettings())
                {
                    strPlayListPath = xmlreader.GetValueAsString("music", "playlists", string.Empty);
                    strPlayListPath = Util.Utils.RemoveTrailingSlash(strPlayListPath);
                }

                strPath += ".m3u";
                if (strPlayListPath.Length != 0)
                {
                    strPath = strPlayListPath + @"\" + strPath;
                }
                PlayList playlist = new PlayList();
                for (int i = 0; i < facadeLayout.Count; ++i)
                {
                    GUIListItem  pItem   = facadeLayout[i];
                    PlayListItem newItem = new PlayListItem();
                    newItem.FileName    = pItem.Path;
                    newItem.Description = pItem.Label;
                    newItem.Duration    = (pItem.MusicTag == null) ? pItem.Duration : (pItem.MusicTag as MusicTag).Duration;
                    newItem.Type        = PlayListItem.PlayListItemType.Audio;
                    playlist.Add(newItem);
                }
                IPlayListIO saver = new PlayListM3uIO();
                saver.Save(playlist, strPath);
            }
        }
        private void OnSavePlayList()
        {
            currentSelectedItem = facadeLayout.SelectedListItemIndex;
            string playlistFileName = string.Empty;

            if (VirtualKeyboard.GetKeyboard(ref playlistFileName, GetID))
            {
                string playListPath = string.Empty;
                using (Profile.Settings xmlreader = new Profile.MPSettings())
                {
                    playListPath = xmlreader.GetValueAsString("movies", "playlists", string.Empty);
                    playListPath = Util.Utils.RemoveTrailingSlash(playListPath);
                }

                string fullPlayListPath = Path.GetFileNameWithoutExtension(playlistFileName);

                fullPlayListPath += ".m3u";
                if (playListPath.Length != 0)
                {
                    fullPlayListPath = playListPath + @"\" + fullPlayListPath;
                }
                PlayList playlist = new PlayList();
                for (int i = 0; i < facadeLayout.Count; ++i)
                {
                    GUIListItem  listItem     = facadeLayout[i];
                    PlayListItem playListItem = new PlayListItem();
                    playListItem.FileName    = listItem.Path;
                    playListItem.Description = listItem.Label;
                    playListItem.Duration    = listItem.Duration;
                    playListItem.Type        = PlayListItem.PlayListItemType.Video;
                    playlist.Add(playListItem);
                }
                PlayListM3uIO saver = new PlayListM3uIO();
                saver.Save(playlist, fullPlayListPath);
            }
        }
Example #3
0
        protected override void OnShowContextMenu()
        {
            GUIListItem item = GetSelectedItem();

            if (item == null)
            {
                return;
            }

            NewMovie movie = item.AlbumInfoTag as NewMovie;

            if (movie == null)
            {
                return;
            }

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(498);          // Menu

            dlg.AddLocalizedString(6032); // Search by title
            if (viewLevel == Utils.ViewLevel.Files)
            {
            }
            else if (movie.Status == Utils.ImporterStatus.COMPLETE)
            {
                dlg.AddLocalizedString(368); //IMDB
            }

            dlg.DoModal(GetID);

            if (dlg.SelectedId == -1)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case 6032: // Search by title
                string moviename = movie.SearchTitle;
                if (moviename == "unknown")
                {
                    moviename = MediaPortal.Util.Utils.GetFilename(movie.FileName, true);
                }
                if (VirtualKeyboard.GetKeyboard(ref moviename, GetID))
                {
                    if (!string.IsNullOrEmpty(moviename))
                    {
                        movie.SearchTitle = moviename;
                        movie.Status      = Utils.ImporterStatus.QUEUED_IMDB;
                        if (viewLevel == Utils.ViewLevel.Files)
                        {
                            SetStatus(ref item, movie);
                        }
                        else
                        {
                            item.Label = Translation.IMDBScanning;
                            item.TVTag = Utils.ItemType.Search;
                            SetStatus(ref item);
                        }
                    }
                }
                break;

            case 368: // IMDB
                ShowInfo(item);
                break;
            }
        }