Coder Social home page Coder Social logo

josephschmitt / alexa-couchpotato Goto Github PK

View Code? Open in Web Editor NEW
11.0 5.0 5.0 918 KB

[DEPRECATED] A skill to ask Alexa about your Couch Potato queue.

Home Page: http://josephschmitt.github.io/alexa-couchpotato/

JavaScript 100.00%
alexa-skill couchpotato alexa-skills-kit lambda node-lambda couch-potato-queue

alexa-couchpotato's Introduction

Deprecation Notice

This project has been deprecated in favor of Libby, my updated fork of this project that's much more powerful, stable, and feature-rich. You should seriously consider using libby instead of this project.

Couch Potato Alexa Skill [DEPRECATED]

This is a skill built for Amazon's Alexa service that tells you about your Couch Potato queue. It allows you to ask Alexa the following:

Alexa, ask Couch Potato to add The Godfather

Alexa, ask Couch Potato to add The Godfather released in 1974

Alexa, ask Couch Potato if The Dark Knight is on the list

Alexa, ask Couch Potato if Batman 1989 is on the list

If you're just getting started developing skills for Alexa, I'd recommend reading Getting Started with the Alexa Skills Kit and Developing an Alexa Skill as a Lambda Function to get familiar with the process.

You can download a pre-packaged version of the app if you don't want to run from source..

Configuring The Skill

Open the config/default.json file and fill in the right values for your server configuration. If you use an apiKey (which you should), then you can leave username and password blank. Otherwise fill those in instead.

If you don't want to accidentally commit your configuration, then make a duplicate of the default.json file and call it local.json. It will override any configuration from default and is ignored by git.

Creating a Lambda function

The skill is built to be easily hosted on Amazon's AWS Lambda service. You'll need to create an Amazon AWS account, and then head over to the Lambda Dashboard. Once there, click "Create a Lambda function", and provide the following settings:

  1. Select blueprint: Click on Blank Function.
  2. Configure triggers: This one can be easy to miss. You should see a dotted out rounded square to the left of the Lambda logo. Click on it and from the dropdown, choose Alexa Skills Kit.
  3. Configure function:
  • Name: alexa-couchpotato. Honestly this can be whatever you want, but if you want to use the deploy function later, it's best to use the same name as the project here.
  • Description: Doesn't matter. Feel free to copy the project description.
  • Runtime: Node.js 6.10. You can choose the older version if you want, but if you do make sure to update the .babelrc file to tell babel to target the older verison of Node. If you don't know what that means, just go with 6.10.
  • Code entry type: Upload a .ZIP file. (Instructions on generating this ZIP file are below)
  • Lambda function handler and role: Under Existing role choose lambda_basic_execution.

Click Create lambda function and you're done. After you've created your Lambda function, look at the top right of the page to get your Lambda ARN number. You'll need this in the next step, so either write that number down, or keep this page open.

Deploying the Skill

If you don't care about the nitty-gritty of NodeJS projects, you can just download the alexa-couchpotato.zip file from the latest release, update the config/default.json file with your server settings, re-zip, and upload to lambda.

If you want more control, or to make your own updates to the project, check out the master branch and then do an npm install at the project root. Once all the dependencies are installed, run npm run package, which will create an alexa-couchpotato.zip file in your project directory. Back in the Lambda dashboard, look to see where it says "Upload" next to "Function package". Click upload, choose the zip file, and click save.

You can also use node-lambda to deploy to your Lambda function directly from the command line. Simply add a deploy.env file with your environment configuration (and double check the supplied .env file in this repository) and then run npm run deploy. Please visit the node-lambda project page for more information on deploying from the command line.

Setting up the Skill

To set up the skill, head on over to Alexa skills kit development console and add a new skill by following these steps:

  1. Skill Information: Fill in the basic skill information however you choose. If you're feeling uncreative, you can put alexa-couchpotato for the name, and couch potato for the Invocation Name.
  2. Interaction Model: There are two ways to do this. The first is the old/traditional way. In the Intent Schema field, copy the contents of the interaction_model/intent_schema.json file and paste them in. Then in the Sample Utterances field, copy the contents of interaction_model/sample_utterances.txt and paste those in. Make sure to Save your changes. The second way is to use the new Skill Builder. Once you have it loaded, click on Code Editor, click on the area titled "Drag and drop your .json file", and choose the interaction_model/skill_builder.json file. Click Save Model, then Build Model.
  3. Configuration: Set the Service Endpoint Type to AWS Lambda ARN, and choose your region. Now comes the time to grab the ARN from the previous step that you hopefully either wrote down or kept open in a different tab or browser window.
  4. Test: Make sure the toggle at the top is Enabled. You should now be able to test to make sure everything's working. Scroll down to the Service Simulator and in the Enter Utterance field, try asking Couch Potato one of the phrases from up top, like "is The Dark Knight on the list". If everything's working correctly, you should see data get filled in on both the Request and Response boxes. If you do, then you're pretty much done and all set.
  5. Publishing Information: This isn't necessary, but it helps the skill look nice in your Alexa app. You can fill in as much of the metadata as you like, but the one I'd really recommend is uploading an icon. An icon is included in this project and should work well for the 108x108 small icon slot.

And that's it, all done.

Testing The Skill Locally

You can use node-lambda to test this skill locally. In the test_events directory are several event files you can use for testing, and they should map pretty well to each Intent. To test an intent, simply update the EVENT_FILE value in your .env config file to point to the event to test against. Make sure you run npm install from the command line to get the the latest npm packages, and then run npm start.

alexa-couchpotato's People

Contributors

alexc-msft avatar hackworth avatar josephschmitt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

alexa-couchpotato's Issues

Skill test works, live trial gives same answer all the time

If I test the skill on the Dev portal, it works (albeit with error "The Response is invalid" if I try an add before asking if the movie is on the list).

When I try with my echo dot, even if the name of the correct movie is recognised, Alexa will always reply with "hm, it appears that [Name of first movie in my movie list] is already on the list".

No error in the logs.

Any clue?

babel src -d dist issue

I'm trying to manually install the devdependencies and dependencies then run the scripts via CMD as administrator and it's saying no such node, operation, or program exists, even when I try executing it from the node_modules/.bin/ folder.

I've hit a few roadblocks at this point, so I'm hoping someone who has gotten there's zipped and deployed to a AWS lambda function would be generous enough to upload their working .ZIP file with the dependencies in the project (removed of the .env) so I can just add my own .env and upload it too.

Thanks!

Request to add other movies if one exists

If a movie you want to add exists but more search results are found it needs to ask you if you want to cycle through each one and check if they exist in the library. I wrote some code for this but it got way too complex and confusing!!

A Newbie Guide?

Hi Joseph,

I just got my Echo, and have a been a long-time user of CP. While not a complete newbie when it comes to programming and coding, I am definitely not an expert either. Alexa skill stuff is completely new to me.

I have watched tutorials and I cannot seem to make the connection between those tutorials and your Alexa-Couchpotato repo and guide.

Could I impose on you for a more basic/detailed walk-through on how to implement your skill and what one has to do in the Amazon Developers New Skill process? If you prefer, I could do a fully illustrated guide myself if you simply tell me something like:

Name: Couchpotato
Invocation Name: couch potato
Intent Schema: paste contents of x.json. Edit to X add your url
Add Slot type:
Enter Type:
Enter Values: paste xyz here
etc....

Also, not sure where (per your instructions) do I place a and edit the .ev file.

I know this is a lot to ask, but I think it would make this easier for masses. I promise to also link to it in all the relevant forums I am a member of.

I also think that it would make it easier to learn, and possibly for the end user to implement other skills from other repos. Like the Alexa-Sonos.

Many thanks for this, and for any help you can provide.

H.

Add movie doesn't take into account movies on list

Creating issues more for my own reference to remember what needs fixing -

If you try and add a movie and it already exists, the skill will still prompt you to add it and add it regardless.

Needs checking in the AddMovie intent and testing to make sure it can continue to suggest the next movie in case that is not on your list.

Fails when search results have too much detail

First off, thank you! This project works great. Well, usually.

Certain searches exceed Alexa's max response size because they include all sorts of extraneous data such as the plot or actors. I think you could create a new array of movies with just the title, year, imdb, etc to fix this.

Thanks,
Jordan

Error when SSL enabled in CouchPotato

I have this working with my setup, but not so well when I enable SSL. I have a cert from RapidSSL, and it shows valid in Chrome, so I know it's not an issue with certificate validity. I have also made the changes in the config.json, and uploaded the zip to the Lambda function.

I'm getting the following response when I enable SSL on CouchPotato:

"outputSpeech": {
      "type": "SSML",
      "ssml": "<speak>An error occured: Error: read ECONNRESET</speak>"
    }

In the CouchPotato logs:

06-08 18:32:01 ERROR Uncaught exception
Traceback (most recent call last):
  File "/apps/couchpotato/libs/tornado/http1connection.py", line 691, in _server_request_loop
    ret = yield conn.read_response(request_delegate)
  File "/apps/couchpotato/libs/tornado/gen.py", line 807, in run
    value = future.result()
  File "/apps/couchpotato/libs/tornado/concurrent.py", line 209, in result
    raise_exc_info(self._exc_info)
  File "/apps/couchpotato/libs/tornado/gen.py", line 810, in run
    yielded = self.gen.throw(*sys.exc_info())
  File "/apps/couchpotato/libs/tornado/http1connection.py", line 166, in _read_message
    quiet_exceptions=iostream.StreamClosedError)
  File "/apps/couchpotato/libs/tornado/gen.py", line 807, in run
    value = future.result()
  File "/apps/couchpotato/libs/tornado/concurrent.py", line 209, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
SSLError: [SSL: HTTP_REQUEST] http request (_ssl.c:581)

Error when testing skill

Hello, thanks for the updated version. I can get a kodi skill I added working but when I add this one and go to test it, I get the error in Service Response
The remote endpoint could not be called, or the response it returned was invalid.

Any idea please?

Cheers
Mark

error on bundle

I keep getting the same error when I try to bundle to a zip file.. I have tried on RPi3 and windows 10, same each time.. any idea please?

npm ERR! Linux 4.4.50-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "zip"
npm ERR! node v7.7.2
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] zip: cp -r {.env,deploy.env,package.json} dist/; cd dist; npm install --production; bestzip ../lambda.zip * .env;
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] zip script 'cp -r {.env,deploy.env,package.json} dist/; cd dist; npm install --production; bestzip ../lambda.zip * .env;'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the alexa-couchpotato package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cp -r {.env,deploy.env,package.json} dist/; cd dist; npm install --production; bestzip ../lambda.zip * .env;
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs alexa-couchpotato
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls alexa-couchpotato
npm ERR! There is likely additional logging output above.

"The response is invalid"

If I type "is X men Apocolypse on the list" in the service simulator I get this response:

"The response is invalid"

How do I fix this to give a better spoken response? :)

Otherwise, great app!

Can build the bundle

Hi!

Getting no joy in trying to build the bundle:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'bundle' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebundle', 'bundle', 'postbundle' ]
5 info prebundle [email protected]
6 info bundle [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec bundle script
9 verbose stack Error: [email protected] bundle: mkdir -p bundle && cp -r {.env,index.js,lib,node_modules} bundle/ && cd bundle && bestzip ../lambda.zip * .env && rm -rf ../bundle
9 verbose stack Exit status 1
9 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:829:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd /home/alexa-couchpotato
12 error Linux 4.1.18-v7+
13 error argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "bundle"
14 error node v4.6.0
15 error npm v2.15.9
16 error code ELIFECYCLE
17 error [email protected] bundle: mkdir -p bundle && cp -r {.env,index.js,lib,node_modules} bundle/ && cd bundle && bestzip ../lambda.zip * .env && rm -rf ../bundle
17 error Exit status 1
18 error Failed at the [email protected] bundle script 'mkdir -p bundle && cp -r {.env,index.js,lib,node_modules} bundle/ && cd bundle && bestzip ../lambda.zip * .env && rm -rf ../bundle'.
18 error This is most likely a problem with the alexa-couchpotato package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error mkdir -p bundle && cp -r {.env,index.js,lib,node_modules} bundle/ && cd bundle && bestzip ../lambda.zip * .env && rm -rf ../bundle
18 error You can get information on how to open an issue for this project with:
18 error npm bugs alexa-couchpotato
18 error Or if that isn't available, you can get their info via:
18 error
18 error npm owner ls alexa-couchpotato
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

OK managed to upload using the lambda deploy instead..

Can't get the lambda working

I can't seem to get the lambda working on this one, I have done the alexa-sickbeard and that works fine...I seem to have a couple of issues...

The npm run bundle fails on my windows machine (worked fine for alexe-sickbeard, so I packaged the zip myself, with the index.js/.env/node_modules/lib dir and uploaded to my lambda, when I make a request its returning with -

{
"errorMessage": "Unexpected reserved word",
"errorType": "SyntaxError",
"stackTrace": [
"Module._compile (module.js:373:25)",
"Object.Module._extensions..js (module.js:416:10)",
"Module.load (module.js:343:32)",
"Function.Module._load (module.js:300:12)",
"Module.require (module.js:353:17)",
"require (internal/module.js:12:17)"
]
}

Any idea?

Thanks

The remote endpoint could not be called

Total newbie here, I scrambled along and got everything set up. When testing the skill through the service simulator, I'm getting "The remote endpoint could not be called, or the response it returned was invalid." Most "if" requests do work though, a few dont, if I type in "if friday is on the list" it returns the above error. "Add" doesn't work for me with anything, for example "to add kedi to the list" returns "The response is invalid". Any help would be greatly appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.