I'm working on a tutorial step by step for google Assistant, using Dialogflow to detect intents.
Each step is related to an audio record, that i call by the Fullfiment method.
For each step i d'like to use command like :
- previous (go back to the previous step)
- Next (next step)
- Pause (make a pause)
- repeat
But to be practical and conversationnal, i need that the user can say the command at any time. Is there a specific method to let the mic open during a the time i stream the audio response?
Have you some example of voice app that work like that ?
Thanks very much.
There is no way to have the microphone open arbitrarily while it is being used. However, the user is able to interrupt the Action at any time by saying "Hey Google", and then giving a follow-up command.
Related
I am currently working on a project where I'd need to integrate a django application with mastodon, a federated twitter-like service.
In order to interact with Mastodon, I use Mastodon.py package: https://mastodonpy.readthedocs.io/en/stable/#
I would need to monitor events occurring to a specific mastodon account, a bot account managed by the django application, using the streaming capabilities provided by the package: https://mastodonpy.readthedocs.io/en/stable/#streaming
So I would need to call one of these stream methods in an infinite loop. But I can't figure out where I should place it in django. Is there a main loop somewhere where I could insert it?
You need to run this kind of things in the background. There are many options you can choose from to setup background processing.
I find the following quite easy to set up and it might be a good start for you.
Django Background tasks
Basically you create a function/job which should be done in background. You annotate it with special decorator to register as a task.
You can then choose when to run - in your case - you can run it repeatedly every certain amount of time ( no need for "infinite" loop in your job task).
It is database backend task queue - so you will run a process which monitors your tasks and run them in chosen times. See docs for detail.
Maybe you can create a django command,place your infinite loop in there, and let supervisor handle the daemonization
You can create a method to process whatever you want and call that method in files such as urls.py(which will get called only once when the server starts).
Infinite loops are not really recommended when working at Django,but, if you cannot make it work with a method ,a good solution would be to create a seperate thread and run your infinite loop there.
This way the Django application will keep being active and non-blocked and you will have the loop running and waiting for an event.
I honestly don't know if performance and speed wise this is a good solution but it does the job.
I have a Beam Pipeline running on Google Dataflow that takes inputs from Pubsub and Groups them by Key before processing the time-series data. Somehow when I run the pipeline, the code seems unable to process the GroupByKey step and the rest of the steps don't get run. (See attached screenshot for console output at the Group By Key step)
Window<KV<String, Data>> window = Window.<KV<String, Data>>into(FixedWindows.of(Duration.standardHours(1)))
.triggering(Repeatedly.forever(pastEndOfWindow()))
.withAllowedLateness(Duration.standardSeconds(10))
.discardingFiredPanes();
PCollection<KV<String, List<Data>>> keyToDataList = data.apply("Add Event Timestamp", WithTimestamps.of(new EventTimestampFunction()))
.apply("Windowing", window)
.apply("Group by Key", GroupByKey.create())
.apply("Sort by date", ParDo.of(new SortDataFn()));
The strange thing is that the code used to work in the past but while testing out some small part modified downstream, the GroupByKey didn't work anymore. The worst thing was that reverting to the previous git version also didn't work. I tried cleaning the build, copying out the previous working files out into a new folder and they all didn't work. I'm tearing out my hair now so if anyone has some insights into this issue I'd really appreciate if you could help! Thanks in advance!!
I am using Wowza Engine 4.5.0 and I am trying to change the chunk ID numbering based on incoming packet time, instead of the default sequential number that cause problems when restarting the encoder.
From something like this
...media_w112312312_b1024000_7.ts
...media_w112312312_b1024000_8.ts
to a timestamp notation where the chunks continue even after a restart
I read about the property cupertinoCalculateChunkIDBasedOnTimecode, I follow the instructions in this guide to configure it:
https://www.wowza.com/docs/how-to-configure-apple-hls-packetization-cupertinostreaming#livepropref
but it does not work or I am doing something wrong. Has anyone used the property
cupertinoCalculateChunkIDBasedOnTimecode successfully?
many thanks
I have used 'cupertinoCalculateChunkIDBasedOnTimecode' property and even if I restart my encoder, players are able to pick up the stream and play successfully.
The below page will help you in using it properly
http://thewowza.guru/how-to-set-stream-timecodes-to-absolute-time/
I'm new Bie in Python.
I wanna trace a python project "youtube download" which provides a bunch of functions to download youtube videos , however i only wanna know when i trigger one of the method in the project. like
"./youtube-dl <YOUTUBE_URL> -t"
it will download the youtube stream and save the title.
i just wanna know when i trigger the command what functions will be called ,
i don't want to "know/trace" other functions not related the command i triggered.
is there any debug mode option, or what kind of setting can let me do the job!
thanks you all in advance^^
I'm trying to test the happy-path for a piece of code which takes a long time to respond, and then begins writing a file to the response output stream, which prompts a download dialog in browsers.
The problem is that this process has failed in the past, throwing an exception after this long amount of work. Is there a way in selenium to wait-for-download or equivalent?
I could throw in a Thread.sleep, but that would be inaccurate and unnecessarily slow down the test run.
What should I do, here?
I had the same problem. I invented something to solve the problem. A tempt file is created by Python with '.part' extension. So, if still we have the temp, python can wait for 10 second and check again if the file is downloaded or not yet.
while True:
if os.path.isfile('ts.csv.part'):
sleep(10)
elif os.path.isfile('ts.csv'):
break
else:
sleep(10)
driver.close()
So you have two problems here:
You need to cause the browser to download the file
You need to measure when the downloaded file is complete
Neither problemc an be directly solved by Selenium (yet - 2.0 may help), but both are solvable problems. The first problem can be solved by GUI automation toolkits, such as AutoIT. But they can also be solved by simply sending an automated keypress at the OS level that simulates the enter key (works for Firefox, a little harder on some versions of Chrome and Safari). If you're using Java, you can use Robot to do that. Other languages have similar toolkits to do such a thing.
The second issue is probably best solved with some sort of proxy solution. For example, if your browser was configured to go through a proxy and that proxy had an API, you could query the proxy with that API to ask when network activity had ended.
That's what we do at http://browsermob.com, which is a a startup I founded that uses Selenium to do load testing. We've released some of the proxy code as open source, available at http://browsermob.com/tools.
But two problems still persist:
You need to configure the browser to use the proxy. In Selenium 2 this is easier, but it's possible to do it with Selenium 1 as well. The key is just making sure that your browser launcher brings up the browser with the right profile/settings.
There currently is no API for BrowserMob proxy to tell you when network traffic has stopped! This is a big hole in the concept of the project that I want to fix as soon as I get the time. However, if you're keen to help out, join the Google Group and I can definitely point you in the right direction.
Hope that helps you identify your various options. Best of luck!
This is Chrome-testing-only solution for controlling the downloads with javascript..
Using WebDriver (Selenium2) it can be done within Chrome's chrome:// which is HTML/CSS/Javascript:
driver.get( "chrome://downloads/" );
waitElement( By.CssSelector("#downloads-summary-text") );
// next javascript snippet cancels the last/current download
// if your test ends in file attachment downloading
// you'll very likely need this if you more re-instantiated tests left
((JavascriptExecutor)driver).executeScript("downloads.downloads_[0].cancel_();");
There are other Download.prototype.functions in "chrome://downloads/downloads.js"
This suites you if you just need to test some info note eg. caused by file attachment starting activity, and not the file itself.
Naturally you need to control step 1. - mentioned by Patrick above - and by this you control step 2. FOR THE TEST, not for the functionality of actual file download completion / cancel.
See also : Javascript: Cancel/Stop Image Requests which is relating to Browser stopping.
This falls under the "things that can't be automated" category. Selenium is built with JavaScipt and due to JavaScript sandbox restrictions it can't access downloads.
Selenium 2 might be able to do this once Alerts/Prompts have been implemented but that this won't happen for the next little while yet.
If you want to check for the download dialog, try with AutoIt. I use that for uploading and downloading the files. Using AutoIt with Se RC is easier.
def file_downloaded?(file)
while File.file?(file) == false
p "File downloading in progress..."
sleep 1
end
end
*Ruby Syntax