From: <mis...@us...> - 2007-11-03 15:21:10
|
Revision: 1020 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1020&view=rev Author: misterd_sf Date: 2007-11-03 08:21:08 -0700 (Sat, 03 Nov 2007) Log Message: ----------- Fixed external osd was displayed, even when playing music Fixed playlist handling Added possibility to treat playlist as folders Modified Paths: -------------- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationPanel/GeneralSection.Designer.cs trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.Designer.cs trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationPanel/GUIConfiguration.Designer.cs trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationPanel/GUIConfiguration.cs trunk/plugins/My MPlayer/MPlayer_GUIPlugin/MPlayer_GUIPlugin.cs Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs 2007-11-03 12:48:07 UTC (rev 1019) +++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs 2007-11-03 15:21:08 UTC (rev 1020) @@ -815,13 +815,51 @@ #region public methods /// <summary> + /// Checks if the fileName has a video or not + /// </summary> + /// <param name="fileName">Filename to check</param> + /// <returns>true, when file or stream has a video</returns> + public bool HasFileOrStreamVideo(String fileName) { + bool isVideo = false; + if (fileName.StartsWith("dvd://")) { + isVideo = true; + } else if (fileName.StartsWith("vcd://")) { + isVideo = true; + } else if (fileName.StartsWith("svcd://")) { + isVideo = true; + } else if (fileName.StartsWith("cue://") || + fileName.StartsWith("ftp://") || + fileName.StartsWith("http://") || + fileName.StartsWith("http_proxy://") || + fileName.StartsWith("mms://") || + fileName.StartsWith("mmst://") || + fileName.StartsWith("mpst://") || + fileName.StartsWith("rtp://") || + fileName.StartsWith("rtsp://") || + fileName.StartsWith("sdp://") || + fileName.StartsWith("udp://") || + fileName.StartsWith("unsv://")) { + if (_extensionSettings.ContainsKey(System.IO.Path.GetExtension(fileName))) { + isVideo = _extensionSettings[System.IO.Path.GetExtension(fileName)].PlayMode == PlayMode.Video; + } else { + isVideo = true; + } + } else if (fileName.EndsWith(".cda")) { + isVideo = false; + } else { + ExtensionSettings extSettings = _extensionSettings[System.IO.Path.GetExtension(fileName).Trim().ToLower()]; + isVideo = (extSettings.PlayMode == PlayMode.Video); + } + return isVideo; + } + + /// <summary> /// Creates a process object and sets the starting arguments /// </summary> /// <param name="fileName">FileName that should be started</param> /// <param name="handle">Handle of inner panel</param> - /// <param name="isVideo">Boolean for indicating if file is video</param> /// <returns>UpdateGUI object</returns> - public Process createProcessForFileName(String fileName, IntPtr handle, out bool isVideo) { + public Process createProcessForFileName(String fileName, IntPtr handle) { Process mplayerProcess = new Process(); mplayerProcess.StartInfo.UseShellExecute = false; mplayerProcess.StartInfo.RedirectStandardInput = true; @@ -840,21 +878,18 @@ arguments.Append(" -slang "); arguments.Append(CultureInfo.CurrentCulture.TwoLetterISOLanguageName); arguments.Append(" dvd://"); - isVideo = true; } else if (fileName.StartsWith("vcd://")) { String file = fileName.Substring(6); arguments.Append(_extensionSettings["vcd://"].Arguments); arguments.Append(" \"vcd://"); arguments.Append(file); arguments.Append("\""); - isVideo = true; } else if (fileName.StartsWith("svcd://")) { String file = fileName.Substring(7); arguments.Append(_extensionSettings["svcd://"].Arguments); arguments.Append(" \"vcd://"); arguments.Append(file); arguments.Append("\""); - isVideo = true; } else if (fileName.StartsWith("cue://") || fileName.StartsWith("ftp://") || fileName.StartsWith("http://") || @@ -875,9 +910,6 @@ arguments.Append(_extensionSettings[protocol].Arguments); if (_extensionSettings.ContainsKey(System.IO.Path.GetExtension(fileName))) { arguments.Append(_extensionSettings[System.IO.Path.GetExtension(fileName)].Arguments); - isVideo = _extensionSettings[System.IO.Path.GetExtension(fileName)].PlayMode == PlayMode.Video; - } else { - isVideo = true; } arguments.Append(" \""); arguments.Append(protocol); @@ -895,14 +927,12 @@ arguments.Append(" -cdrom-device "); arguments.Append(drive); arguments.Append(" "); - isVideo = false; } else { ExtensionSettings extSettings = _extensionSettings[System.IO.Path.GetExtension(fileName).Trim().ToLower()]; arguments.Append(extSettings.Arguments); arguments.Append(" \""); arguments.Append(fileName); arguments.Append("\" "); - isVideo = (extSettings.PlayMode == PlayMode.Video); } arguments.Append(getScreenArguments()); Log.Info("MPlayer: All Arguments: " + arguments); Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationPanel/GeneralSection.Designer.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationPanel/GeneralSection.Designer.cs 2007-11-03 12:48:07 UTC (rev 1019) +++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationPanel/GeneralSection.Designer.cs 2007-11-03 15:21:08 UTC (rev 1020) @@ -202,10 +202,10 @@ this.externalOSDLibraryBlank.CheckState = System.Windows.Forms.CheckState.Checked; this.externalOSDLibraryBlank.Location = new System.Drawing.Point(6, 31); this.externalOSDLibraryBlank.Name = "externalOSDLibraryBlank"; - this.externalOSDLibraryBlank.Size = new System.Drawing.Size(345, 30); + this.externalOSDLibraryBlank.Size = new System.Drawing.Size(354, 30); this.externalOSDLibraryBlank.TabIndex = 0; - this.externalOSDLibraryBlank.Text = "Blank screen in fullscreen\r\n(If you see black screen in fullscreen, you should tu" + - "rn this option off)"; + this.externalOSDLibraryBlank.Text = "Blank screen in fullscreen\r\n(If you see a black screen in fullscreen, you should " + + "turn this option off)"; this.externalOSDLibraryBlank.UseVisualStyleBackColor = true; // // GeneralSection Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs 2007-11-03 12:48:07 UTC (rev 1019) +++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs 2007-11-03 15:21:08 UTC (rev 1020) @@ -218,16 +218,16 @@ bool result; bool controlAdded = false; try { - initSystem(); if (strFile.EndsWith(".mplayer")) { strFile = strFile.Remove(strFile.LastIndexOf(".mplayer")); } if (strFile.StartsWith("ZZZZ:")) { strFile = "rtsp:" + strFile.Remove(0, 5); } + bool isVideo = _configManager.HasFileOrStreamVideo(strFile); + initSystem(isVideo); _currentFile = strFile; - bool isVideo; - _mplayerProcess = _configManager.createProcessForFileName(strFile, _videoHandler.GetVideoHandle(), out isVideo); + _mplayerProcess = _configManager.createProcessForFileName(strFile, _videoHandler.GetVideoHandle()); _videoHandler.HasVideo = isVideo; if (isVideo) { _isVisible = true; @@ -407,9 +407,10 @@ /// <summary> /// Initialize the system (Objects, Controls etc.) /// </summary> - private void initSystem() { + /// <param name="isVideo">Ind\xEDcate if the file has video</param> + private void initSystem(bool isVideo) { _playState = PlayState.Playing; - if (_configManager.OsdMode == OSDMode.InternalMPlayer) { + if (_configManager.OsdMode == OSDMode.InternalMPlayer || !isVideo) { _osdHandler = new InternalOSDHandler(this,true); } else if (_configManager.OsdMode == OSDMode.ExternalOSDLibrary) { _osdHandler = new ExternalOSDLibrary(this); Modified: trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.Designer.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.Designer.cs 2007-11-03 12:48:07 UTC (rev 1019) +++ trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationForm.Designer.cs 2007-11-03 15:21:08 UTC (rev 1020) @@ -53,7 +53,7 @@ // // okButton // - this.okButton.Location = new System.Drawing.Point(12, 307); + this.okButton.Location = new System.Drawing.Point(12, 330); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 3; @@ -64,7 +64,7 @@ // cancelButton // this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.cancelButton.Location = new System.Drawing.Point(334, 307); + this.cancelButton.Location = new System.Drawing.Point(334, 330); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(75, 23); this.cancelButton.TabIndex = 20; @@ -77,13 +77,13 @@ this.guiConfiguration1.BackColor = System.Drawing.Color.Transparent; this.guiConfiguration1.Location = new System.Drawing.Point(12, 5); this.guiConfiguration1.Name = "guiConfiguration1"; - this.guiConfiguration1.Size = new System.Drawing.Size(402, 296); + this.guiConfiguration1.Size = new System.Drawing.Size(402, 319); this.guiConfiguration1.TabIndex = 21; // // ConfigurationForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(421, 343); + this.ClientSize = new System.Drawing.Size(421, 367); this.Controls.Add(this.guiConfiguration1); this.Controls.Add(this.cancelButton); this.Controls.Add(this.okButton); Modified: trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationPanel/GUIConfiguration.Designer.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationPanel/GUIConfiguration.Designer.cs 2007-11-03 12:48:07 UTC (rev 1019) +++ trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationPanel/GUIConfiguration.Designer.cs 2007-11-03 15:21:08 UTC (rev 1020) @@ -38,6 +38,7 @@ this.pluginName = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); + this.playlistFolder = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -183,18 +184,29 @@ // this.folderBrowserDialog1.Description = "Select the recording folder:"; // + // playlistFolder + // + this.playlistFolder.AutoSize = true; + this.playlistFolder.Location = new System.Drawing.Point(7, 292); + this.playlistFolder.Name = "playlistFolder"; + this.playlistFolder.Size = new System.Drawing.Size(139, 17); + this.playlistFolder.TabIndex = 46; + this.playlistFolder.Text = "Treat Playlists as folders"; + this.playlistFolder.UseVisualStyleBackColor = true; + // // GUIConfiguration // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Transparent; + this.Controls.Add(this.playlistFolder); 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.Name = "GUIConfiguration"; - this.Size = new System.Drawing.Size(402, 296); + this.Size = new System.Drawing.Size(402, 322); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); @@ -219,5 +231,6 @@ private System.Windows.Forms.TextBox pluginName; private System.Windows.Forms.Label label2; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; + private System.Windows.Forms.CheckBox playlistFolder; } } Modified: trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationPanel/GUIConfiguration.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationPanel/GUIConfiguration.cs 2007-11-03 12:48:07 UTC (rev 1019) +++ trunk/plugins/My MPlayer/MPlayer_GUIPlugin/ConfigurationPanel/GUIConfiguration.cs 2007-11-03 15:21:08 UTC (rev 1020) @@ -149,6 +149,7 @@ pluginName.Text = xmlreader.GetValueAsString("mplayer", "displayNameOfGUI", "My MPlayer GUI"); myVideoShare.Checked = xmlreader.GetValueAsBool("mplayer", "useMyVideoShares", true); myMusicShare.Checked = xmlreader.GetValueAsBool("mplayer", "useMyMusicShares", true); + playlistFolder.Checked = xmlreader.GetValueAsBool("mplayer", "treatPlaylistAsFolders", false); } } catch (Exception e) { Log.Info("MPlayer GUI Error: Configuration could not be loaded: " + e.Message); @@ -187,6 +188,7 @@ } xmlWriter.SetValueAsBool("mplayer", "useMyMusicShares", myMusicShare.Checked); xmlWriter.SetValueAsBool("mplayer", "useMyVideoShares", myVideoShare.Checked); + xmlWriter.SetValueAsBool("mplayer", "treatPlaylistAsFolders", playlistFolder.Checked); } } #endregion Modified: trunk/plugins/My MPlayer/MPlayer_GUIPlugin/MPlayer_GUIPlugin.cs =================================================================== --- trunk/plugins/My MPlayer/MPlayer_GUIPlugin/MPlayer_GUIPlugin.cs 2007-11-03 12:48:07 UTC (rev 1019) +++ trunk/plugins/My MPlayer/MPlayer_GUIPlugin/MPlayer_GUIPlugin.cs 2007-11-03 15:21:08 UTC (rev 1020) @@ -145,18 +145,26 @@ /// 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; + + /// <summary> + /// Indicates if playlists should be treat as folders + /// </summary> + private bool treatPlaylistsAsFolders; #endregion #region ctor @@ -177,6 +185,7 @@ displayName = xmlreader.GetValueAsString("mplayer", "displayNameOfGUI", "My MPlayer"); useMyVideoShares = xmlreader.GetValueAsBool("mplayer", "useMyVideoShares", true); useMyMusicShares = xmlreader.GetValueAsBool("mplayer", "useMyMusicShares", true); + treatPlaylistsAsFolders = xmlreader.GetValueAsBool("mplayer", "treatPlaylistAsFolders", false); String m_strLanguage = xmlreader.GetValueAsString("skin", "language", "English"); LocalizeStrings.Load(m_strLanguage); } @@ -449,15 +458,15 @@ virtualPath = path; LoadDirectory(path); } else { + if (PlayListFactory.IsPlayList(path)) { + LoadPlayList(path); + return; + } string movieFileName = path + ".mplayer"; if (movieFileName.StartsWith("rtsp:")) { movieFileName = "ZZZZ:" + movieFileName.Remove(0, 5); } movieFileName = m_directory.GetLocalFilename(movieFileName); - if (PlayListFactory.IsPlayList(movieFileName)) { - LoadPlayList(movieFileName); - return; - } g_Player.Play(movieFileName); if (g_Player.IsVideo) { GUIGraphicsContext.IsFullScreenVideo = true; @@ -544,9 +553,9 @@ } CurrentSortAsc = true; OnSort(); - GUIControl.SetControlLabel(GetID, btnPlayStream.GetID,LocalizeStrings.Get((int)LocalizedMessages.PlayStream)); + GUIControl.SetControlLabel(GetID, btnPlayStream.GetID, LocalizeStrings.Get((int)LocalizedMessages.PlayStream)); GUIControl.SetControlLabel(GetID, btnPlayDisc.GetID, LocalizeStrings.Get((int)LocalizedMessages.PlayDisc)); - GUIControl.SetControlLabel(GetID, btnDelete.GetID, LocalizeStrings.Get((int)LocalizedMessages.Delete)); + GUIControl.SetControlLabel(GetID, btnDelete.GetID, LocalizeStrings.Get((int)LocalizedMessages.Delete)); } /// <summary> @@ -583,10 +592,13 @@ } return; } - if (playlist.Count == 1) { - if (g_Player.Play(playlist[0].FileName + ".mplayer")) { - if (MediaPortal.Util.Utils.IsVideo(playlist[0].FileName)) { + 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)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); } @@ -597,8 +609,13 @@ playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Clear(); for (int i = 0; i < playlist.Count; ++i) { - playlist[i].FileName += ".mplayer"; + 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); } @@ -606,13 +623,13 @@ if (playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO).Count > 0) { playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO); PlayListItem item = playlist[0]; - playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO; playlistPlayer.Reset(); playlistPlayer.Play(0); - if (GetID == GUIWindowManager.ActiveWindow) { - GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_VIDEO_PLAYLIST); + if (g_Player.Player != null && g_Player.IsVideo) { + GUIGraphicsContext.IsFullScreenVideo = true; + GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO); } } } @@ -641,7 +658,7 @@ if (String.Compare(item1.Path, item2.Path, true) > 0) { addItem = false; // Update to reflect the stacked size - item2.FileInfo.Length += item1.FileInfo.Length; + item1.FileInfo.Length += item2.FileInfo.Length; } } } @@ -654,11 +671,32 @@ MediaPortal.Util.Utils.RemoveStackEndings(ref label); item1.Label = label; + if (treatPlaylistsAsFolders && PlayListFactory.IsPlayList(item1.Path)) { + item1.IsFolder = true; + Utils.SetDefaultIcons(item1); + } itemfiltered.Add(item1); } } itemlist = itemfiltered; + if (treatPlaylistsAsFolders && PlayListFactory.IsPlayList(newFolderName)) { + IPlayListIO loader = PlayListFactory.CreateIO(newFolderName); + PlayList playlist = new PlayList(); + + if (loader.Load(playlist, newFolderName)) { + GUIListItem item; + foreach (PlayListItem plItem in playlist) { + item = new GUIListItem(); + item.Path = plItem.FileName; + item.Label = plItem.Description; + item.IsFolder = false; + Utils.SetDefaultIcons(item); + itemlist.Add(item); + } + } + } + foreach (GUIListItem item in itemlist) { facadeView.Add(item); } @@ -752,6 +790,9 @@ private void initializeVirtualDirectory() { sharePaths = new List<string>(); m_directory.SetExtensions(getExtenstions()); + m_directory.AddExtension(".pls"); + m_directory.AddExtension(".m3u"); + m_directory.Clear(); if (useMyVideoShares) { AddSection("movies"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |