This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Button freezes Pythonista
@techteej Here's some snippets to get you going with automating the upload... give the file button an id in the HTML... then you can leave the WebView hidden and click the file button automatically from your microphone button. Another nice thing to do would be to make the app close down smoothly by stopping the server... you could do that by subclassing the View and stopping it in the will close.
@techteej I've confirmed that it's possible to complete the automation by checking for the video capture to complete and automatically clicking the upload button when it does... all with the WebView hidden. I'll post the code here if you want.
techteej last edited by
@tony Yes, please. As of right now when I press take photo or video it just crashes.
@tony, instead of pasting your code here, it would be best if you edited the program at https://github.com/tjferry14/Fun-Pythonista-Tools/blob/master/speech.py and the submitted a "pull request". That way we can all be looking at the same version.
@ccc I'll maybe let techteej to do that when he's happy with his version.
@techteej Import sound (just temporarily while you're testing, the beep will confirm the script is waiting for the video file) and then give ids to the form and submit button of form and submit. Then use this in your microphone button...
techteej last edited by
@tony This still crashes Pythonista.
@techteej It works here on iPad mini (original). If it doesn't work for you (from a clean start of Pythonista) then it may be to do with the threading issue. It's only a guess why the ui.delay of an empty function for zero time helps, all we can say for sure is 'it does because it does' on one device anyway.
When Pythonista gets into the threading issue... one run of a script is not necessarily the same as a second... so it's worth to try from a clean start of Pythonista, (if you haven't already). Otherwise I don't know what to say except it must be frustrating (been there!)
I am struggling to understand this code.
do_POST()never get called.
do_GET()only gets called once with self.path set to '/'.
What is supposed to happen after the user clicks "Use Video"?
@ccc That part is basically @omz's file transfer script. The flow goes...
First GET to the server is for the HTML.
The POST will happen when the video file is being submitted... maybe you haven't got to that point. In turn it will call 'get unused file name' to get a free one if the name of the uploaded file is in use.
So when you click "Use Video" does
When I check the code out of the repo and run it and tap the record button and select "video" and record a video and tap "Use Video" nothing happens. There is no video file stored in the local directory. The beep in the background continues every 2 seconds until Pythonista times out.
Are you using the current code in the repo? What is the name and full path of the video file that gets saved?
@ccc The repo is missing the step of adding ids to the form and submit button of form and submit respectively. The file is saved to the same directory as the script. For a video it's capturedvideo.MOV.
I just submitted a pull request with the two ids added.