MycroftAI / Mycroft-Android

Android companion app, sends commands from your Android device to your Mycroft system and returns the output as speech or other medium to the Android device.
GNU General Public License v3.0
351 stars 130 forks source link

Distribute on F-Droid #63

Open nicolasmaia opened 6 years ago

nicolasmaia commented 6 years ago

It would be amazing to have this on https://f-droid.org/ !

paulscott56 commented 6 years ago

There was someone doing this a while back, not sure what happened there though. Would be cool if you could pick it up again

nicolasmaia commented 6 years ago

pinging @rudloff

Rudloff commented 6 years ago

Hello, We can't include this app in F-Droid because it requires the play-services-wearable library which is not free: https://github.com/MycroftAI/Mycroft-Android/blob/4418acbae3cfbaa41eeeb3a8dfd152cfa90c64bd/mobile/build.gradle#L84

nicolasmaia commented 6 years ago

Well that's a bummer. @paulscott56: is it possible to distribute a gradle flavor without this dependency?

jleaders commented 5 years ago

Is this on Google Play store? I couldn't find it there. Please add the app store icons / links to the Readme.md

vn971 commented 4 years ago

Alternatively, try to understand what is really needed from play-services-wearable, and consider using an alternative?

Search on github reveals only 2 places that use Wearable: https://github.com/MycroftAI/Mycroft-Android/search?q=wearable&unscoped_q=wearable

Guessing by the name, a web request made instead could possibly solve the problem.

vn971 commented 4 years ago

Note that a play-services-wearable dependency also blocks de-google-ified users from using Mycroft. This audience intersects with Mycroft audience heavily! Naturally, if you avoid Amazon and opt for Mycroft, you may already have your phone de-google-ified long ago.

Maybe up the priority, to have a greater audience reach? The real issue is then not only to publish on F-Droid, but also make the app really runnable for all users. Even for those who installed from APK / Aurora Store / Yalp. Being buildable by F-Droid would be an excellent test to make sure the goal is really reached.. ;-)

igoralmeida commented 1 year ago

I got a Pi4 recently to run mycroft-core and thought I could give this a try.

F-Droid

Turns out it was fairly easy to get F-Droid to build the apk. I simply continued what was mentioned in #104 and kept removing stuff until it worked (for me®). The result is 82c686, which can be used with an appropriate fdroiddata yml file (Yes, it's a local path there). I don't have most Play stuff enabled on my phone, though, so chatting is fine but speech input doesn't work with this commit.

Speech input

Next I tried to do some sort of bypass in the app and get mycroft-core itself to do the speech processing (pretty much the last bullet points in #82 ).

I did this with 8af1a7, which basically hijacks the STT button to serve as start/stop recording. Once recorded, the file is sent as

{"data": {"filebytes": "<base64-encoding>"},
 "type": "mycroft.mic.recordedfile",
 "context": null}

The ugly part is that the base64 string shows up in a chat bubble. I don't really understand how that part works, so it could use some love from more knowledgeable people.

Core

In mycroft-core, the handler for mycroft.mic.recordedfile is similar to mycroft.mic.listen.

  1. First thing is to use audiofile to convert the file to a .wav (I had to install ffmpeg)
  2. It bypasses the wakeword checking by setting ResponsiveRecognizer._listen_triggered
  3. Then ResponsiveRecognizer (temporarily) uses Wave_read.readframes in place of _record_phrase.

Code is at c6c5c4. The working copy in my pi4 is still dirty due to debugging stuff, so (while unlikely) I might have missed something.

Future

No idea. I'm not creating PRs for these because it's proof-of-concept code. I had to delete the entire wear module, for example, but an actual F-Droid implementation would perhaps use a prebuild line or a separate "flavor" (IIUC).

I'm happy to answer any questions and will fix anything that prevents people from reproducing what I did, but I will not be distributing any APKs.

It was quite fun to hack this, props for the well-structured codebase. Thanks.