SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV v7 Customizations

Notices

SageTV v7 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 7 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 7 and newer.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-25-2016, 07:47 PM
jonnydeath jonnydeath is offline
Sage User
 
Join Date: Apr 2008
Posts: 51
SageTV Alexa Skill

I have made a simple Alexa skill for SageTV. Hopefully someone can take this and make it even better (and maybe more secure). I have only tested on SageTV Open Source on Windows, but should work on v7 .

Requirements:
1. Sagex-api-services on the SageTV server
1a. YouTube (2015) plugin if you want to use Youtube capabilty
2. ssl access to your SageTV jetty server exposed to the internet (if you are like me and can't figure out how to get ssl working in jetty, use the free "stunnel" software to easily translate https to http). You could re-write it to not require ssl, but I thought that would be unwise.
3. You need to know the basics of how to setup an custom Alexa skill. A good tutorial on setting up a skill is:
http://analyticphysics.com/Diversion...20Cookbook.htm

Directions:
1. Place the alexa.js in your sagex/services/ directory
1a. Edit alexa.js YouTube temp download directory to a location on your server (hardcoded a few times as 'E:/DownloadedShowsNew/YouTube/' ). A logfile "extender-tempLog.txt" is also made in this directory to allow skipping to the next likely search result more easily.
2. Edit node.js.txt to match your configuration:
IP Address: your external IP (in single quotes)
authstring: your jetty userNameassword (in single quotes)
port: your external jetty port (no quotes)
extender: '0' for client instance, extender MAC address for a specific extender (get from SageTV webserver home page)

2. Put the contents of the node.js.txt as your lambda function and the content of the other files in correct locations in the Amazon Alexa skill section. I named it "Sage Tee Vee".

Then you can do things like:
Alexa, ask Sage Tee Vee to watch XXX {XXX can be a show name, episode name, movie name}
% Gives best match. You can say "Alexa, ask Sage Tee Vee Wrong show" for next match
Alexa, ask Sage Tee Vee to XXX {XXX can be "skip", "pause","stop", "unpause"}
Alexa, ask Sage Tee Vee what's on next {gives next 5 shows that are recording}
Alexa, ask Sage Tee Vee what's new {gives last 5 shows that were recording}
Alexa, ask Sage Tee Vee to search youtube for {video name}
% Gives best match (most views).You can say "Alexa, ask Sage Tee Vee Wrong show" for next match. Give it a few seconds, as it will crash if you do it too quickly. It will not download the file from youtube if you already have it (but it will still play it). The temp download directory is not cleaned up, so you may want to do that every once is a while.

I find every often that "one shot" commands sometimes don't work well. Instead say:
Alexa, ask Sage Tee Vee. Wait for her response, then say the second command, eg. "Watch XXX"

If the alexa.js script does not work, and you are on windows, make sure you are on java 1.7 (jdk-7u79-windows-i586) not java 1.8. If you have multiple clients, you may need to edit the alexa.js script to talk to the right one. I may add the capability to use voice to choose between multiple extenders or clients.

Thanks to stuckless for the help on UIContext and to kricker as I stole his search code from his xmbc plugin.
Thanks to tmiranda for help with YouTube (2015).
Note: For the youtube functionality, you need SageTV 9, as it was implemented with progressive play (start playing while file is downloaded)
Attached Files
File Type: zip SageTV_Alexav5.zip (6.3 KB, 35 views)

Last edited by jonnydeath; 05-08-2016 at 10:00 AM.
Reply With Quote
  #2  
Old 04-25-2016, 09:09 PM
alfi33 alfi33 is offline
Sage Aficionado
 
Join Date: Jun 2008
Posts: 296
Very cool!
__________________
Server: SageTV v9 on unRAID Docker; i5-2400; 16GB RAM; 6TB storage array; SiliconDust HDHR3
Client: Windows7 Pro; AMD Athlon 64 X2 5000; Radeon HD 3200; 4GB RAM
Client: Windows7 Pro x64; Intel Core2Duo; AMD HD6450; 4GB RAM
Client: Windows10; Intel Core2Duo; AMD HD5450; 4GB RAM
Reply With Quote
  #3  
Old 04-28-2016, 01:24 AM
Brent94Z Brent94Z is offline
Sage Fanatic
 
Join Date: Aug 2004
Posts: 847
Nice! When I get some time I'll give it a try Thanks!
Reply With Quote
Reply


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

Advanced Search
Display Modes

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


All times are GMT -6. The time now is 04:25 AM.


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