alexa-pi / AlexaPiDEPRECATED

DEPRECATED - Use https://github.com/alexa-pi/AlexaPi instead ...Turn a Raspberry Pi into an Alexa Client
https://github.com/alexa-pi/AlexaPi
MIT License
587 stars 439 forks source link

"Alexa Stop" equivalent? #79

Closed benwoodley closed 7 years ago

benwoodley commented 8 years ago

Lets say you ask alexa "How many calories are in a carrot" she will begin waffling on for about a minute going into vast detail over all the different variations of carrots and you just want to shut her up, there isn't really a way of doing that (to my knowledge) apart from muting my amp with the remote.

Maybe make it so that if the button to record is single pressed it will just stop, and like when turning off the radio, you can stop her from talking and get her to answer a new question if you press and hold down the record button.

This would be a nice feature, it seems to get used alot with the echo's from what I've seen in demos of it.

gregwa1953 commented 8 years ago

You can also tell her to "Stop", at least I've been able to.

On Fri, May 6, 2016 at 12:41 PM, Hoki-gcav notifications@github.com wrote:

Lets say you ask alexa "How many calories are in a carrot" she will begin waffling on for about a minute going into vast detail over all the different variations of carrots and you just want to shut her up, there isn't really a way of doing that (to my knowledge) apart from muting my amp with the remote.

Maybe make it so that if the button to record is single pressed it will just stop, and like when turning off the radio, you can stop her from talking and get her to answer a new question if you press and hold down the record button.

This would be a nice feature, it seems to get used alot with the echo's from what I've seen in demos of it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/sammachin/AlexaPi/issues/79

GemBro commented 8 years ago

@ gregwa1953

How did you achieve that with AlexaPi? ... pressing the button again does not stop Alexa ... also, pressing the button and sayin' 'stop' does nothing either ... but pressing the button again does stop audio music & radio streams, it then resets to wait for another command

I think we maybe able to add a STOP feature in 'main.py' code, using another seperate button ... just needs to be in the same 'listening' loop, I think? ...

benwoodley commented 8 years ago

Id prefer it if it used the same button and just interrupted the while statement that stops it from going back to "Recording." state while Alexa talks.

GemBro commented 8 years ago

@ben

Or that ;) ...

gregwa1953 commented 8 years ago

It was under the "other" Alexa (the java version). I simply pressed the "start listening" button on the screen and said "Stop".

I assumed that it would work on this version as well.

On Fri, May 6, 2016 at 4:15 PM, GemBro notifications@github.com wrote:

Or that ;) ...

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/sammachin/AlexaPi/issues/79#issuecomment-217576784

GemBro commented 8 years ago

@ gregwa1953

Ahh ok ... no it doesn't seem to work on the Python version (at least not on 1.1) ... thanks for verifying ;) ...

gregwa1953 commented 8 years ago

@GemBro, sorry about that.

On Sat, May 7, 2016 at 5:58 PM, GemBro notifications@github.com wrote:

@ gregwa1953

Ahh ok ... no it doesn't seem to work on the Python version (at least not on 1.1) ... thanks for verifying ;) ...

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/sammachin/AlexaPi/issues/79#issuecomment-217677790

GemBro commented 8 years ago

@ gregwa1953

Hey no worries ... glad we know which one it does work on ;) ...

ProfessionalParanoid commented 8 years ago

I am running a version of this that flooie put together to address a url parsing issue, and I can stop by pressing the button a second time. flooie's push is described under the TuneIn so close Issue#71. My Alexa in action with stop: http://other.bagpipez.com/Projects/

flooie commented 8 years ago

@ProfessionalParanoid I figure - if you're pushing the button you probably want to tell it something -

flooie commented 8 years ago

@ProfessionalParanoid - I think my new updated version handles all the issues (besides wake word) if someone is willing to try it out - I made it version1.1.1 - also this is my first time contributing to code online - so please let me know if I'm doing anything wrong - @GemBro @sammachin

it still needs some clean up but it seems to handle everything I've thrown at it.

GemBro commented 8 years ago

@flooie

Sounds great mate ... I'll give it a go ... have you got a link to the code? ...

On the other note ... I'm not a moderator for any of the AlexaPi issues or threads ;) ... I'm just an active (and excited) person loving this project ...

But you could start your own GIT page and include your code in it ... similar to what Sam & Lenny have done ... then you can have your own thread system for feedback and possible inclusion into Sam's AlexaPi ... the others will give you better pointers on how to go about this, as I'm pretty new to GIT too ;) ...

Appreciate your input though ... sounds promising ...

Although I.T. orientated, I wish I was a bit more confident in coding ... but I.T. & Electronic Design is my fung fu ... this project is what has drawn me here ... :) ...

flooie commented 8 years ago

@GemBro https://github.com/flooie/AlexaPi/tree/version1.1.1

GemBro commented 8 years ago

@flooie

Thanks mate ;) ... can I just change/edit the main.py of Sam's to yours, or do I need to do a full install of your version? ... in other words is it totally different to Sam's or just the main.py file that is different? ...

GemBro commented 8 years ago

@flooie

I have just tried your 1.1.1 version and I'm still having a problem with my radio station ... as in getting an error ;) ... I get the same error I get with Sam's 1.1 ... it wants to play my station but the URL is wrong and so bombs out (or seems to hang) ... a CNTRL X get's it back to cursor ...

As you can see it cannot parse the URL ... which needs to be either:

http://st8.webradioworld.net:8008 or http://st8.webradioworld.net:8008/listen.pls

The "listen.pls" on the end is normally required for most shoutcast streams that are on dedicated servers ... WinAmp, iTunes and VLC use this for audio streams ...

Does my station play for you? ...

ERROR REPORT:

Ready to Record. Recording...

Recording Finished.

Sending Speech Request... Processing Request Response... JSON String Returned: {"messageBody": {"directives": [{"namespace": "SpeechSynthesizer", "name": "speak", "payload": {"contentIdentifier": "amzn1.as-ct.v1.Domain:Application:Music#ACRI#DeviceTTSRendererV4_48078da5-0601-49f3-9c77-96704716033c", "audioContent": "cid:DeviceTTSRendererV4_48078da5-0601-49f3-9c77-96704716033c_1392776635"}}, {"namespace": "AudioPlayer", "name": "play", "payload": {"playBehavior": "REPLACE_PREVIOUS", "audioItem": {"streams": [{"progressReport": {"progressReportDelayInMilliseconds": 0, "progressReportIntervalInMilliseconds": 900000}, "streamUrl": "http://opml.radiotime.com/Tune.ashx?id=s111822&formats=aac,mp3&partnerId=!EALLOjB&serial=AFIHU5JRSUSO3FIXP5L7MSTDFWQQ&latlon=33.94211,-118.41749", "offsetInMilliseconds": 0, "expiryTime": "2016-05-16T16:12:39+0000", "streamId": "amzn1.as-ct.v1.Dee-Domain-Music#ACRI#url#ACRI#c5492308-7e3e-4d9f-a5d5-288ce04d4a7b:1", "progressReportRequired": true}], "audioItemId": "amzn1.as-ct.v1.Dee-Domain-Music#ACRI#url#ACRI#c5492308-7e3e-4d9f-a5d5-288ce04d4a7b:1"}, "navigationToken": "amzn1.as-ct.v1.Dee-Domain-Music#ACRI#url#ACRI#c5492308-7e3e-4d9f-a5d5-288ce04d4a7b:1"}}]}, "messageHeader": {}} Play_Audio Request for: /home/pi/AlexaPi/tmpcontent/DeviceTTSRendererV4_48078da5-0601-49f3-9c77-96704716033c_1392776635.mp3 Player State: State.Opening Player State: State.Playing Player State: State.Ended Ready to Record. Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 763, in run self.__target(_self.args, _self.__kwargs) File "main.py", line 265, in play_audio file = tuneinplaylist(file) File "main.py", line 256, in tuneinplaylist r = requests.get(req.content) File "/usr/lib/python2.7/dist-packages/requests/api.py", line 60, in get return request('get', url, _kwargs) File "/usr/lib/python2.7/dist-packages/requests/api.py", line 49, in request return session.request(method=method, url=url, *_kwargs) File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 443, in request prep = self.prepare_request(req) File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 374, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/usr/lib/python2.7/dist-packages/requests/models.py", line 304, in prepare self.prepare_url(url, params) File "/usr/lib/python2.7/dist-packages/requests/models.py", line 354, in prepare_url scheme, auth, host, port, path, query, fragment = parse_url(url) File "/usr/lib/python2.7/dist-packages/urllib3/util/url.py", line 143, in parse_url raise LocationParseError(url) LocationParseError: Failed to parse: st8.webradioworld.net:8008 http:

... hanging ... CNTRL X get's it back to cursor ...

flooie commented 8 years ago

@GemBro try it now - added checking for 8008 file - hope it doesn't break other things ,but it now works for that station.

GemBro commented 8 years ago

Is this version 1.1.1b now? ... :) ... can I just overwrite or edit your previous main.py file? ... I'll have a play now ...

GemBro commented 8 years ago

@flooie

Ok cool that worked :) ... nice work mate ... my funky station is playing ...

Those number (you have parsed in the code), 8008, 9008, etc, are the shoutcast stream port numbers ... there are many different ones and they can change for different stations ... that might cause a headache trying to add all of them ... ;) ... but it's a start ... can that part of the code be wildcarded? ...

Now for the bad news ... (UK) BBC Radio 2, etc, do not work now ... as with BBC Radio London ... they go into a loop ... they do work fine with v1.1 though ... Kiss FM still works ... so maybe the code has gone way side for the UK stations? ...

Solved one ... but it did break others (as you said hoped it wouldn't) ... ;) ... but I think you're onto something flooie ;) ... this is probably similar to what Sam is doing? ...

flooie commented 8 years ago

@GemBro - try now

GemBro commented 8 years ago

That's the one flooie ... works great now :) ... I have checked the others and they are fine too (still) ... nice job ... thanks ...

renekliment commented 7 years ago

This project is now deprecated in favor of the new AlexaPi (https://github.com/alexa-pi/AlexaPi) which has all the features of this project and much more, such as:

Please switch over to the new project and if your issue persists there, file an issue in the new repo's issue tracker. Thank you.