SageTV Community  

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


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.

Thread Tools Search this Thread Display Modes
Old 04-25-2016, 07:47 PM
jonnydeath jonnydeath is offline
Sage User
Join Date: Apr 2008
Posts: 52
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 .

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:

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 (6.3 KB, 278 views)

Last edited by jonnydeath; 05-08-2016 at 10:00 AM.
Reply With Quote
Old 04-25-2016, 09:09 PM
alfi33 alfi33 is offline
Sage Aficionado
Join Date: Jun 2008
Posts: 310
Very cool!
Server: SageTV v9 on unRAID Docker; i5-2400; 16GB RAM; 9TB storage array; SiliconDust HDHR3
Client: Windows10; Intel Core2Duo; 4GB RAM; NVIDIA GeForce GT 1030
Client: NVIDIA ShieldTV
Client: Fire TV Stick 4K
Reply With Quote
Old 04-28-2016, 01:24 AM
Brent94Z Brent94Z is offline
Sage Fanatic
Join Date: Aug 2004
Posts: 863
Nice! When I get some time I'll give it a try Thanks!
Reply With Quote
Old 12-21-2019, 05:30 AM
btrcp2000 btrcp2000 is offline
Sage Fanatic
Join Date: Aug 2007
Posts: 888
Does this still work? Just got some Alexa devices
[size=1]Current Server:V9 UNRAID Docker, SuperMicro x9dri-LNF4+, 32 GB ECC, 2x Xeon e5-2660v2, storage array 6TB, 2 Dish r5000HD tuners, 1 HDHomerun Quatro, 1 HDHomerun Extend
4 Nvidia Shield TVs with Miniclient
Reply With Quote
Old 12-24-2019, 12:07 PM
tmiranda's Avatar
tmiranda tmiranda is offline
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Originally Posted by btrcp2000 View Post
Does this still work? Just got some Alexa devices
I haven't used it in years. I'm not sure if it will work or not.

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

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 11:53 PM.

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