Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check my changes #5

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified AirPortal.suo
Binary file not shown.
49 changes: 47 additions & 2 deletions Source/AirPortal/AirPortal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
using MediaPortal.Player;
using System.IO;
using System.Drawing.Imaging;

using MediaPortal.Dialogs;



namespace AirPortal
{
public class AirPortal : ISetupForm, IPlugin
Expand All @@ -37,6 +40,8 @@ public class AirPortal : ISetupForm, IPlugin
NetService publishService = null;
Server theServer = null;



/// <summary>
/// Mediaportal log type
/// </summary>
Expand Down Expand Up @@ -319,11 +324,28 @@ void theServer_playURL(object sender, string url, double position)
position = 0;
}

if (GUIWindowManager.ActiveWindow != DISPLAY_WINDOW_ID)
{


GUIGraphicsContext.ResetLastActivity();
GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, DISPLAY_WINDOW_ID, 0, null);
GUIWindowManager.SendThreadMessage(msg);
}
GUIMessage msg1 = new GUIMessage();
msg1.Label = "video";
msg1.Label2 = url;
msg1.Label3 = position.ToString();
msg1.SendToTargetWindow = true;
msg1.TargetWindowId = DISPLAY_WINDOW_ID;
msg1.Message = GUIMessage.MessageType.GUI_MSG_LABEL_ADD;

GUIWindowManager.SendThreadMessage(msg1);
//g_Player.Play(url, g_Player.MediaType.Video);

AirPortal.LogMessage("AirPortal wants to display an video ...", LogType.Debug);
//sendPlaybackEvent("playUrl", url, position.ToString());
theServer.sendStatusMessage("loading");
}

/// <summary>
/// Conforms to the delegate that the Server uses to sent the playImage event.
/// Calls the setPictureBoxPicture() method to set the image in a thread-safe way. setPictureBoxPicture() also hides the video players and shows the picturebox
Expand All @@ -334,6 +356,8 @@ void theServer_playImage(object sender, Image theImage)
{
AirPortal.LogMessage("AirPortal wants to display an image ...", LogType.Debug);



// Create temp folder if it doesn't exist
if (!Directory.Exists(Path.GetTempPath() + PLUGIN_NAME))
{
Expand Down Expand Up @@ -380,6 +404,17 @@ void theServer_playImage(object sender, Image theImage)
GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, DISPLAY_WINDOW_ID, 0, null);
GUIWindowManager.SendThreadMessage(msg);
}
/*else{
GUIMessage msg = new GUIMessage();
msg.Label = tempFileName;
msg.SendToTargetWindow = true;
msg.TargetWindowId = DISPLAY_WINDOW_ID;
msg.Message = GUIMessage.MessageType.GUI_MSG_LABEL_ADD;

GUIWindowManager.SendThreadMessage(msg);
}
*/

}

/// <summary>
Expand All @@ -392,7 +427,17 @@ void theServer_playImage(object sender, Image theImage)
/// <param name="param">Any extra data that might go with that action (eg the seek position)</param>
void theServer_playbackEvent(object sender, string action, string param)
{
AirPortal.LogMessage("Action: " + action + " Param: " + param, LogType.Debug);
//sendPlaybackEvent(action, param); //pass it on to the thread-safe method.
GUIMessage msg1 = new GUIMessage();
msg1.Label = "action";
msg1.Label2 = action;
msg1.Label3 = param;
msg1.SendToTargetWindow = true;
msg1.TargetWindowId = DISPLAY_WINDOW_ID;
msg1.Message = GUIMessage.MessageType.GUI_MSG_LABEL_ADD;

GUIWindowManager.SendThreadMessage(msg1);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Source/AirPortal/AirPortal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>call "$(TargetDir)merge.bat"
copy "$(TargetPath)" "C:\Program Files (x86)\Team MediaPortal\MediaPortal\plugins\process\$(TargetFileName)"</PostBuildEvent>
copy "$(TargetPath)" "C:\Archivos de programa\Team MediaPortal\MediaPortal\plugins\process\$(TargetFileName)"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
2 changes: 1 addition & 1 deletion Source/AirPortal/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ private void handleMessageReceived(NetworkStream clientStream, string message, b
if (array.Count() > 1)
{
url = array[0].Trim();
AirPortal.LogMessage("Attempting to play URL" + url, AirPortal.LogType.Debug);
AirPortal.LogMessage("Attempting to play URL " + url, AirPortal.LogType.Debug);

//get the start position
double start = 0;
Expand Down
107 changes: 106 additions & 1 deletion Source/AirPortalDisplay/AirPortalDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
using MediaPortal.Dialogs;
using MediaPortal.Player;
using System.Text.RegularExpressions;
using System.Drawing;



namespace AirPortalDisplay
{
Expand All @@ -16,7 +19,11 @@ public class AirPortalDisplay : GUIWindow, ISetupForm
public const string LOG_PREFIX = "[AIRPORTAL_DISPLAY] ";
public const int WINDOW_ID = 1514;

/* int xres;
WebBrowser PlayNowWindow;
*/

bool bplaying = false;

public string PluginName()
{
Expand Down Expand Up @@ -64,7 +71,7 @@ public bool GetHome(out string strButtonText, out string strButtonImage, out str
strButtonImage = String.Empty;
strButtonImageFocus = String.Empty;
strPictureImage = String.Empty;

bplaying = false;
return false;
}

Expand All @@ -81,6 +88,7 @@ public override int GetID
// Plugin initialised, load skin file
public override bool Init()
{
bplaying = false;
return Load(GUIGraphicsContext.Skin+@"\airportaldisplay.xml");
}

Expand All @@ -94,5 +102,102 @@ protected override void OnPageDestroy(int new_windowId)
}
base.OnPageDestroy(new_windowId);
}
private void GUIWindowManager_OnNewMessage(GUIMessage message)
{
Log.Debug(message.Message.ToString());
}
public override bool OnMessage(GUIMessage message)
{

if (message.Message == GUIMessage.MessageType.GUI_MSG_LABEL_ADD && message.Label == "video")
{
Log.Debug(message.Message.ToString());
//MessageBox.Show(message.Label);
//playvideo(message.Label2);

g_Player.FullScreen = true;

if (g_Player.PlayVideoStream(message.Label2))
{
bplaying = true;
}
else
{

if (g_Player.Play(message.Label2, g_Player.MediaType.Video))
{
bplaying = true;
}

}


g_Player.ShowFullScreenWindowVideoDefault();
GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null);
msg.Label = message.Label2;
GUIWindowManager.SendThreadMessage(msg);
return true;
}
else if (message.Message == GUIMessage.MessageType.GUI_MSG_LABEL_ADD && message.Label == "action")
{
if (bplaying)
{
if (message.Label2.Equals("pause"))
{

Log.Debug("pausing player");
g_Player.Pause();
}
else if (message.Label2.Equals("play"))
{
Log.Debug("playing player");
//g_Player.p
}
else if (message.Label2.Equals("stop"))
{
Log.Debug("stopping player");
g_Player.Stop();
bplaying = false;
}
else if (message.Label2.Equals("scrub"))
{
if (message.Label3.Length > 0)//if the scrub position exists in the paramters (should be first arg)...
{

//g_Player.CurrentPosition = Convert.ToDouble(message.Label3[0]);
int ipercent = (int) Convert.ToDouble(message.Label3)*100;
g_Player.SeekAsolutePercentage(ipercent);
}
}
}
return true;
}
else
{
return base.OnMessage(message);
}


}
/* using a web browser to play the movie
public void playvideo( string url)
{
PlayNowWindow = new WebBrowser();
PlayNowWindow.Url = new Uri (url);
PlayNowWindow.Name = "PlayNowWindow";
PlayNowWindow.Size = new Size(800, 500);
PlayNowWindow.Location = new Point(0, 145);
GUIGraphicsContext.form.Controls.Add(PlayNowWindow);
PlayNowWindow.Visible = true;

PlayNowWindow.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(PlayNowWindow_DocumentCompleted);
GUIGraphicsContext.form.Focus();



}
void PlayNowWindow_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{ }
*/
}
}
3 changes: 2 additions & 1 deletion Source/AirPortalDisplay/AirPortalDisplay.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
Expand All @@ -60,7 +61,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "C:\Program Files (x86)\Team MediaPortal\MediaPortal\plugins\Windows\$(TargetFileName)"</PostBuildEvent>
<PostBuildEvent>copy "$(TargetPath)" "C:\Archivos de programa\Team MediaPortal\MediaPortal\plugins\Windows\$(TargetFileName)"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down