From: <mis...@us...> - 2007-03-09 13:23:44
|
Revision: 170 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=170&view=rev Author: misterd_sf Date: 2007-03-09 05:23:31 -0800 (Fri, 09 Mar 2007) Log Message: ----------- MPlayer: - Added option to use my video and/or my music shares - Added option to delete items - Documentation updated Modified Paths: -------------- trunk/plugins/My MPlayer/Liesmich.pdf trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.Designer.cs trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.cs trunk/plugins/My MPlayer/MPlayer_GUIPlugin/MPlayer_GUIPlugin.cs trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/BlueTwo 16x9/myMPlayer.xml trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/BlueTwo 4x3/myMPlayer.xml trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/PM III/myMPlayer.xml trunk/plugins/My MPlayer/Readme.pdf Modified: trunk/plugins/My MPlayer/Liesmich.pdf =================================================================== (Binary files differ) Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs 2007-03-09 07:46:47 UTC (rev 169) +++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs 2007-03-09 13:23:31 UTC (rev 170) @@ -303,7 +303,7 @@ /// Version number of the player /// </summary> public override string VersionNumber { - get { return "0.61"; } + get { return "0.65"; } } #endregion @@ -437,13 +437,16 @@ mplayerBackgroundPanel = new Panel(); mplayerBackgroundPanel.BackColor = Color.Black; mplayerBackgroundPanel.Size = new System.Drawing.Size(0, 0); + mplayerBackgroundPanel.Location = new Point(0, 0); mplayerOuterPanel = new Panel(); mplayerOuterPanel.BackColor = Color.FromArgb(0, 0, 0, 0); ; mplayerOuterPanel.Size = new System.Drawing.Size(0, 0); + mplayerOuterPanel.Location = new Point(0, 0); mplayerInnerPanel = new Panel(); mplayerInnerPanel.Size = new System.Drawing.Size(0, 0); mplayerInnerPanel.BackColor = Color.FromArgb(16, 16, 16); mplayerOuterPanel.Controls.Add(mplayerInnerPanel); + mplayerInnerPanel.Location = new Point(0, 0); _playState = PlayState.Playing; speed = 1; _volume = 100; @@ -790,7 +793,7 @@ m_geometry.ARType = GUIGraphicsContext.ARType; m_geometry.PixelRatio = GUIGraphicsContext.PixelRatio; // Use Method with crop settings, because without it doesn't work properly. There is a bug. - m_geometry.GetWindow(videoWith, videoHeight, out _sourceRectangle, out _videoRectangle, new CropSettings()); + m_geometry.GetWindow(videoWith, videoHeight, out _sourceRectangle, out _videoRectangle); _positionX += _videoRectangle.X; _positionY += _videoRectangle.Y; Modified: trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.Designer.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.Designer.cs 2007-03-09 07:46:47 UTC (rev 169) +++ trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.Designer.cs 2007-03-09 13:23:31 UTC (rev 170) @@ -60,11 +60,15 @@ this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.pluginName = new System.Windows.Forms.TextBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.myVideoShare = new System.Windows.Forms.CheckBox(); + this.myMusicShare = new System.Windows.Forms.CheckBox(); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // okButton // - this.okButton.Location = new System.Drawing.Point(12, 237); + this.okButton.Location = new System.Drawing.Point(14, 290); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 3; @@ -75,7 +79,7 @@ // cancelButton // this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cancelButton.Location = new System.Drawing.Point(322, 237); + this.cancelButton.Location = new System.Drawing.Point(322, 290); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(75, 23); this.cancelButton.TabIndex = 20; @@ -90,7 +94,7 @@ // shareLocation // this.shareLocation.Enabled = false; - this.shareLocation.Location = new System.Drawing.Point(90, 210); + this.shareLocation.Location = new System.Drawing.Point(87, 194); this.shareLocation.Name = "shareLocation"; this.shareLocation.Size = new System.Drawing.Size(207, 20); this.shareLocation.TabIndex = 33; @@ -99,7 +103,7 @@ // label24 // this.label24.AutoSize = true; - this.label24.Location = new System.Drawing.Point(12, 213); + this.label24.Location = new System.Drawing.Point(9, 197); this.label24.Name = "label24"; this.label24.Size = new System.Drawing.Size(48, 13); this.label24.TabIndex = 32; @@ -108,7 +112,7 @@ // label23 // this.label23.AutoSize = true; - this.label23.Location = new System.Drawing.Point(12, 187); + this.label23.Location = new System.Drawing.Point(9, 171); this.label23.Name = "label23"; this.label23.Size = new System.Drawing.Size(38, 13); this.label23.TabIndex = 31; @@ -117,7 +121,7 @@ // shareName // this.shareName.Enabled = false; - this.shareName.Location = new System.Drawing.Point(90, 184); + this.shareName.Location = new System.Drawing.Point(87, 168); this.shareName.Name = "shareName"; this.shareName.Size = new System.Drawing.Size(207, 20); this.shareName.TabIndex = 30; @@ -125,7 +129,7 @@ // // shareDelete // - this.shareDelete.Location = new System.Drawing.Point(90, 155); + this.shareDelete.Location = new System.Drawing.Point(87, 139); this.shareDelete.Name = "shareDelete"; this.shareDelete.Size = new System.Drawing.Size(75, 23); this.shareDelete.TabIndex = 29; @@ -135,7 +139,7 @@ // // shareAdd // - this.shareAdd.Location = new System.Drawing.Point(12, 155); + this.shareAdd.Location = new System.Drawing.Point(9, 139); this.shareAdd.Name = "shareAdd"; this.shareAdd.Size = new System.Drawing.Size(75, 23); this.shareAdd.TabIndex = 28; @@ -146,15 +150,15 @@ // shareList // this.shareList.FormattingEnabled = true; - this.shareList.Location = new System.Drawing.Point(12, 54); + this.shareList.Location = new System.Drawing.Point(9, 38); this.shareList.Name = "shareList"; - this.shareList.Size = new System.Drawing.Size(385, 95); + this.shareList.Size = new System.Drawing.Size(366, 95); this.shareList.TabIndex = 27; this.shareList.SelectedIndexChanged += new System.EventHandler(this.shareList_SelectedIndexChanged); // // browseButton // - this.browseButton.Location = new System.Drawing.Point(322, 208); + this.browseButton.Location = new System.Drawing.Point(300, 192); this.browseButton.Name = "browseButton"; this.browseButton.Size = new System.Drawing.Size(75, 23); this.browseButton.TabIndex = 34; @@ -165,7 +169,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(9, 32); + this.label1.Location = new System.Drawing.Point(6, 16); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(74, 13); this.label1.TabIndex = 35; @@ -187,22 +191,53 @@ this.pluginName.Size = new System.Drawing.Size(212, 20); this.pluginName.TabIndex = 37; // + // groupBox1 + // + this.groupBox1.Controls.Add(this.shareList); + this.groupBox1.Controls.Add(this.shareAdd); + this.groupBox1.Controls.Add(this.shareDelete); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.shareName); + this.groupBox1.Controls.Add(this.browseButton); + this.groupBox1.Controls.Add(this.label23); + this.groupBox1.Controls.Add(this.shareLocation); + this.groupBox1.Controls.Add(this.label24); + this.groupBox1.Location = new System.Drawing.Point(14, 58); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(385, 226); + this.groupBox1.TabIndex = 38; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Additional internal shares:"; + // + // myVideoShare + // + this.myVideoShare.AutoSize = true; + this.myVideoShare.Location = new System.Drawing.Point(12, 35); + this.myVideoShare.Name = "myVideoShare"; + this.myVideoShare.Size = new System.Drawing.Size(123, 17); + this.myVideoShare.TabIndex = 39; + this.myVideoShare.Text = "Use MyVideo shares"; + this.myVideoShare.UseVisualStyleBackColor = true; + // + // myMusicShare + // + this.myMusicShare.AutoSize = true; + this.myMusicShare.Location = new System.Drawing.Point(273, 35); + this.myMusicShare.Name = "myMusicShare"; + this.myMusicShare.Size = new System.Drawing.Size(124, 17); + this.myMusicShare.TabIndex = 40; + this.myMusicShare.Text = "Use MyMusic shares"; + this.myMusicShare.UseVisualStyleBackColor = true; + // // ConfigurationForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.CancelButton = this.cancelButton; - this.ClientSize = new System.Drawing.Size(409, 274); + this.ClientSize = new System.Drawing.Size(411, 325); + this.Controls.Add(this.myMusicShare); + this.Controls.Add(this.myVideoShare); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.pluginName); this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.browseButton); - this.Controls.Add(this.shareLocation); - this.Controls.Add(this.label24); - this.Controls.Add(this.label23); - this.Controls.Add(this.shareName); - this.Controls.Add(this.shareDelete); - this.Controls.Add(this.shareAdd); - this.Controls.Add(this.shareList); this.Controls.Add(this.cancelButton); this.Controls.Add(this.okButton); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; @@ -211,6 +246,8 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "MPlayer Configuration"; this.Load += new System.EventHandler(this.ConfigurationForm_Load); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -239,6 +276,9 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox pluginName; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.CheckBox myVideoShare; + private System.Windows.Forms.CheckBox myMusicShare; } } \ No newline at end of file Modified: trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.cs 2007-03-09 07:46:47 UTC (rev 169) +++ trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.cs 2007-03-09 13:23:31 UTC (rev 170) @@ -199,6 +199,8 @@ } using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { pluginName.Text = xmlreader.GetValueAsString("mplayer", "displayNameOfGUI", "My MPlayer GUI"); + myVideoShare.Checked = xmlreader.GetValueAsBool("mplayer", "useMyVideoShares", true); + myMusicShare.Checked = xmlreader.GetValueAsBool("mplayer", "useMyMusicShares", true); } } catch (Exception e) { Log.Info("MPlayer GUI Error: Configuration could not be loaded: " + e.Message); @@ -230,15 +232,16 @@ writer.WriteEndDocument(); writer.Close(); using (MediaPortal.Profile.Settings xmlWriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { - if (pluginName.Text.Equals(String.Empty)) { + if (String.IsNullOrEmpty(pluginName.Text)) { xmlWriter.SetValue("mplayer", "displayNameOfGUI", "My MPlayer"); } else { xmlWriter.SetValue("mplayer", "displayNameOfGUI", pluginName.Text); } + xmlWriter.SetValueAsBool("mplayer", "useMyMusicShares", myMusicShare.Checked); + xmlWriter.SetValueAsBool("mplayer", "useMyVideoShares", myVideoShare.Checked); } } #endregion - } } \ No newline at end of file Modified: trunk/plugins/My MPlayer/MPlayer_GUIPlugin/MPlayer_GUIPlugin.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_GUIPlugin/MPlayer_GUIPlugin.cs 2007-03-09 07:46:47 UTC (rev 169) +++ trunk/plugins/My MPlayer/MPlayer_GUIPlugin/MPlayer_GUIPlugin.cs 2007-03-09 13:23:31 UTC (rev 170) @@ -37,9 +37,11 @@ using MediaPortal.Player; using MediaPortal.Dispatcher; using MediaPortal.Video.Database; +using MediaPortal.Music.Database; using MediaPortal.TV.Database; using MediaPortal.GUI.View; using MediaPortal.GUI.Video; +using MediaPortal.GUI.Music; using MediaPortal.Configuration; namespace MPlayer { @@ -71,57 +73,63 @@ } #endregion - #region variables + #region variables /// <summary> /// Virutal Directory /// </summary> private VirtualDirectory m_directory = new VirtualDirectory(); - + /// <summary> /// ViewAs Button /// </summary> [SkinControlAttribute(2)] private GUIButtonControl btnViewAs = null; - + /// <summary> /// SortBy Button /// </summary> [SkinControlAttribute(3)] private GUISortButtonControl btnSortBy = null; - + /// <summary> /// PlayStream Button /// </summary> [SkinControlAttribute(5)] private GUIButtonControl btnPlayStream = null; - + /// <summary> - /// PlayDis Button + /// PlayDisc Button /// </summary> [SkinControlAttribute(6)] private GUIButtonControl btnPlayDisc = null; - + /// <summary> + /// Delete Button + /// </summary> + [SkinControlAttribute(7)] + private GUIButtonControl btnDelete = null; + + /// <summary> /// FacadeView /// </summary> [SkinControlAttribute(50)] private GUIFacadeControl facadeView = null; - + /// <summary> /// Current view mode /// </summary> private View currentView; - + /// <summary> /// Current sort method /// </summary> private VideoSort.SortMethod currentSortMethod; - + /// <summary> /// Indicator, if ascending sort is selected /// </summary> private bool m_bSortAscending; - + /// <summary> /// Playlistplayer instance /// </summary> @@ -136,6 +144,18 @@ /// Display name of the plugin /// </summary> private string displayName; + /// <summary> + /// Indicates if the my video Shares are used + /// </summary> + private bool useMyVideoShares; + /// <summary> + /// Indicates if the my music Shares are used + /// </summary> + private bool useMyMusicShares; + /// <summary> + /// List of path of all shares + /// </summary> + private List<String> sharePaths; #endregion #region ctor @@ -145,7 +165,7 @@ static MPlayer_GUIPlugin() { playlistPlayer = PlayListPlayer.SingletonPlayer; } - + /// <summary> /// Standard constructor which set the WindowID /// </summary> @@ -154,6 +174,8 @@ virtualPath = String.Empty; using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { displayName = xmlreader.GetValueAsString("mplayer", "displayNameOfGUI", "My MPlayer"); + useMyVideoShares = xmlreader.GetValueAsBool("mplayer", "useMyVideoShares", true); + useMyMusicShares = xmlreader.GetValueAsBool("mplayer", "useMyMusicShares", true); } } #endregion @@ -166,7 +188,7 @@ get { return currentView; } set { currentView = value; } } - + /// <summary> /// Gets/Sets the current sort method /// </summary> @@ -174,7 +196,7 @@ get { return currentSortMethod; } set { currentSortMethod = value; } } - + /// <summary> /// Gets/Sets the current sorting direction /// </summary> @@ -182,40 +204,17 @@ get { return m_bSortAscending; } set { m_bSortAscending = value; } } - + /// <summary> /// Inits the window plugin /// </summary> /// <returns>true, if init was successful</returns> public override bool Init() { bool bResult = Load(GUIGraphicsContext.Skin + @"\myMPlayer.xml"); - m_directory.SetExtensions(getExtenstions()); - m_directory.Clear(); - Share share = null; - string[] drives = Environment.GetLogicalDrives(); - foreach (string driveElement in drives) { - if (Utils.getDriveType(driveElement) == 5) { - string driveLetter = driveElement.Substring(0, 1); - share = new Share(); - share.Name = driveLetter + ":\\"; - share.Path = driveLetter + ":\\"; - m_directory.Add(share); - } - } - XmlDocument doc = new XmlDocument(); - string path = Config.GetFile(Config.Dir.Config, "MPlayer_GUIPlugin.xml"); - doc.Load(path); - XmlNodeList listShare = doc.DocumentElement.SelectNodes("/mplayergui/Share"); - foreach (XmlNode nodeShare in listShare) { - share = new Share(); - share.Name = nodeShare.Attributes["name"].Value; - share.Path = nodeShare.Attributes["path"].Value; - m_directory.Add(share); - } - + initializeVirtualDirectory(); return bResult; } - + /// <summary> /// Handler for the GUIMessage of the MP System /// </summary> @@ -224,11 +223,11 @@ public override bool OnMessage(GUIMessage message) { if (message.Message == GUIMessage.MessageType.GUI_MSG_WINDOW_INIT) { bool mplayerPlayerAvailable = false; - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config,"MediaPortal.xml"))) { + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { mplayerPlayerAvailable = xmlreader.GetValueAsBool("plugins", "MPlayer", false); } - mplayerPlayerAvailable = (mplayerPlayerAvailable & System.IO.File.Exists(Config.GetFile(Config.Dir.Plugins,"ExternalPlayers","MPlayer_ExtPlayer.dll"))); + mplayerPlayerAvailable = (mplayerPlayerAvailable & System.IO.File.Exists(Config.GetFile(Config.Dir.Plugins, "ExternalPlayers", "MPlayer_ExtPlayer.dll"))); if (!mplayerPlayerAvailable) { GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); dlgOk.SetHeading("My MPlayer GUI"); @@ -240,7 +239,7 @@ } return base.OnMessage(message); } - + /// <summary> /// Tries to start the playback of an disc /// </summary> @@ -289,7 +288,7 @@ dlgOk.DoModal(GetID); return false; } - + /// <summary> /// Tries to start the playback of an internet stream /// </summary> @@ -305,7 +304,12 @@ if (g_Player.Playing) { g_Player.Stop(); } - g_Player.Play(keyboard.Text + ".mplayer"); + String url = keyboard.Text + ".mplayer"; + if (url.StartsWith("rtsp:")) { + url = "ZZZZ:" + url.Remove(0, 5); + } + + g_Player.Play(url); if (g_Player.Player != null && g_Player.IsVideo) { GUIGraphicsContext.IsFullScreenVideo = true; GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); @@ -314,7 +318,7 @@ } return false; } - + /// <summary> /// Handles click events of GUI controls /// </summary> @@ -404,8 +408,11 @@ //OnQueueItem(iItem); } } + if(control == btnDelete){ + OnAction(new Action(Action.ActionType.ACTION_DELETE_ITEM,0,0)); + } } - + /// <summary> /// Handles the click in the facadeview /// </summary> @@ -440,8 +447,8 @@ LoadDirectory(path); } else { string movieFileName = path + ".mplayer"; - if(movieFileName.StartsWith("rtsp:")){ - movieFileName = "ZZZZ:"+movieFileName.Remove(0,5); + if (movieFileName.StartsWith("rtsp:")) { + movieFileName = "ZZZZ:" + movieFileName.Remove(0, 5); } movieFileName = m_directory.GetLocalFilename(movieFileName); if (PlayListFactory.IsPlayList(movieFileName)) { @@ -456,7 +463,7 @@ return; } } - + /// <summary> /// Selects the current selected Item of the facadeView /// </summary> @@ -467,7 +474,7 @@ } UpdateButtonStates(); } - + /// <summary> /// Sorts the facadeView /// </summary> @@ -475,7 +482,7 @@ facadeView.Sort(new VideoSort(CurrentSortMethod, CurrentSortAsc)); UpdateButtonStates(); } - + /// <summary> /// Updates the labels of the button /// </summary> @@ -520,7 +527,7 @@ btnSortBy.IsAscending = CurrentSortAsc; } } - + /// <summary> /// Handles the page load event and initializes the plugin /// </summary> @@ -535,15 +542,15 @@ CurrentSortAsc = true; OnSort(); } - + /// <summary> /// Reads all extensions from external player plugin /// </summary> /// <returns>Lsit of all extensions</returns> private ArrayList getExtenstions() { - ArrayList extensions = new ArrayList() ; + ArrayList extensions = new ArrayList(); XmlDocument doc = new XmlDocument(); - string path = Config.GetFile(Config.Dir.Config,"MPlayer_ExtPlayer.xml"); + string path = Config.GetFile(Config.Dir.Config, "MPlayer_ExtPlayer.xml"); doc.Load(path); XmlNodeList listExtensions = doc.DocumentElement.SelectNodes("/mplayer/extensions/Extension"); foreach (XmlNode nodeExtension in listExtensions) { @@ -551,7 +558,7 @@ } return extensions; } - + /// <summary> /// Loads a playlist and starts the playback /// </summary> @@ -609,7 +616,6 @@ /// </summary> /// <param name="newFolderName">Name of the folder</param> private void LoadDirectory(string newFolderName) { - String _currentFolder = newFolderName; string objectCount = String.Empty; @@ -652,8 +658,23 @@ } OnSort(); } - /// <summary> + /// Overrides on action for deleting item + /// </summary> + /// <param name="action"></param> + public override void OnAction(Action action) { + if (action.wID == Action.ActionType.ACTION_DELETE_ITEM) { + GUIListItem item = facadeView.SelectedListItem; + if (item != null) { + if (!item.IsFolder) { + OnDeleteItem(item); + return; + } + } + } + base.OnAction(action); + } + /// <summary> /// Handles the event, when the Sorting method changes /// </summary> /// <param name="sender">Sender object</param> @@ -665,6 +686,145 @@ GUIControl.FocusControl(GetID, ((GUIControl)sender).GetID); } + /// <summary> + /// Deletes an item from the gui list + /// </summary> + /// <param name="item">item to delete</param> + private void OnDeleteItem(GUIListItem item) { + if (item.IsRemote) return; + if (!m_directory.RequestPin(item.Path)) { + return; + } + + string movieFileName = System.IO.Path.GetFileName(item.Path); + string movieTitle = movieFileName; + // delete single file + GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + if (null == dlgYesNo) return; + dlgYesNo.SetHeading(GUILocalizeStrings.Get(925)); + dlgYesNo.SetLine(1, movieTitle); + dlgYesNo.SetLine(2, String.Empty); + dlgYesNo.SetLine(3, String.Empty); + dlgYesNo.DoModal(GetID); + + if (!dlgYesNo.IsConfirmed) + return; + DoDeleteItem(item); + + int currentSelectedItem = facadeView.SelectedListItemIndex; + if (currentSelectedItem > 0) currentSelectedItem--; + LoadDirectory(virtualPath); + if (currentSelectedItem >= 0) { + GUIControl.SelectItemControl(GetID, facadeView.GetID, currentSelectedItem); + } + } + /// <summary> + /// Deletes the item + /// </summary> + /// <param name="item">Item to delete</param> + private void DoDeleteItem(GUIListItem item) { + if (item.IsFolder) { + if (item.IsRemote) return; + if (item.Label != "..") { + ArrayList items = new ArrayList(); + items = m_directory.GetDirectoryUnProtected(item.Path, false); + foreach (GUIListItem subItem in items) { + DoDeleteItem(subItem); + } + MediaPortal.Util.Utils.DirectoryDelete(item.Path); + } + } else { + if (item.IsRemote) return; + MediaPortal.Util.Utils.FileDelete(item.Path); + } + } + + + /// <summary> + /// Initialize the virtual directory + /// </summary> + private void initializeVirtualDirectory() { + sharePaths = new List<string>(); + m_directory.SetExtensions(getExtenstions()); + m_directory.Clear(); + if (useMyVideoShares) { + AddSection("movies"); + } + if (useMyMusicShares) { + AddSection("music"); + } + Share share = null; + XmlDocument doc = new XmlDocument(); + string path = Config.GetFile(Config.Dir.Config, "MPlayer_GUIPlugin.xml"); + doc.Load(path); + XmlNodeList listShare = doc.DocumentElement.SelectNodes("/mplayergui/Share"); + foreach (XmlNode nodeShare in listShare) { + share = new Share(); + share.Name = nodeShare.Attributes["name"].Value; + share.Path = nodeShare.Attributes["path"].Value; + if (!sharePaths.Contains(share.Path.ToLower())) { + sharePaths.Add(share.Path.ToLower()); + m_directory.Add(share); + } + } + } + + /// <summary> + /// Adds a section of MP shares + /// </summary> + /// <param name="section">Name of the section</param> + private void AddSection(String section) { + Share defaultshare = null; + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { + string strDefault = xmlreader.GetValueAsString(section, "default", String.Empty); + for (int i = 0; i < 20; i++) { + string strShareName = String.Format("sharename{0}", i); + string strSharePath = String.Format("sharepath{0}", i); + string strPincode = String.Format("pincode{0}", i); + + string shareType = String.Format("sharetype{0}", i); + string shareServer = String.Format("shareserver{0}", i); + string shareLogin = String.Format("sharelogin{0}", i); + string sharePwd = String.Format("sharepassword{0}", i); + string sharePort = String.Format("shareport{0}", i); + string remoteFolder = String.Format("shareremotepath{0}", i); + string shareViewPath = String.Format("shareview{0}", i); + + Share share = new Share(); + share.Name = xmlreader.GetValueAsString(section, strShareName, String.Empty); + share.Path = xmlreader.GetValueAsString(section, strSharePath, String.Empty); + + string pinCode = MediaPortal.Util.Utils.DecryptPin(xmlreader.GetValueAsString(section, strPincode, string.Empty)); + if (pinCode != string.Empty) + share.Pincode = Convert.ToInt32(pinCode); + else + share.Pincode = -1; + + share.IsFtpShare = xmlreader.GetValueAsBool(section, shareType, false); + share.FtpServer = xmlreader.GetValueAsString(section, shareServer, String.Empty); + share.FtpLoginName = xmlreader.GetValueAsString(section, shareLogin, String.Empty); + share.FtpPassword = xmlreader.GetValueAsString(section, sharePwd, String.Empty); + share.FtpPort = xmlreader.GetValueAsInt(section, sharePort, 21); + share.FtpFolder = xmlreader.GetValueAsString(section, remoteFolder, "/"); + share.DefaultView = (Share.Views)xmlreader.GetValueAsInt(section, shareViewPath, (int)Share.Views.List); + + if (share.Name.Length > 0) { + + if (strDefault == share.Name) { + share.Default = true; + if (defaultshare == null) { + defaultshare = share; + } + } + + if (!sharePaths.Contains(share.Path.ToLower())) { + sharePaths.Add(share.Path.ToLower()); + m_directory.Add(share); + } + } else break; + } + } + } #endregion #region IShowPlugin Member Modified: trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/BlueTwo 16x9/myMPlayer.xml =================================================================== --- trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/BlueTwo 16x9/myMPlayer.xml 2007-03-09 07:46:47 UTC (rev 169) +++ trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/BlueTwo 16x9/myMPlayer.xml 2007-03-09 13:23:31 UTC (rev 170) @@ -40,7 +40,13 @@ <id>5</id> <label>Play Stream</label> </control> - </control> + <control> + <description>Delete Item</description> + <type>button</type> + <id>5</id> + <label>Delete Item</label> + </control> + </control> <import>common.facade.video.xml</import> </controls> </window> \ No newline at end of file Modified: trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/BlueTwo 4x3/myMPlayer.xml =================================================================== --- trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/BlueTwo 4x3/myMPlayer.xml 2007-03-09 07:46:47 UTC (rev 169) +++ trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/BlueTwo 4x3/myMPlayer.xml 2007-03-09 13:23:31 UTC (rev 170) @@ -40,7 +40,13 @@ <id>5</id> <label>Play Stream</label> </control> - </control> + <control> + <description>Delete Item</description> + <type>button</type> + <id>7</id> + <label>Delete Item</label> + </control> + </control> <import>common.facade.video.xml</import> </controls> </window> \ No newline at end of file Modified: trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/PM III/myMPlayer.xml =================================================================== --- trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/PM III/myMPlayer.xml 2007-03-09 07:46:47 UTC (rev 169) +++ trunk/plugins/My MPlayer/MPlayer_GUIPlugin/SkinFiles/PM III/myMPlayer.xml 2007-03-09 13:23:31 UTC (rev 170) @@ -117,8 +117,21 @@ <alignY>center</alignY> </control> + <control> + <description>Delete Item</description> - </control> + <type>button</type> + + <id>7</id> + + <label>Delete Item</label> + + <textXOff>17</textXOff> + + <alignY>center</alignY> + </control> + + </control> <control> <type>group</type> Modified: trunk/plugins/My MPlayer/Readme.pdf =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |