protected void OnShowSavedPlaylists(string _directory)
        {
            VirtualDirectory _virtualDirectory = new VirtualDirectory();

            _virtualDirectory.AddExtension(".m3u");
            _virtualDirectory.AddExtension(".pls");
            _virtualDirectory.AddExtension(".b4s");
            _virtualDirectory.AddExtension(".wpl");

            List <GUIListItem> itemlist = _virtualDirectory.GetDirectoryExt(_directory);

            if (_directory == m_strPlayListPath)
            {
                itemlist.RemoveAt(0);
            }

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

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(983); // Saved Playlists

            foreach (GUIListItem item in itemlist)
            {
                Util.Utils.SetDefaultIcons(item);
                dlg.Add(item);
            }

            dlg.DoModal(GetID);

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

            GUIListItem selectItem = itemlist[dlg.SelectedLabel];

            if (selectItem.IsFolder)
            {
                OnShowSavedPlaylists(selectItem.Path);
                return;
            }

            GUIWaitCursor.Show();
            LoadPlayList(selectItem.Path);
            GUIWaitCursor.Hide();
        }
 public GUIVideoPlayList()
 {
     GetID          = (int)Window.WINDOW_VIDEO_PLAYLIST;
     playlistPlayer = PlayListPlayer.SingletonPlayer;
     m_directory.AddDrives();
     m_directory.SetExtensions(Util.Utils.VideoExtensions);
     m_directory.AddExtension(".m3u");
 }
        protected void OnShowSavedPlaylists(string _directory)
        {
            VirtualDirectory _virtualDirectory = new VirtualDirectory();

            _virtualDirectory.AddExtension(".tvsplaylist");

            List <GUIListItem> itemlist = _virtualDirectory.GetDirectoryExt(_directory);

            if (_directory == DBOption.GetOptions(DBOption.cPlaylistPath))
            {
                itemlist.RemoveAt(0);
            }

            // If no playlists found, show a Message to user and then exit
            if (itemlist.Count == 0)
            {
                GUIDialogOK dlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
                dlgOK.SetHeading(983);
                dlgOK.SetLine(1, Translation.NoPlaylistsFound);
                dlgOK.SetLine(2, _directory);
                dlgOK.DoModal(GUIWindowManager.ActiveWindow);
                return;
            }

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

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(983); // Saved Playlists

            foreach (GUIListItem item in itemlist)
            {
                MediaPortal.Util.Utils.SetDefaultIcons(item);
                dlg.Add(item);
            }

            dlg.DoModal(GetID);

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

            GUIListItem selectItem = itemlist[dlg.SelectedLabel];

            if (selectItem.IsFolder)
            {
                OnShowSavedPlaylists(selectItem.Path);
                return;
            }

            GUIWaitCursor.Show();
            LoadPlayList(selectItem.Path);
            GUIWaitCursor.Hide();
        }
Example #4
0
        /// <summary>
        /// Initialize the virtual directory
        /// </summary>
        private void InitializeVirtualDirectory()
        {
            _sharePaths = new List <string>();
            _mDirectory.SetExtensions(GetExtenstions());
            _mDirectory.AddExtension(".pls");
            _mDirectory.AddExtension(".m3u");

            _mDirectory.Clear();
            if (_useMyVideoShares)
            {
                AddSection("movies");
            }
            if (_useMyMusicShares)
            {
                AddSection("music");
            }
            XmlDocument doc  = new XmlDocument();
            string      path = Config.GetFile(Config.Dir.Config, "MPlayer_GUIPlugin.xml");

            doc.Load(path);
            if (doc.DocumentElement != null)
            {
                XmlNodeList listShare = doc.DocumentElement.SelectNodes("/mplayergui/Share");
                if (listShare != null)
                {
                    foreach (XmlNode nodeShare in listShare)
                    {
                        Share share = new Share
                        {
                            Name = nodeShare.Attributes["name"].Value, Path = nodeShare.Attributes["path"].Value
                        };
                        if (!_sharePaths.Contains(share.Path.ToLower()))
                        {
                            _sharePaths.Add(share.Path.ToLower());
                            _mDirectory.Add(share);
                        }
                    }
                }
            }
        }