MCEPopups.0.3

A place for App developers to hang out / post
Post Reply
User avatar
nxsfan

Posts: 72
Joined: Sat Jun 18, 2011 2:00 am
Location:

HTPC Specs: Show details

MCEPopups.0.3

#1

Post by nxsfan » Sun Jul 31, 2011 5:26 pm

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
Last edited by nxsfan on Sat Aug 06, 2011 7:00 am, edited 1 time in total.

User avatar
w84no1

Posts: 29
Joined: Wed Jul 06, 2011 2:09 am
Location: Central Virginia

HTPC Specs: Show details

#2

Post by w84no1 » Wed Aug 03, 2011 2:48 am

If you made it so that commands could be sent via http and responses returned as json, that would be awesome.
NextPVR + KODI + EMBY = PVR Happiness

User avatar
nxsfan

Posts: 72
Joined: Sat Jun 18, 2011 2:00 am
Location:

HTPC Specs: Show details

#3

Post by nxsfan » Wed Aug 03, 2011 4:21 pm

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.

User avatar
w84no1

Posts: 29
Joined: Wed Jul 06, 2011 2:09 am
Location: Central Virginia

HTPC Specs: Show details

#4

Post by w84no1 » Wed Aug 03, 2011 7:26 pm

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.
NextPVR + KODI + EMBY = PVR Happiness

User avatar
nxsfan

Posts: 72
Joined: Sat Jun 18, 2011 2:00 am
Location:

HTPC Specs: Show details

#5

Post by nxsfan » Thu Aug 04, 2011 1:16 am

OK, I'll have a play this weekend (xbox not playing nice with the media center right now).

User avatar
w84no1

Posts: 29
Joined: Wed Jul 06, 2011 2:09 am
Location: Central Virginia

HTPC Specs: Show details

#6

Post by w84no1 » Sun Aug 28, 2011 2:29 am

Any updates?
NextPVR + KODI + EMBY = PVR Happiness

_T_

Posts: 6
Joined: Thu Jan 12, 2012 2:06 pm
Location:

HTPC Specs: Show details

#7

Post by _T_ » Thu Jan 12, 2012 2:39 pm

Is this still being developed? I have some ideas / suggestions.

User avatar
w84no1

Posts: 29
Joined: Wed Jul 06, 2011 2:09 am
Location: Central Virginia

HTPC Specs: Show details

#8

Post by w84no1 » Thu Jan 12, 2012 3:05 pm

_T_ wrote:Is this still being developed? I have some ideas / suggestions.
I am still interested, also.
NextPVR + KODI + EMBY = PVR Happiness

User avatar
nxsfan

Posts: 72
Joined: Sat Jun 18, 2011 2:00 am
Location:

HTPC Specs: Show details

#9

Post by nxsfan » Sat Jan 14, 2012 8:09 pm

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?!

_T_

Posts: 6
Joined: Thu Jan 12, 2012 2:06 pm
Location:

HTPC Specs: Show details

#10

Post by _T_ » Sun Jan 15, 2012 1:53 am

I just decided to write it myself. Thanks anyway though!

User avatar
w84no1

Posts: 29
Joined: Wed Jul 06, 2011 2:09 am
Location: Central Virginia

HTPC Specs: Show details

#11

Post by w84no1 » Sun Jan 15, 2012 7:37 pm

_T_ wrote:I just decided to write it myself. Thanks anyway though!

Can you share?
NextPVR + KODI + EMBY = PVR Happiness

_T_

Posts: 6
Joined: Thu Jan 12, 2012 2:06 pm
Location:

HTPC Specs: Show details

#12

Post by _T_ » Sun Jan 15, 2012 11:12 pm

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.

Napkinbob

Posts: 3
Joined: Thu Jan 19, 2012 2:28 pm
Location:

HTPC Specs: Show details

#13

Post by Napkinbob » Thu Jan 19, 2012 2:32 pm

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

sccrgoalie1

Posts: 317
Joined: Fri Jul 08, 2011 5:52 pm
Location:

HTPC Specs: Show details

#14

Post by sccrgoalie1 » Thu Jan 19, 2012 2:35 pm

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.

Napkinbob

Posts: 3
Joined: Thu Jan 19, 2012 2:28 pm
Location:

HTPC Specs: Show details

#15

Post by Napkinbob » Thu Jan 19, 2012 4:38 pm

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.

Napkinbob

Posts: 3
Joined: Thu Jan 19, 2012 2:28 pm
Location:

HTPC Specs: Show details

#16

Post by Napkinbob » Mon Jan 23, 2012 11:56 pm

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.

User avatar
nxsfan

Posts: 72
Joined: Sat Jun 18, 2011 2:00 am
Location:

HTPC Specs: Show details

#17

Post by nxsfan » Wed Jan 25, 2012 7:00 pm

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.

java007md

Posts: 7
Joined: Thu Dec 15, 2011 3:26 am
Location:

HTPC Specs: Show details

#18

Post by java007md » Tue Apr 23, 2013 12:24 am

Will definitely be checking this out. Can the source code for this project be made available?

jachin99

Posts: 1160
Joined: Wed Feb 24, 2016 3:36 pm
Location:

HTPC Specs: Show details

#19

Post by jachin99 » Wed Oct 24, 2018 1:24 pm

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

Post Reply