Page 1 of 1

MCEPopups.0.3

Posted: Sun Jul 31, 2011 5:26 pm
by nxsfan
MCEPopups is a MCE background add in that opens up port 1982 and waits for specially formatted text strings.

As of version 0.3 it has the following capability:

Dialogs - Generate interactive dialogs and receive a response.
Query - Query whether it is playing content.
Control - Play, Pause or stop content.

Variables within the input string must be | separated.

Dialogs

The current options available are:
// 0. Custom Buttons, time, message, title, optional image
// 1. Simple passive dialog, time, message, title
// 2. Simple passive dialog, time, message, title, image
// 3. Simple interactive dialog (ok cancel), time, message, title
// 4. Simple interactive dialog (ok cancel), time, message, title, image

where time is the delay before hiding the dialog. The useful thing about this addin is that it sends the pressed button back to the source. This means that you can write a program in python, generate a dialog in media center and find out what the user selected (or if the message timed out).

The following python program generates the dialog, which displays for a maximum of 30 seconds and then displays the user response.

Code: Select all

import socket
TCP_IP = '127.0.0.1'
TCP_PORT = 1982
BUFFER_SIZE = 4096
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
MESSAGE = "Dialog|3|30|Hello MCE User|This is a message!"
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
data = s.recv(BUFFER_SIZE)
print data
The variable data contains the response of the user and in this case will be "Ok", "Cancel" or "Timeout", based on whether the user hit Ok, Cancel or did nothing.

Custom Buttons:

MCEPopups allows user defined buttons and will return the text string specified for the label of the selected button. Buttons are ":" separated. The text string required to generate the following popup (without the thumbnail) would be:
MESSAGE = "Dialog|0|Video:Voice:Reject|30|Incoming call from nxsfan-mobile|ACCEPT THE CALL?"
Image
Selecting Voice would return the text string "Voice"


Query

The query capability is extremely simple. Currently the only option is Query -> Playstate. The input string needs to be formatted as "Query|Playstate".
It will return Playing, Paused or null if there is no loaded content.
I will probably added metadata query functionality later (but currently have no need for it).

NB I am not using MSAS. I don't have the MSAS sample namespace working in C#2010. Not sure if it is required for advanced functionality now it is deprecated? Input would be useful.

Control

Control is also very simple. You can Play, Pause or Stop the Media Center
"Control|Play", etc.

Download

You can download the addin here: http://nxsfan.co.uk/MCEPopups/MCEPopups.0.3.msi

Please request features, provide feedback, etc.

Changelog
0.3 - Add capability for custom buttons
0.2 - Add media query and media control options

Re: MCEPopups.0.2

Posted: Wed Aug 03, 2011 2:48 am
by w84no1
If you made it so that commands could be sent via http and responses returned as json, that would be awesome.

Re: MCEPopups.0.2

Posted: Wed Aug 03, 2011 4:21 pm
by nxsfan
w84no1 wrote:If you made it so that commands could be sent via http and responses returned as json, that would be awesome.
I should be able to do something like that. So indulge my amaturity. You would call the url:

Code: Select all

 http://localhost:1980?option[0]=Dialog&option[1]=3&option[2]&option[3]=30&option[4]=Hello MCE User&option[5]=This is a message! 
(lets pretend it's URL formatted at both ends).

And I return something like:

Code: Select all

[{"Result":"Ok"}]
or a bigger key-value set for now playing metadata etc.

Is this what you are after? I realise if I do set up something like this I could allow the user to remote control media center, see now playing, etc. from a browser, via a few simple pages. Not sure if there is any demand for that. Probably something similar already exists.

Re: MCEPopups.0.2

Posted: Wed Aug 03, 2011 7:26 pm
by w84no1
nxsfan wrote:
w84no1 wrote:If you made it so that commands could be sent via http and responses returned as json, that would be awesome.
I should be able to do something like that. So indulge my amaturity. You would call the url:

Code: Select all

 http://localhost:1980?option[0]=Dialog&option[1]=3&option[2]&option[3]=30&option[4]=Hello MCE User&option[5]=This is a message! 
(lets pretend it's URL formatted at both ends).

And I return something like:

Code: Select all

[{"Result":"Ok"}]
or a bigger key-value set for now playing metadata etc.

Is this what you are after? I realise if I do set up something like this I could allow the user to remote control media center, see now playing, etc. from a browser, via a few simple pages. Not sure if there is any demand for that. Probably something similar already exists.
I was using vmccontroller to do most of the now playing medadata and basic control, but it is not fully functional with Windows 7. For now I would use MCEPopups to create custom web-based controls for each room and a way for me to send messages to people watching TV in other rooms. The now playing stuff would be cool later on.

Re: MCEPopups.0.2

Posted: Thu Aug 04, 2011 1:16 am
by nxsfan
OK, I'll have a play this weekend (xbox not playing nice with the media center right now).

Re: MCEPopups.0.3

Posted: Sun Aug 28, 2011 2:29 am
by w84no1
Any updates?

Re: MCEPopups.0.3

Posted: Thu Jan 12, 2012 2:39 pm
by _T_
Is this still being developed? I have some ideas / suggestions.

Re: MCEPopups.0.3

Posted: Thu Jan 12, 2012 3:05 pm
by w84no1
_T_ wrote:Is this still being developed? I have some ideas / suggestions.
I am still interested, also.

Re: MCEPopups.0.3

Posted: Sat Jan 14, 2012 8:09 pm
by nxsfan
I haven't added anything since 0.3.

I spent a while looking at Growl support so you can receive notifications from other machines, your cell phone, etc., but I ran out of steam. I would still like to add a web interface, but it could add a lot of bloat to the plugin; I thought about leaving the code as is and writing an additional standalone program that provides the web service so you can send notifications via an html form for those people that need it.

So that's where I am, fire away with your suggestions :)

EDIT: Also where did the last 5 months go?!

Re: MCEPopups.0.3

Posted: Sun Jan 15, 2012 1:53 am
by _T_
I just decided to write it myself. Thanks anyway though!

Re: MCEPopups.0.3

Posted: Sun Jan 15, 2012 7:37 pm
by w84no1
_T_ wrote:I just decided to write it myself. Thanks anyway though!

Can you share?

Re: MCEPopups.0.3

Posted: Sun Jan 15, 2012 11:12 pm
by _T_
Well what I'm working on, I really have no need for the socket or any way for it to receive the command to pop a messagebox at all for that matter. My case is better suited reading from a database of entries and is the direction it has taken.

If you do indeed need the socket and ability to send it commands, here is a tutorial that results in 90% the functionality of what the OP had. You can use that and in the HandleClientComm void get tcpclient.Request.RawUrl. Expect a client to be requesting a url like http://localhost:8080/Dialog|3|30|Hello ... %20message!. Something formatted like he mentioned in the part about the python script. That will give you a way to pass a few basic string commands, enough to pop a messagebox.

That should get you going.

Re: MCEPopups.0.3

Posted: Thu Jan 19, 2012 2:32 pm
by Napkinbob
Hi, I've been working on an app which make use of MCEPopups.0.3, but it only works if windows firewall is off (on the MC machine)

Do you have any thoughts on how I can allow an exception in the firewall for MCEPopups?

Thanks

Re: MCEPopups.0.3

Posted: Thu Jan 19, 2012 2:35 pm
by sccrgoalie1
Napkinbob wrote:Hi, I've been working on an app which make use of MCEPopups.0.3, but it only works if windows firewall is off (on the MC machine)

Do you have any thoughts on how I can allow an exception in the firewall for MCEPopups?

Thanks
Looks like you need to open port 1982.

Re: MCEPopups.0.3

Posted: Thu Jan 19, 2012 4:38 pm
by Napkinbob
sccrgoalie1 wrote: Looks like you need to open port 1982.
Yeah, I guess that's pretty obvious now that I think about it :oops:

I was convinced it was a problem with my router and was banging my head with that one so I kinda forgot how to reason by the time I figured out it was the windows firewall!

Thanks for the pointer.

Re: MCEPopups.0.3

Posted: Mon Jan 23, 2012 11:56 pm
by Napkinbob
Image Control.

What is the syntax for displaying an image in a dialog (types 0, 2, or 4).

does the image need to be converted to bytes and sent along, or is it a reference to an image already on media center machine (or a url). Sorry if youve documented this and I've overlooked it, but I can't find it anywhere.

Re: MCEPopups.0.3

Posted: Wed Jan 25, 2012 7:00 pm
by nxsfan
Napkinbob wrote:Image Control.

What is the syntax for displaying an image in a dialog (types 0, 2, or 4).

does the image need to be converted to bytes and sent along, or is it a reference to an image already on media center machine (or a url). Sorry if youve documented this and I've overlooked it, but I can't find it anywhere.
Hi - it can be a URL or physical file location.

Re: MCEPopups.0.3

Posted: Tue Apr 23, 2013 12:24 am
by java007md
Will definitely be checking this out. Can the source code for this project be made available?

Re: MCEPopups.0.3

Posted: Wed Oct 24, 2018 1:24 pm
by jachin99
I found the blog entry for _T_'s program where he explains how he made his program. Its on the web archive here https://web.archive.org/web/20110330102 ... ://hsp.dk/

I have also hosted MCE Popups on my file share at this link https://drive.google.com/open?id=1JzHHP ... kPU4BGmQ3Z