SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Github Development
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-21-2017, 08:19 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Remote SageClient Possible?

One of the issues I am having with my Echo skill is the latency involved with using sagex to fetch information from the Sage server. One way to solve this would be to have a synced copy of the wiz.bin on the same web server as the Echo skill backend.

I know the SageClient does this already but it only works on a local network. Placeshifter works over a network but doesn't keep a local copy of the wiz.bin. Would it be possible to combine the two features?

No UI would be needed.

I can see this functionality being useful for other applications. If anybody decided to integrate Sage with Google Home for example.

Thoughts?
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #2  
Old 01-21-2017, 09:35 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by tmiranda View Post
One of the issues I am having with my Echo skill is the latency involved with using sagex to fetch information from the Sage server. One way to solve this would be to have a synced copy of the wiz.bin on the same web server as the Echo skill backend.

I know the SageClient does this already but it only works on a local network. Placeshifter works over a network but doesn't keep a local copy of the wiz.bin. Would it be possible to combine the two features?

No UI would be needed.

I can see this functionality being useful for other applications. If anybody decided to integrate Sage with Google Home for example.

Thoughts?
Have you verified that you are dealing with a latency between the Echo Server and the SageTV Server, not a latency between the Echo client and the Echo Server?

I have an Echo Dot, and when I walk into a room, and say, "Alexa, turn on the light", there's about 1-2 second delay before the light comes on, and these things are on the same home network.

I'm not familiar with the architecture of how you've integrated Echo and SageTV, but, in general, on the same network, sagex REST apis are extremely fast... in many cases less than 50ms-100ms. If the data coming back is 1000s of movies, then you'll get some delay there, because the size of the message is so large. But for messages in the 1-5k range, those should be almost instant.

Do you have some examples of APIs that are taking a long time?

It takes a fair bit of work to create a data sync and keep things in sync, and do it efficiently. I'd hate to see you spend 2-3 weeks doing it, only to discover there is only a marginal performance increase, with huge code complexity.
Reply With Quote
  #3  
Old 01-21-2017, 02:27 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by stuckless View Post
Have you verified that you are dealing with a latency between the Echo Server and the SageTV Server, not a latency between the Echo client and the Echo Server?

I have an Echo Dot, and when I walk into a room, and say, "Alexa, turn on the light", there's about 1-2 second delay before the light comes on, and these things are on the same home network.

I'm not familiar with the architecture of how you've integrated Echo and SageTV, but, in general, on the same network, sagex REST apis are extremely fast... in many cases less than 50ms-100ms. If the data coming back is 1000s of movies, then you'll get some delay there, because the size of the message is so large. But for messages in the 1-5k range, those should be almost instant.

Do you have some examples of APIs that are taking a long time?

It takes a fair bit of work to create a data sync and keep things in sync, and do it efficiently. I'd hate to see you spend 2-3 weeks doing it, only to discover there is only a marginal performance increase, with huge code complexity.
I'm sure it will help because I simplified my example. There are actually several areas where it will help:

- To implement some functionality I need to make many (possibly hundreds, or thousands - it depends on the number of Airings in the DB) of sagex calls. This slows things down a lot.

- I'm using Amazon's Lambda to process requests and it's totally stateless. The only way to pass anything but the simplest pieces of info between user utterances is to save it to the DynamoDB, which is slow. If I had the DB locally I could quickly rebuild the data I need.

- Passing large numbers of complex objects (like Airings) is slow. (I tried only passing the fields I need instead of the whole Airings but this is only marginally better since I need many of the fields.)

What I am doing now works but has limitations. I currently save lists of AiringIDs to a DynamoDB and then when I need to get detailed information I get the Airing Object from the server.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #4  
Old 01-21-2017, 02:32 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
And you can run SageTVClient over the Internet...you just need to have the right ports open to do it (the main downside being there is no security preventing somebody else from connecting; so it'd probably be a better idea to do something like port forwarding over SSH). You'll need port 42024...and if you want to play stuff back, you'll also need 7818 for streaming. I *think* that should do it. I know I haven't tried that in a long time. Performance likely may not be that great since there'll be a decent amount of latency in server RPCs and we never designed SageTVClient to perform well in that kind of scenario (but with the V9 changes, this client won't slow down what's happening on the server which would have occurred in V7).
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #5  
Old 01-21-2017, 03:00 PM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by tmiranda View Post
I'm sure it will help because I simplified my example. There are actually several areas where it will help:

- To implement some functionality I need to make many (possibly hundreds, or thousands - it depends on the number of Airings in the DB) of sagex calls. This slows things down a lot.

- I'm using Amazon's Lambda to process requests and it's totally stateless. The only way to pass anything but the simplest pieces of info between user utterances is to save it to the DynamoDB, which is slow. If I had the DB locally I could quickly rebuild the data I need.

- Passing large numbers of complex objects (like Airings) is slow. (I tried only passing the fields I need instead of the whole Airings but this is only marginally better since I need many of the fields.)

What I am doing now works but has limitations. I currently save lists of AiringIDs to a DynamoDB and then when I need to get detailed information I get the Airing Object from the server.
I guess I'm trying to envision "why" the echo would need to know about 1000s of airings, instead of just a few small details. Unless you are saying, "Alexa, tell me the next 1000 recordings", why would it need to know so much? I guess what I'm saying/asking is why isn't the server doing more work there, where it has all the data, and only sending back a small response? When I was doing Phoenix Android client, there were many times that I just registered a sagex calls on there server and hard it process the complex request request over 1000s of objects instead of getiting 1000s of objects and then making one or more calls for each to do an operation.
Reply With Quote
  #6  
Old 01-21-2017, 08:28 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by stuckless View Post
I guess I'm trying to envision "why" the echo would need to know about 1000s of airings, instead of just a few small details. Unless you are saying, "Alexa, tell me the next 1000 recordings", why would it need to know so much? I guess what I'm saying/asking is why isn't the server doing more work there, where it has all the data, and only sending back a small response? When I was doing Phoenix Android client, there were many times that I just registered a sagex calls on there server and hard it process the complex request request over 1000s of objects instead of getiting 1000s of objects and then making one or more calls for each to do an operation.
I allow the user to say a series of utterances like:
- "Alexa, open SageTV"
- "Get all recordings"
- "Filter out the watched recordings"
- "Group them by title"
- "Sort them the episodes by date recorded"

This is just an example of how a user could build a "virtual view". The point is there are lots of cases where I am working with many Airings.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #7  
Old 01-21-2017, 08:29 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by Narflex View Post
And you can run SageTVClient over the Internet...you just need to have the right ports open to do it (the main downside being there is no security preventing somebody else from connecting; so it'd probably be a better idea to do something like port forwarding over SSH). You'll need port 42024...and if you want to play stuff back, you'll also need 7818 for streaming. I *think* that should do it. I know I haven't tried that in a long time. Performance likely may not be that great since there'll be a decent amount of latency in server RPCs and we never designed SageTVClient to perform well in that kind of scenario (but with the V9 changes, this client won't slow down what's happening on the server which would have occurred in V7).
Cool. I'm not interested in actually playing anything, I just want access to a local wiz.bin that synced to the server.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #8  
Old 01-22-2017, 05:06 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by tmiranda View Post
I'm sure it will help because I simplified my example. There are actually several areas where it will help:

- To implement some functionality I need to make many (possibly hundreds, or thousands - it depends on the number of Airings in the DB) of sagex calls. This slows things down a lot.

- I'm using Amazon's Lambda to process requests and it's totally stateless. The only way to pass anything but the simplest pieces of info between user utterances is to save it to the DynamoDB, which is slow. If I had the DB locally I could quickly rebuild the data I need.

- Passing large numbers of complex objects (like Airings) is slow. (I tried only passing the fields I need instead of the whole Airings but this is only marginally better since I need many of the fields.)

What I am doing now works but has limitations. I currently save lists of AiringIDs to a DynamoDB and then when I need to get detailed information I get the Airing Object from the server.
Quote:
Originally Posted by tmiranda View Post
I allow the user to say a series of utterances like:
- "Alexa, open SageTV"
- "Get all recordings"
- "Filter out the watched recordings"
- "Group them by title"
- "Sort them the episodes by date recorded"

This is just an example of how a user could build a "virtual view". The point is there are lots of cases where I am working with many Airings.
I can see that, but I guess even in those cases, I would have still opted to do all that work on the server and just let alexa store a token (session) and then keep passing that token in each command. At the end of the day, unless I'm totally missing what alexa is doing, those recordings are still on the sagetv server, and alexa isn't reading back 1000s of recordings at the end of each command.
Reply With Quote
  #9  
Old 01-22-2017, 07:12 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by stuckless View Post
I can see that, but I guess even in those cases, I would have still opted to do all that work on the server and just let alexa store a token (session) and then keep passing that token in each command. At the end of the day, unless I'm totally missing what alexa is doing, those recordings are still on the sagetv server, and alexa isn't reading back 1000s of recordings at the end of each command.
There is a Session Object that gets passed to the skill, but it has a size limit and I exceed limit when processing a large number of recordings.
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #10  
Old 01-22-2017, 07:47 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by tmiranda View Post
There is a Session Object that gets passed to the skill, but it has a size limit and I exceed limit when processing a large number of recordings.
I think you misunderstand. I'm not suggesting that you store the recordings in the Alexa session, but that you use the Alexa session a unique token on the server to hold onto information.

In my understanding, Alexa, is just remote controlling SageTV.

So in the case of what you described, no large amounts data need to be transferred to alexa...

You - "Alexa, Open SageTV"
Server - gets "session id" (not sure what else "open sagetv does")
Alexa - "ok"

You - "Get All Recordings"
Server - gets all recording and stores them under the session id on the server. returns "ok"
Alexa - "ok"

You - "Filter out watched recordings"
Server - uses the session id to find the list of recordings, then filters by watched, stores result in the server for the session id. Returns "ok"
Alexa - "ok"

You - "Group them by title"
Server - uses the session id to find the list of filtered recordings, groups them, puts then in the session on the server. Returns "ok"
Alexa - "ok"

You - "Sort them the episodes by date recorded"
Server - uses the session id to find the list of grouped recordings, groups them, puts then in the session on the server. Returns "ok"
Alexa - "ok"

You - "What is next recording?"
Server - uses the session id to find the list of recordings, gets the first recording, sends it back. Returns JSON airing details for that ONE recording.
Alexa - "The next recording is Colony, season 2 episode 2. In this episode ...."

You - "Play the next recording?"
Server - uses the session id to find the list of recordings, gets the first recording, tells sagetv to play it. return "ok"
Alexa - "ok"

So, in this dialog... until alexa needs to actually speak something about the data, nothing is really returned back, except that it worked. All the data is held on the server, and in each case, Alexa is just sending it's session id, so that you can find the data associated with the session, but nothing more than a few bytes is ever sent, either way.
Reply With Quote
  #11  
Old 01-22-2017, 08:04 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by stuckless View Post
I think you misunderstand. I'm not suggesting that you store the recordings in the Alexa session, but that you use the Alexa session a unique token on the server to hold onto information.

...

So, in this dialog... until alexa needs to actually speak something about the data, nothing is really returned back, except that it worked. All the data is held on the server, and in each case, Alexa is just sending it's session id, so that you can find the data associated with the session, but nothing more than a few bytes is ever sent, either way.
OK, now I see what you are talking about. I never considered storing the info in the Sage server, I didn't think that was possible using sagex and JavaScript. I assumed, maybe incorrectly, that the JavaScript that sagex runs is also stateless.

How would I store the information using JavaScript? Can I declare static variables that are preserved for as long as the Sage server is running?
__________________

Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders.
Reply With Quote
  #12  
Old 01-22-2017, 09:18 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by tmiranda View Post
OK, now I see what you are talking about. I never considered storing the info in the Sage server, I didn't think that was possible using sagex and JavaScript. I assumed, maybe incorrectly, that the JavaScript that sagex runs is also stateless.

How would I store the information using JavaScript? Can I declare static variables that are preserved for as long as the Sage server is running?
This would require that your Alexa server component was a Java plugin. You could still use javascript for some parts of it, and have it call into the plugin, or just ditch javascript totally (I'd do the latter ).

You can still do it all in JS, but it would likely require that you at least have 1 small java api that allows you to statically set a name value pair in static memory, because you are right, the JavaScript calls themselves are, for the most part, stateless.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get Fan Art on SageClient? pingmustard SageTV v7 Customizations 2 04-03-2011 03:19 AM
SageClient with USBUIRT and Hauppauge 45 button remote map?? Stuntman Hardware Support 1 02-28-2009 08:03 PM
Q: SageClient mode w/ Sage Service not saving into SageClient.properties laurenglenn SageTV Software 2 06-17-2007 09:22 PM
USB-IRT on SageClient with Hauppauge Remote... Stuntman SageTV Software 5 12-07-2004 09:22 PM
Remote stops working with .16 SageClient ben_gb SageTV Beta Test Software 2 04-19-2004 08:15 PM


All times are GMT -6. The time now is 05:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.