INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Client/Server Functionality  (Read 8365 times)

Doozer

  • Recent member
  • *
  • Posts: 10
Client/Server Functionality
« on: May 10, 2016, 04:10:39 pm »

I setup home automation systems for a living and have been using JRiver for a very long time. I find that JRiver is very easy to integrate into larger automation systems from the likes of Crestron and RTI.

Many of my clients consider themselves audiophiles, so they gravitate to JRiver. However, most of the complaints I get come from the client/server functionality. They all complain that it is too hard to setup multiple user accounts. I was experimenting with making a plugin to allow a JRiver to function as an Emby client, but haven't had the time and Emby's music feature set is lacking.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Client/Server Functionality
« Reply #1 on: May 10, 2016, 04:17:00 pm »

However, most of the complaints I get come from the client/server functionality. They all complain that it is too hard to setup multiple user accounts.

It may be useful to know what, specifically, you find lacking in MC's Users support.

Also, I'd be very interested to know what kind of Crestron integration you've developed. Do you have a module you'd be willing to share? I have about 60 series 3 Crestrons of various types here I play with and would be curious to see what you've done.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

eddyshere

  • Galactic Citizen
  • ****
  • Posts: 469
Re: Client/Server Functionality
« Reply #2 on: May 29, 2016, 05:53:04 am »

I have installed / used for myself / several drivers coded by doozer for RTI systems (and they are brilliant).
Automation guys struggle to bring a JRemote-like experience from within the automation system. RTI for example doesn't have an official JRiver driver.

I can only agree that users who often invest several 1000USD into home automation are often either geeks or audiophiles with deep pockets and corresponding hardware. JRiver is for me still the best audio server.

I have also seen many requests on interact discussing/asking for the MC API. Clearly what's lacking is a way to communicate two way with MC. Most automation systems communicate on "telnet" TCP/UDP - level and have difficulty to communicate with the MC webservice.

I'm currently struggling to get the MCWS info function to work with my RTI processor. Sure enough I can get a file info (XML response) through a webbrowser, or through a PC command line with wget but my RTI two way driver can only speak RAW TCP/UDP. Whilst I can adress for example a dreambox webserver, or any other web based unit like a Marantz receiver or an OPPO bluray player, I didn't manage so far to communicate successfully with JRiver.

I can connect to the server on port 52199 but the connection gets closed with a server 501 error at every data sending attempt I do. I still don't know if it just cannot work or if I should send specific data in a given order to enter the server. I'm suspecting due to the 501 error I get that I simply cannot communicate between a RTI two way strings driver and MCserver.

Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72548
  • Where did I put my teeth?
Re: Client/Server Functionality
« Reply #3 on: May 29, 2016, 06:48:49 am »

I can connect to the server on port 52199 but the connection gets closed with a server 501 error at every data sending attempt I do. I still don't know if it just cannot work or if I should send specific data in a given order to enter the server. I'm suspecting due to the 501 error I get that I simply cannot communicate between a RTI two way strings driver and MCserver.
I don't think that's right.  The connection shouldn't be closed.

From a web browser, if I enter this:
http://localhost:52199/MCWS/v1/hello

I get this:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Response Status="Failure" Information="Function 'hello' not found."/>

I entered a bad command (hello) on purpose to see how the server would handle an error.

I just moved to a new house that has RTI equipment, but I removed it.
Logged

eddyshere

  • Galactic Citizen
  • ****
  • Posts: 469
Re: Client/Server Functionality
« Reply #4 on: May 29, 2016, 07:51:25 am »

Thanks Jim for your reply.

The comment about removing RTI from your new house is funny. I find it an excellent yet affordable system.

Regarding your comment : I agree it works flawlessly from a webbrowser but that is exactly the point. How could I do get the same answer back using a telnet client instead of a webbrowser.

Try Putty or Realterm, connect yourself to the webservice and try to send something.......and please forgive my ignorance as I'm not an expert.....after days of trial and error get the feeling that I actually try to have a communication between two not compatible "languages" even if in my unspecialized brain in theory a web server should be adressable via telnet

Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Client/Server Functionality
« Reply #5 on: May 29, 2016, 08:06:54 am »

If you can communicate with web based services in other components (Marantz, Oppo), then you should be able to use this same technique with MCWS.  You just have to change the port from 80 to 52199.

You keep saying "telnet" and I don't think that's what you mean.  Telnet is something specific.  A TCP connection to a specific port is similar.  But that's not what you want.  What you want is an HTTP connection, made via port 52199, sending specific parameters and then reading back the results from the web server.

Brian.
Logged

eddyshere

  • Galactic Citizen
  • ****
  • Posts: 469
Re: Client/Server Functionality
« Reply #6 on: May 29, 2016, 08:30:26 am »

If you can communicate with web based services in other components (Marantz, Oppo), then you should be able to use this same technique with MCWS.  You just have to change the port from 80 to 52199.

You keep saying "telnet" and I don't think that's what you mean.  Telnet is something specific.  A TCP connection to a specific port is similar.  But that's not what you want.  What you want is an HTTP connection, made via port 52199, sending specific parameters and then reading back the results from the web server.

Brian.

Yes but other servers are someway allowing to communicate directly with them and not only through a web browser.

You are certainly right re telnet I use this generic term to describe putty based communications...sorry for my ignorance. Can you get feedback from MC with putty ?? If you download putty.exe and then connect it to MC port 52199 can you get an answer back ?
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10970
Re: Client/Server Functionality
« Reply #7 on: May 29, 2016, 08:34:17 am »

You are certainly right re telnet I use this generic term to describe putty based communications. Can you get feedback from MC with putty ?? If you download putty.exe and then connect it to MC port 52199 can you get an answer back ?


If you speak HTTP to it, then it'll answer in HTTP. Don't need a browser for that, there is plenty tools to automate and script talking to web services.
Logged
~ nevcairiel
~ Author of LAV Filters

eddyshere

  • Galactic Citizen
  • ****
  • Posts: 469
Re: Client/Server Functionality
« Reply #8 on: May 29, 2016, 08:47:41 am »

aaaaaaaarrrrrrrrrrrggghhhh....!!!!!!!

Hendrik !! if only i would know how to do so !!! see that's exactly my problem....to tech-savvy to not try MCWS and automation things but to dumb to understand how I could benefit from your answer.

I have a driver in which i can only send strings to a IP/port either in UDP or TCP. And it needs escaped strings...so figure ... to communicate with the dreambox web server I needed several days to only find out the correct syntax.

So I am just asking a simple thing : starting putty.exe, connecting to MC and entering a string. IS that supposed to work or can this just not work ? and if it's supposed to work in which syntax should I then senda MCWS command ??

An answer to only this would really mean worlds to me...
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72548
  • Where did I put my teeth?
Re: Client/Server Functionality
« Reply #9 on: May 29, 2016, 09:05:18 am »

Searching on the Internet should give you some clues.

putty to html, for example.
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Client/Server Functionality
« Reply #10 on: May 29, 2016, 09:16:37 am »

Putty could be used, but it's really the wrong tool.  You could type out the HTML headers and then all of the various parameters that you want to send.  But that's really going at it backwards.

You said that your automation system can talk to web servers.  Why aren't you using that part of your system?  Just point it at MCWS with the proper port.  HTTP is a protocol.  It has it's own headers and encapsulation methods.  Web clients, like the one built in to your automation system, know how to speak that protocol.  If you use putty, you will have to do all of the protocol talk yourself.

Let's say you can't make it work that way for some reason.  Can you run an external program from your automation system?  If so you should be able to use CURL or another web client to do this work with MCWS.  Here's an example that I just ran on my system:

Code: [Select]
BLG:~ blgentry$ curl localhost:52199/MCWS/v1/Playback/Info\?Zone\=\-1
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Response Status="OK">
<Item Name="ZoneID">10025</Item>
<Item Name="ZoneName">Desk Speakers</Item>
<Item Name="State">2</Item>
<Item Name="FileKey">798</Item>
<Item Name="NextFileKey">61169</Item>
<Item Name="PositionMS">180470</Item>
<Item Name="DurationMS">311226</Item>
<Item Name="ElapsedTimeDisplay">3:00</Item>
<Item Name="RemainingTimeDisplay">-2:11</Item>
<Item Name="TotalTimeDisplay">5:11</Item>
<Item Name="PositionDisplay">3:00 / 5:11</Item>
<Item Name="PlayingNowPosition">1</Item>
<Item Name="PlayingNowTracks">32</Item>
<Item Name="PlayingNowPositionDisplay">2 of 32</Item>
<Item Name="PlayingNowChangeCounter">2</Item>
<Item Name="Bitrate">687</Item>
<Item Name="Bitdepth">16</Item>
<Item Name="SampleRate">44100</Item>
<Item Name="Channels">2</Item>
<Item Name="Chapter">0</Item>
<Item Name="Volume">0.3</Item>
<Item Name="VolumeDisplay">30%  (-35.0 dB)</Item>
<Item Name="ImageURL">MCWS/v1/File/GetImage?File=798</Item>
<Item Name="Artist">Pink Floyd</Item>
<Item Name="Album">Meddle</Item>
<Item Name="Name">A Pillow of Winds</Item>
<Item Name="Status">Playing</Item>
</Response>

I did this on a Mac in a terminal window.  But you could do the same thing under windows with the CURL command line tool.  Here's a document I found showing how to install curl command line:

http://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/objectstorage/restrict_rw_accs_cntainers_REST_API/files/installing_curl_command_line_tool_on_windows.html

I don't know the details of your automation system... heck I don't even know what system it is!  But this kind of thing should be possible.

Brian.
Logged

eddyshere

  • Galactic Citizen
  • ****
  • Posts: 469
Re: Client/Server Functionality
« Reply #11 on: May 29, 2016, 11:21:52 am »

THANKS FOR ALL Your Input.

See I have a RTI homeautomation system. I'm in a IT-related business and do some automation projects in my spare time. The RTI xp6 processor can talk to all sorts of equipment by IR if course, RS-232 and with dedicated drivers over LAN.

When 2 way communication is wished and there is no dedicated driver RTI has only a "generic" two way strings driver. This driver opens a either a serial, TCP or UDP port.  The user can then send a string through that connection. Furthermore once can also specify up to 50 RX strings which, if matched to any part of a received string, will cause events and create variables.

The driver has this configuration abilities (driver 1). The send string windows looks like this (driver 2).

Now for instance if I take a dreambox receiver which runs a "web server" ( I call it like this because I can adress it through a browser) I can also telnet to it with the following strings : wget -q -O - http://199.11.101.238/web/RTIepgnow?bRef=1:7:1:0:0:0:0:0:0:0%0D. This would returns :

<?xml version="1.0" encoding="UTF-8"?>
<e2eventlist>
        <e2event>
<e2eventservicename>DISCOVERY</e2eventservicename>
                <titnow>1:0:19:26AD:43E:1:C00000:0:0:0:!THE FREE WAY!end!</titnow>

        </e2event>

        <e2event>

                <e2eventservicename>DISCOVERY SCIENCE</e2eventservicename>
                <titnow>1:0:19:24BF:43C:1:C00000:0:0:0:!MYTHBUSTERS!end!</titnow>

        </e2event>

 i can then pick out the title of the now running TV -program on each channel and can populate a real-time EPG list on my remotes.

I use putty to troubleshoot and find out which syntax the server of any equipment (if available) understands because filling in RTI reloading and trying out takes a lot of time. Ijust know that if I get ananswer back through putty or realterm my RTI driver will work.

So when I launch putty pointing it towards MC it connects fine. If I use realterm also it connects...but after a while it disconnects because the server on MC obviously expects something. Now if I send the string : GET /MCWS/v1/Library/Values?Field=Artist  HTTP/1.1\nhost: 199.11.101.200:51299\n\n for example I get a repsonse from MC 501 Server Error. I actually get it what ever I try to send.


Thus my question ... obviously I don't know what to send or if this is even possible

Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Client/Server Functionality
« Reply #12 on: May 29, 2016, 12:03:10 pm »

Now for instance if I take a dreambox receiver which runs a "web server" ( I call it like this because I can adress it through a browser) I can also telnet to it with the following strings : wget -q -O - http://199.11.101.238/web/RTIepgnow?bRef=1:7:1:0:0:0:0:0:0:0%0D. This would returns :

What happens when you try this same thing using an MCWS command like the one I posted above?

RTI appears to have an HTTP driver also.  You can search their drivers here:

http://www.myrti.de/drivers.php

Look for manufacturer: RTI and type: HTTP

You have to register on their forum to download it (and read the docs).  I'm not sure what it does, but it sounds like what you want.

Good luck.

Brian.
Logged

eddyshere

  • Galactic Citizen
  • ****
  • Posts: 469
Re: Client/Server Functionality
« Reply #13 on: May 29, 2016, 12:06:08 pm »

Hi Brian,

Thanks I know ...this http driver is one way only. Sending MCWS commands through this driver works without a problem with MC..and ahh yeah regarding your former post : no I cannot run an external program on the rti to do that.
Of course your example works also for me in a browser or a curl enabled client, or even on a PC with wgetwin.....all this works without an issue.


Actually I guess I cannot explain it with exact the terms needed.


If somebody could just give me one simple answer : can I get the same return out of MC webservice i would get with a browser BUT using a program like putty or realterm and if yes what strings should I send in which order to the webservice server.


Let's call it a day anyway....I'm happy with my integration of MC it would just have been the icing on the cake to display running now information or other library fields on my remotes and see how far I could go.

THANKS TO ALL
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72548
  • Where did I put my teeth?
Re: Client/Server Functionality
« Reply #14 on: May 29, 2016, 12:31:29 pm »

A tutorial on putty might give you what you need.  Here, for example:

https://www.howtoforge.com/tutorial/putty-remote-x11-desktop-applications/
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Client/Server Functionality
« Reply #15 on: May 29, 2016, 12:49:03 pm »

We might have a language barrier here.  I'm having a hard time understanding what you are saying.  But see below...

If somebody could just give me one simple answer : can I get the same return out of MC webservice i would get with a browser BUT using a program like putty or realterm and if yes what strings should I send in which order to the webservice server.

Yes, you can do that if you must.  I just tried your example and it worked.  But I did something a tiny bit different.  I entered the GET command and then pressed Return 2 times.  After the second return, the MCWS server responded with the output.

Here's an example of me running the "info" command from a terminal window:

Code: [Select]
BLG:~ blgentry$ telnet localhost 52199
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /MCWS/v1/Playback/Info?Zone=-1 HTTP/1.1

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: text/xml;charset=utf-8
X-JRiver-Library-Server: 1
Server: Darwin, UPnP/1.1 DLNADOC/1.50, JRiver/21
Content-Length: 1239
Date: Sun, 29 May 2016 17:44:04 GMT
X-JRiver-Access-Key: yvsysz
Cache-Control: no-cache
Keep-Alive: timeout=10

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Response Status="OK">
<Item Name="ZoneID">10025</Item>
<Item Name="ZoneName">Desk Speakers</Item>
<Item Name="State">1</Item>
<Item Name="FileKey">151463</Item>
<Item Name="NextFileKey">525647</Item>
<Item Name="PositionMS">34796</Item>
<Item Name="DurationMS">364066</Item>
<Item Name="ElapsedTimeDisplay">0:34</Item>
<Item Name="RemainingTimeDisplay">-5:30</Item>
<Item Name="TotalTimeDisplay">6:04</Item>
<Item Name="PositionDisplay">0:34 / 6:04</Item>
<Item Name="PlayingNowPosition">8</Item>
<Item Name="PlayingNowTracks">23</Item>
<Item Name="PlayingNowPositionDisplay">9 of 23</Item>
<Item Name="PlayingNowChangeCounter">61</Item>
<Item Name="Bitrate">691</Item>
<Item Name="Bitdepth">16</Item>
<Item Name="SampleRate">44100</Item>
<Item Name="Channels">2</Item>
<Item Name="Chapter">0</Item>
<Item Name="Volume">0.4</Item>
<Item Name="VolumeDisplay">40%  (-30.0 dB)</Item>
<Item Name="ImageURL">MCWS/v1/File/GetImage?File=151463</Item>
<Item Name="Artist">Flim &amp; The BB's</Item>
<Item Name="Album">Further Adventures</Item>
<Item Name="Name">On the Avenue</Item>
<Item Name="Rating">4</Item>
<Item Name="Status">Paused</Item>
</Response>

Maybe you need to script in two returns?  As you can see, it definitely works from a terminal (which is what Putty is).

Again, good luck to you.

Brian.
Logged

eddyshere

  • Galactic Citizen
  • ****
  • Posts: 469
Re: Client/Server Functionality
« Reply #16 on: May 29, 2016, 06:56:00 pm »

DID IT !!!!!!  ;D

Finally it works. Actually i have to turn authentication off. with authentication I haven't figured out how to construct the GET command to pass-on correctly username and password...also i suspect that even if i would I'll have to involve the MC token etc.
So i just turned authentication off.
It works.....the two returns were needed.

I still need to figure out how: GET /MCWS/v1/Playback/Info?Zone=-1 HTTP/1.1 shall be correctly written with escaped characters but I'll figure this out.

THANKS FOR your all patience with my request
+
A special thank to blgentry

Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Client/Server Functionality
« Reply #17 on: May 29, 2016, 08:16:34 pm »

Be aware that without authentication enabled, MCWS is read only. This applies equally to all clients, even other copies of MC.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

imugli

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1598
Re: Client/Server Functionality
« Reply #18 on: May 29, 2016, 09:01:40 pm »

DID IT !!!!!!  ;D

Finally it works. Actually i have to turn authentication off. with authentication I haven't figured out how to construct the GET command to pass-on correctly username and password...also i suspect that even if i would I'll have to involve the MC token etc.
So i just turned authentication off.
It works.....the two returns were needed.

I still need to figure out how: GET /MCWS/v1/Playback/Info?Zone=-1 HTTP/1.1 shall be correctly written with escaped characters but I'll figure this out.

THANKS FOR your all patience with my request
+
A special thank to blgentry



If you need to use special characters in html, try https://www.utexas.edu/learn/html/spchar.html

eddyshere

  • Galactic Citizen
  • ****
  • Posts: 469
Re: Client/Server Functionality
« Reply #19 on: May 30, 2016, 03:18:03 am »

Be aware that without authentication enabled, MCWS is read only. This applies equally to all clients, even other copies of MC.

Yes read only should be enough for my purpose...it will allow me to browse the library, select titles or launch titles based on keyfile at the press of a button and get the playing now thumbnail on my remote

Thanks iMugli also for the excellent link i have red quite many of these but am still very unsure when it's coming to writing command lines and or syntax
Logged
Pages: [1]   Go Up