download swiss ephemeris files as needed

This commit is contained in:
2025-07-16 11:35:34 -07:00
parent 08f2924c2a
commit 967d5aa16a
3 changed files with 23 additions and 5 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
_* _*
.venv .venv
swisseph
-3
View File
@@ -1,3 +0,0 @@
[submodule "swisseph"]
path = swisseph
url = https://github.com/aloistr/swisseph.git
+21 -1
View File
@@ -2,13 +2,31 @@ import swisseph as swe
from datetime import datetime from datetime import datetime
import webbrowser import webbrowser
from urllib.parse import quote_plus from urllib.parse import quote_plus
from urllib.request import urlretrieve
from threading import Thread from threading import Thread
from os import chdir from os import makedirs,path
import http.server import http.server
import asyncio import asyncio
import twitchio import twitchio
import json import json
def download_files():
if not path.exists(script_path()+'swisseph/ephe/'):
makedirs(script_path()+'swisseph/ephe/')
#if not path.exists(script_path()+'swisseph/ephe/sefstars.txt'):
# print('downloading sefstars.txt')
# urlretrieve('https://github.com/aloistr/swisseph/raw/refs/heads/master/ephe/sefstars.txt',script_path()+'swisseph/ephe/sefstars.txt')
if not path.exists(script_path()+'swisseph/ephe/seas_18.se1'):
print('downloading seas_18.se1')
urlretrieve('https://github.com/aloistr/swisseph/raw/refs/heads/master/ephe/seas_18.se1',script_path()+'swisseph/ephe/seas_18.se1')
#if not path.exists(script_path()+'swisseph/ephe/semo_18.se1'):
# print('downloadingh semo_18.se1')
# urlretrieve('https://github.com/aloistr/swisseph/raw/refs/heads/master/ephe/semo_18.se1',script_path()+'swisseph/ephe/semo_18.se1')
#if not path.exists(script_path()+'swisseph/ephe/sepl_18.se1'):
# print('downloading sepl_18.se1')
# urlretrieve('https://github.com/aloistr/swisseph/raw/refs/heads/master/ephe/sepl_18.se1',script_path()+'swisseph/ephe/sepl_18.se1')
print('swiss ephemeris files ready')
def get_planet_info(): def get_planet_info():
# make sure location is set in THIS thread # make sure location is set in THIS thread
swe.set_ephe_path(script_path()+'swisseph/ephe/') swe.set_ephe_path(script_path()+'swisseph/ephe/')
@@ -149,6 +167,8 @@ def script_load(settings):
pip.main(['install','-qqq','pyswisseph','twitchio','twitchio[starlette]']) pip.main(['install','-qqq','pyswisseph','twitchio','twitchio[starlette]'])
obspython.obs_data_set_bool(settings,'pip_done',True) obspython.obs_data_set_bool(settings,'pip_done',True)
download_files()
obs_settings=settings obs_settings=settings
def script_unload(): def script_unload():