Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Help with 2-way MCE control over TCP/IP
This thread has 11 replies. Displaying all posts.
Post 1 made on Sunday October 31, 2010 at 05:57
2Many
Long Time Member
Joined:
Posts:
September 2009
106
I'm trying to add some 2-way control to windows media center. I'm using an MCE plugin named VMC Controller as my connection to MCE.

Sending data to VMC Controller is no problem. Receiving data is working quite well. My problem is trying to manipulate the received data.

Below is the PS for receiving data from a VMC command named 'mediametadata'.


var httpLib = com.philips.HttpLibrary

var MetaData = httpLib.getHTTPXML("http:/192.168.2.2:40510/mediametadata", parseMeta)


function parseMeta(MetaData)
{
System.print(MetaData)
CF.widget("PS_META").label = MetaData + "\r\n"
}



(Note: I have tried the socket.read method, but had little success)

The mediametadata command returns multiple lines of data, e.g:

AlbumTitle=Ninja Tuna
TrackArtist=Mr. Scruff
Genre=Electronic
ReleaseDate=02/01/2008
Label=Ninja Tune
TrackNumber=01
TrackDuration=348
TrackTitle=Kalimba
TrackComposer=A. Carthy and A. Kingslow
Uri=C:\Users\Public\Music\Sample Music\Kalimba.mp3
AlbumArtist=Mr. Scruff
ProductionCompany=


What I am hoping to acheive is extract certain lines and place the data in separate panels, a Track Number panel, an Artist panel and so on.

This is my first 'real' attempt at using TCP/IP and HTTP and can find any snippets that may help with the data extraction.

I've looked through the dev guide, searched RC and looked at some modules for examples. I can't find a good reference, either that or I am just not getting it.


I have no HTML or XML experience to speak of. All I have is my recent PS and some very basic, Visual Basic.

The question is:

Q1 - Do I have to learn e.g. XML in order to manipulate this type of data?

Q2 - If the answer to Q1 is no, can someone point me towards a good reference that would set me on the path to enlightenment?


2Many Thanks

2Many

Last edited by 2Many on October 31, 2010 07:37.
"Home" is where my Pronto is.
Post 2 made on Sunday October 31, 2010 at 11:26
Barry Gordon
Founding Member
Joined:
Posts:
August 2001
2,157
XML is just ascii text. It has an indented structure, but since white space has no meaning if not in quoted strings, it is just for "pretty printing".

The metadata return looks like ascii text but the question in my mind is how are lines delimited? Carriage Return ("\r"), Line Feed ("\n") Both ("\r\n")? That is what you need to know to do the high level split e.g. A=metadata.split("\r\n"). Then for each member of the array A you can do B=A[i].split("="). B[0] will be the tag, and B[1] will be the value. Put it all in a loop for(i=......) and it should be easy.

Hope that helps
OP | Post 3 made on Sunday October 31, 2010 at 13:25
2Many
Long Time Member
Joined:
Posts:
September 2009
106
Thanks Barry. Your description of what I need to do makes perfect sense.

I've spent around 2 days try to find a good method for this small problem. I read about E4X but the more I read, the more confused I became.

I also looked at many parsing snippets, and didn't quite understand what was happening. A copy-and-paste may have got me started again, but that method doesn't help me learn anything.

Thanks for getting me going again.
"Home" is where my Pronto is.
Post 4 made on Monday November 1, 2010 at 11:03
sWORDs
Long Time Member
Joined:
Posts:
November 2006
373
VMCController has two seperate ways to communicate. HTTP and a Telnet socket. On the first you use the HTTPlib and on the second you could use TCP/IP application. There is absolutely no need for the HTTP overhead and it could save you a lot of trouble. So I would use the socket of 40510. And Barry is right (as usually) that's not XML.
Post 5 made on Monday November 1, 2010 at 11:40
Barry Gordon
Founding Member
Joined:
Posts:
August 2001
2,157
As sWORDs stated; why use HTTP if there is a raw TCP implementation available. It will always be faster unless the people who wrote the server side were really bad. HTTP is just a protocol riding on raw TCP.

When a company says it implements Telnet they very rarely mean what they say. "Telnet" implies a specific protocol over port 23. What most implement is raw TCP over port 23.

The use of language in this field has become very poor. "Telnet" is often not "Telnet" but rather raw TCP over a designated port; "RS232" is generally not RS232, but rather serial communications using different voltages, generally using 3 wires but some times more (4 - 7). RS232 is a specification controlled by a document. A ports protocol should not be called RS232 unless it adheres to that document.

That is the advantage of trade marking a term. "Cobol" is a registered trademark and a compiler may not be called a "Cobol Compiler" with out the permission of the trademark owner (US Navy IIRC) who tests the implementation for compliance before granting permission. Don't tell me how bad Cobol is unless you were programming in the '60's.
OP | Post 6 made on Monday November 1, 2010 at 13:38
2Many
Long Time Member
Joined:
Posts:
September 2009
106
Hi sWORD and Barry

I did originally start by using the Telnet socket but encountered many errors. Late last night I discovered the problem.

I am using MCE Controller for control and VMC Controller to get data back from Media Center. The reason for the errors is that they were occasionally trying to share the same socket. A very basic error that I didn't spot until trying out some new commands with MCE Controller. Doh! Problem solved.

I can now go back to the original plan and use Telnet. I did make an effort to avoid using HTTP, especially since I had never ventured down the HTTP route. I can see the benefits of not using HTTP in this scenario, and that's without including my lack of HTTP experience.

I mentioned above that I am using MCE Controller to perform the controlling tasks. The reason is fairly simple, VMC only controls Media Center and only when Media Center has already been launched.

I have expanded MCE Controller's command list to include every key & function of a PC keyboard. Using MCE Controller I have virtually full PC control. I may extend further by including mouse functionality in to my project, but that's for another time.

By the way Barry, I have worked with a couple of people who programmed in Cobol and something named Fortran. They also told me about having to input data by manually punching holes in cards. Where we be in another 40 or 50 years? Just plug me in now!

Last edited by 2Many on November 1, 2010 13:47.
"Home" is where my Pronto is.
Post 7 made on Tuesday November 16, 2010 at 23:12
joZ
Long Time Member
Joined:
Posts:
September 2008
37
This looks really nice, I tried to use PadOne (twice) but uninstalled it pretty much right away, first time (on XP) I got it to work pretty good, then I upgraded to win7 (x64) and bought the new version of PadOne in hopes of a more bugg free version, but it's unfortunatley worse than the old version, every time I start WMC I get a message that says PadOne has stoped working.
I use WMC for all my movies (mediabrowser plug-in) and I have prontoSqueeze for music, but I like WMC better than the softsqueeze player, so this would be a great alternative for me.

Cheers
/joZ
OP | Post 8 made on Wednesday November 17, 2010 at 00:04
2Many
Long Time Member
Joined:
Posts:
September 2009
106
On November 16, 2010 at 23:12, joZ said...
This looks really nice, I tried to use PadOne (twice) but uninstalled it pretty much right away, first time (on XP) I got it to work pretty good, then I upgraded to win7 (x64) and bought the new version of PadOne in hopes of a more bugg free version, but it's unfortunatley worse than the old version, every time I start WMC I get a message that says PadOne has stoped working.
I use WMC for all my movies (mediabrowser plug-in) and I have prontoSqueeze for music, but I like WMC better than the softsqueeze player, so this would be a great alternative for me.

Cheers

VMC Controller is excellent. Thanks to VMC (and a lot of help from the RC Forums, W3schools and the Dev Guide) I have a functional "Now Playing" page with:

Artist Name
Album Title
Song Name
Song Duration
Song Position Bar
and (the all important) Album Art

This is quite an achievement for me, as I am still very much a learner in the scripting department.

I am currently working on an Artist, Album and Song indexing/lists page. Manipulating the received data from VMC is the hardest part for me, but I'll get there, eventually.

I would recommend VMC controller. I looked at a few alternatives, but they didn't match VMC Controller's power.
"Home" is where my Pronto is.
Post 9 made on Thursday November 18, 2010 at 16:42
joZ
Long Time Member
Joined:
Posts:
September 2008
37
On November 17, 2010 at 00:04, 2Many said...
VMC Controller is excellent. Thanks to VMC (and a lot of help from the RC Forums, W3schools and the Dev Guide) I have a functional "Now Playing" page with:

Artist Name
Album Title
Song Name
Song Duration
Song Position Bar
and (the all important) Album Art

This is quite an achievement for me, as I am still very much a learner in the scripting department.

I am currently working on an Artist, Album and Song indexing/lists page. Manipulating the received data from VMC is the hardest part for me, but I'll get there, eventually.

I would recommend VMC controller. I looked at a few alternatives, but they didn't match VMC Controller's power.

I'm currently using the MCE Controller for my WMC, but I will try the VMC controller, always fun to try new stuff right =)
Will you be needing any help? I'm useless in PS/JS but consider myself pretty good in graphics.
let me know if there is anything I can do.

/joZ
/joZ
OP | Post 10 made on Thursday November 18, 2010 at 22:20
2Many
Long Time Member
Joined:
Posts:
September 2009
106
Hi joz

So far I'm finding out how to best handle feedback from VMC Controller. Still early stages. It has been good so far in that I'm learning more PS every day.

The graphics layouts will greatly depend on how good my scripting is (or gets). Once I get a decent project going I'll post a few screenshots. Skinning is not one of my strong points. If you could improve my layouts that would be great.

2Many
"Home" is where my Pronto is.
Post 11 made on Friday November 19, 2010 at 17:18
waspy59
Long Time Member
Joined:
Posts:
November 2009
11
Hi all,

I am very interested in this projet. when you will have ended, do you share it?

Of more, the management of the TV is not feasible on VMC? No?
OP | Post 12 made on Friday November 19, 2010 at 23:43
2Many
Long Time Member
Joined:
Posts:
September 2009
106
On November 19, 2010 at 17:18, waspy59 said...
Hi all,

I am very interested in this projet. when you will have ended, do you share it?

Of more, the management of the TV is not feasible on VMC? No?

If I get a bug-free project going, I would be happy to upload it.

When it comes to TV, I believe VMC Controller does have commands available. However, VMC has issues with Windows 7 Media Center's EPG and is currently unavailable.

I don't use the TV function of Media Center, though I do have a satellite TV card still in it's box so I might try out the TV functions in the future.

For now I am concentrating on music. My project will (hopefully) be built in the following order:

Music > Photos > Videos > Movies > DVD > TV

But it will all depend on my PS abilities and the development of VMC Controller.
"Home" is where my Pronto is.


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse