1
0
Fork 0
mirror of https://codeberg.org/vanous/huafetcher synced 2024-05-06 08:46:16 +02:00

Add support for EPO files

This commit is contained in:
José Rebelo 2023-07-27 00:02:07 +01:00
parent f599a645de
commit f797233820
4 changed files with 18 additions and 3 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ cep_7days.zip
cep_1week.zip
cep_pak.bin
lle_1week.zip
epo.zip
credentials.*
README.html
tmp

View File

@ -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

View File

@ -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']

View File

@ -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)