mirror of
https://codeberg.org/vanous/huafetcher.git
synced 2025-01-10 15:12:01 +01:00
Add support for EPO files
This commit is contained in:
parent
f599a645de
commit
f797233820
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,6 +9,7 @@ cep_7days.zip
|
|||||||
cep_1week.zip
|
cep_1week.zip
|
||||||
cep_pak.bin
|
cep_pak.bin
|
||||||
lle_1week.zip
|
lle_1week.zip
|
||||||
|
epo.zip
|
||||||
credentials.*
|
credentials.*
|
||||||
README.html
|
README.html
|
||||||
tmp
|
tmp
|
||||||
|
@ -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)
|
Install [Buildozer](https://github.com/kivy/buildozer/) and [Kivy](https://github.com/kivy/kivy)
|
||||||
|
|
||||||
|
```bash
|
||||||
pip install buildozer
|
pip install buildozer
|
||||||
pip install kivy
|
pip install kivy
|
||||||
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
|
```bash
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
### Run
|
### Run
|
||||||
|
|
||||||
|
```bash
|
||||||
python main.py
|
python main.py
|
||||||
|
```
|
||||||
|
|
||||||
### Make Android apk
|
### Make Android apk
|
||||||
|
|
||||||
|
```bash
|
||||||
buildozer -v android debug deploy run
|
buildozer -v android debug deploy run
|
||||||
|
```
|
||||||
|
|
||||||
## User
|
## User
|
||||||
|
|
||||||
|
@ -161,8 +161,8 @@ class HuamiAmazfit:
|
|||||||
|
|
||||||
def get_gps_data(self) -> None:
|
def get_gps_data(self) -> None:
|
||||||
"""Download GPS packs: almanac and AGPS"""
|
"""Download GPS packs: almanac and AGPS"""
|
||||||
agps_packs = ["AGPS_ALM", "AGPSZIP", "LLE", "AGPS"]
|
agps_packs = ["AGPS_ALM", "AGPSZIP", "LLE", "AGPS", "EPO"]
|
||||||
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"]
|
||||||
agps_link = urls.URLS['agps']
|
agps_link = urls.URLS['agps']
|
||||||
|
|
||||||
headers = urls.PAYLOADS['agps']
|
headers = urls.PAYLOADS['agps']
|
||||||
|
8
main.py
8
main.py
@ -471,7 +471,7 @@ class Main(App):
|
|||||||
|
|
||||||
self.huamidevice.get_gps_data()
|
self.huamidevice.get_gps_data()
|
||||||
agps_file_names = ["cep_alm_pak.zip"]
|
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"
|
data_dir="./tmp"
|
||||||
if ( platform == 'android' ):
|
if ( platform == 'android' ):
|
||||||
from jnius import autoclass
|
from jnius import autoclass
|
||||||
@ -479,6 +479,9 @@ class Main(App):
|
|||||||
Environment = autoclass('android.os.Environment')
|
Environment = autoclass('android.os.Environment')
|
||||||
File = autoclass('java.io.File')
|
File = autoclass('java.io.File')
|
||||||
data_dir = Environment.getExternalStorageDirectory().getPath()
|
data_dir = Environment.getExternalStorageDirectory().getPath()
|
||||||
|
elif not os.path.exists(data_dir):
|
||||||
|
os.mkdir(data_dir)
|
||||||
|
|
||||||
debug_print(data_dir)
|
debug_print(data_dir)
|
||||||
for filename in agps_file_names:
|
for filename in agps_file_names:
|
||||||
sdpathfile = os.path.join(data_dir, filename)
|
sdpathfile = os.path.join(data_dir, filename)
|
||||||
@ -486,6 +489,9 @@ class Main(App):
|
|||||||
print(f"process {filename}")
|
print(f"process {filename}")
|
||||||
if "zip" not in filename:
|
if "zip" not in filename:
|
||||||
continue
|
continue
|
||||||
|
if filename == "epo.zip":
|
||||||
|
# epo zip files should not be extracted
|
||||||
|
continue
|
||||||
with zipfile.ZipFile(filename, "r") as zip_f:
|
with zipfile.ZipFile(filename, "r") as zip_f:
|
||||||
#zip_f.extractall()
|
#zip_f.extractall()
|
||||||
zip_f.extractall(data_dir)
|
zip_f.extractall(data_dir)
|
||||||
|
Loading…
Reference in New Issue
Block a user