From f7972338208c45795286717523599a89f19e8543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Thu, 27 Jul 2023 00:02:07 +0100 Subject: [PATCH] Add support for EPO files --- .gitignore | 1 + README.md | 8 ++++++++ huami_token.py | 4 ++-- main.py | 8 +++++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9f8c5f7..a23b4c3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ cep_7days.zip cep_1week.zip cep_pak.bin lle_1week.zip +epo.zip credentials.* README.html tmp diff --git a/README.md b/README.md index 584cd3c..1a00919 100644 --- a/README.md +++ b/README.md @@ -18,20 +18,28 @@ wiki](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Huami-Server-Pairing Install [Buildozer](https://github.com/kivy/buildozer/) and [Kivy](https://github.com/kivy/kivy) +```bash pip install buildozer pip install kivy +``` or +```bash pip install -r requirements.txt +``` ### Run +```bash python main.py +``` ### Make Android apk +```bash buildozer -v android debug deploy run +``` ## User diff --git a/huami_token.py b/huami_token.py index f2bca6f..ed77377 100644 --- a/huami_token.py +++ b/huami_token.py @@ -161,8 +161,8 @@ class HuamiAmazfit: def get_gps_data(self) -> None: """Download GPS packs: almanac and AGPS""" - agps_packs = ["AGPS_ALM", "AGPSZIP", "LLE", "AGPS"] - agps_file_names = ["cep_1week.zip", "cep_7days.zip", "lle_1week.zip", "cep_pak.bin"] + agps_packs = ["AGPS_ALM", "AGPSZIP", "LLE", "AGPS", "EPO"] + agps_file_names = ["cep_1week.zip", "cep_7days.zip", "lle_1week.zip", "cep_pak.bin", "epo.zip"] agps_link = urls.URLS['agps'] headers = urls.PAYLOADS['agps'] diff --git a/main.py b/main.py index 1379484..31a3572 100644 --- a/main.py +++ b/main.py @@ -471,7 +471,7 @@ class Main(App): self.huamidevice.get_gps_data() agps_file_names = ["cep_alm_pak.zip"] - agps_file_names = ["cep_1week.zip", "cep_7days.zip", "lle_1week.zip", "cep_pak.bin"] + agps_file_names = ["cep_1week.zip", "cep_7days.zip", "lle_1week.zip", "cep_pak.bin", "epo.zip"] data_dir="./tmp" if ( platform == 'android' ): from jnius import autoclass @@ -479,6 +479,9 @@ class Main(App): Environment = autoclass('android.os.Environment') File = autoclass('java.io.File') data_dir = Environment.getExternalStorageDirectory().getPath() + elif not os.path.exists(data_dir): + os.mkdir(data_dir) + debug_print(data_dir) for filename in agps_file_names: sdpathfile = os.path.join(data_dir, filename) @@ -486,6 +489,9 @@ class Main(App): print(f"process {filename}") if "zip" not in filename: continue + if filename == "epo.zip": + # epo zip files should not be extracted + continue with zipfile.ZipFile(filename, "r") as zip_f: #zip_f.extractall() zip_f.extractall(data_dir)