libaditya 0.3.4__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- libaditya/__init__.py +46 -0
- libaditya/_version.py +29 -0
- libaditya/calc/__init__.py +9 -0
- libaditya/calc/api.py +30 -0
- libaditya/calc/avasthas.py +346 -0
- libaditya/calc/docs/jaimini-get-arch.md +95 -0
- libaditya/calc/hellenistic.py +37 -0
- libaditya/calc/jaimini.py +335 -0
- libaditya/calc/jaimini_get.py +240 -0
- libaditya/calc/kala.py +73 -0
- libaditya/calc/panchanga.py +422 -0
- libaditya/calc/rashi.py +612 -0
- libaditya/calc/returns.py +50 -0
- libaditya/calc/swe_functions.py +118 -0
- libaditya/calc/varga.py +287 -0
- libaditya/calc/vimshottari.py +431 -0
- libaditya/cards/__init__.py +5 -0
- libaditya/cards/card.py +90 -0
- libaditya/cards/cards_constants.py +115 -0
- libaditya/cards/cards_of_truth.py +323 -0
- libaditya/cards/cot.py +142 -0
- libaditya/cards/deck.py +52 -0
- libaditya/charts/__init__.py +6 -0
- libaditya/charts/api.py +36 -0
- libaditya/charts/bodygraph.py +80 -0
- libaditya/charts/chart.py +286 -0
- libaditya/charts/jaimini.py +83 -0
- libaditya/charts/tajika.py +36 -0
- libaditya/constants.py +1776 -0
- libaditya/draw/__init__.py +20 -0
- libaditya/draw/draw_bodygraph.py +489 -0
- libaditya/draw/draw_sbc.py +712 -0
- libaditya/draw/themes/default-theme.hd +53 -0
- libaditya/ephe/ast0/se00010s.se1 +0 -0
- libaditya/ephe/seas_00.se1 +0 -0
- libaditya/ephe/seas_06.se1 +0 -0
- libaditya/ephe/seas_12.se1 +0 -0
- libaditya/ephe/seas_18.se1 +0 -0
- libaditya/ephe/seas_24.se1 +0 -0
- libaditya/ephe/seas_30.se1 +0 -0
- libaditya/ephe/seas_36.se1 +0 -0
- libaditya/ephe/seas_42.se1 +0 -0
- libaditya/ephe/seas_48.se1 +0 -0
- libaditya/ephe/seasm06.se1 +0 -0
- libaditya/ephe/seasm12.se1 +0 -0
- libaditya/ephe/seasm18.se1 +0 -0
- libaditya/ephe/seasm24.se1 +0 -0
- libaditya/ephe/seasm30.se1 +0 -0
- libaditya/ephe/seasm36.se1 +0 -0
- libaditya/ephe/seasm42.se1 +0 -0
- libaditya/ephe/seasm48.se1 +0 -0
- libaditya/ephe/seasm54.se1 +0 -0
- libaditya/ephe/sefstars.txt +4245 -0
- libaditya/ephe/semo_00.se1 +0 -0
- libaditya/ephe/semo_06.se1 +0 -0
- libaditya/ephe/semo_12.se1 +0 -0
- libaditya/ephe/semo_18.se1 +0 -0
- libaditya/ephe/semo_24.se1 +0 -0
- libaditya/ephe/semo_30.se1 +0 -0
- libaditya/ephe/semo_36.se1 +0 -0
- libaditya/ephe/semo_42.se1 +0 -0
- libaditya/ephe/semo_48.se1 +0 -0
- libaditya/ephe/semom06.se1 +0 -0
- libaditya/ephe/semom12.se1 +0 -0
- libaditya/ephe/semom18.se1 +0 -0
- libaditya/ephe/semom24.se1 +0 -0
- libaditya/ephe/semom30.se1 +0 -0
- libaditya/ephe/semom36.se1 +0 -0
- libaditya/ephe/semom42.se1 +0 -0
- libaditya/ephe/semom48.se1 +0 -0
- libaditya/ephe/semom54.se1 +0 -0
- libaditya/ephe/sepl_00.se1 +0 -0
- libaditya/ephe/sepl_06.se1 +0 -0
- libaditya/ephe/sepl_12.se1 +0 -0
- libaditya/ephe/sepl_18.se1 +0 -0
- libaditya/ephe/sepl_24.se1 +0 -0
- libaditya/ephe/sepl_30.se1 +0 -0
- libaditya/ephe/sepl_36.se1 +0 -0
- libaditya/ephe/sepl_42.se1 +0 -0
- libaditya/ephe/sepl_48.se1 +0 -0
- libaditya/ephe/seplm06.se1 +0 -0
- libaditya/ephe/seplm12.se1 +0 -0
- libaditya/ephe/seplm18.se1 +0 -0
- libaditya/ephe/seplm24.se1 +0 -0
- libaditya/ephe/seplm30.se1 +0 -0
- libaditya/ephe/seplm36.se1 +0 -0
- libaditya/ephe/seplm42.se1 +0 -0
- libaditya/ephe/seplm48.se1 +0 -0
- libaditya/ephe/seplm54.se1 +0 -0
- libaditya/hd/__init__.py +8 -0
- libaditya/hd/calc.py +55 -0
- libaditya/hd/constants.py +127 -0
- libaditya/hd/longitude.py +271 -0
- libaditya/objects/__init__.py +19 -0
- libaditya/objects/celestial_object.py +206 -0
- libaditya/objects/context.py +133 -0
- libaditya/objects/cusps.py +259 -0
- libaditya/objects/julian_day.py +265 -0
- libaditya/objects/location.py +167 -0
- libaditya/objects/longitude.py +987 -0
- libaditya/objects/nakshatras.py +285 -0
- libaditya/objects/planets.py +2059 -0
- libaditya/objects/shadbala.py +398 -0
- libaditya/objects/signs.py +690 -0
- libaditya/objects/swe_functions.py +75 -0
- libaditya/print_functions.py +548 -0
- libaditya/read.py +665 -0
- libaditya/stars/__init__.py +4 -0
- libaditya/stars/fixed_star.py +216 -0
- libaditya/stars/make_swe_stars.py +407 -0
- libaditya/stars/star-sign-boundaries +44 -0
- libaditya/stars/stellarium/__init__.py +6 -0
- libaditya/stars/stellarium/remote_control/__init__.py +22 -0
- libaditya/stars/stellarium/remote_control/location.py +82 -0
- libaditya/stars/stellarium/remote_control/locationsearch.py +35 -0
- libaditya/stars/stellarium/remote_control/main.py +165 -0
- libaditya/stars/stellarium/remote_control/objects.py +63 -0
- libaditya/stars/stellarium/remote_control/scripts.py +81 -0
- libaditya/stars/stellarium/remote_control/simbad.py +20 -0
- libaditya/stars/stellarium/remote_control/stelaction.py +31 -0
- libaditya/stars/stellarium/remote_control/stelproperty.py +30 -0
- libaditya/stars/stellarium/remote_control/view.py +85 -0
- libaditya/stars/stellarium/stellarium.py +92 -0
- libaditya/stars/the_stars.py +522 -0
- libaditya/stars/utilities.py +539 -0
- libaditya/utils.py +431 -0
- libaditya/write.py +67 -0
- libaditya-0.3.4.dist-info/METADATA +588 -0
- libaditya-0.3.4.dist-info/RECORD +131 -0
- libaditya-0.3.4.dist-info/WHEEL +5 -0
- libaditya-0.3.4.dist-info/licenses/LICENSE +661 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# RemoteControl is the package StellariumRC
|
|
2
|
+
# i changed the class Stellarium to RemoteControl, that is the only difference
|
|
3
|
+
# i copied and pasted the one directory of code into remote_control
|
|
4
|
+
# the license is mit, even though known of the file have the license in them
|
|
5
|
+
|
|
6
|
+
from . import main,objects,scripts,simbad,stelaction,stelproperty,location,locationsearch,view
|
|
7
|
+
|
|
8
|
+
class RemoteControl:
|
|
9
|
+
def __init__(self, ip="127.0.0.1", port=8090, password="") -> None:
|
|
10
|
+
self.password = password
|
|
11
|
+
self.ip = ip
|
|
12
|
+
self.port = port
|
|
13
|
+
self.main = main.Main(self.ip, self.port, self.password)
|
|
14
|
+
self.objects = objects.Objects(self.ip, self.port, self.password)
|
|
15
|
+
self.scripts = scripts.Scripts(self.ip, self.port, self.password)
|
|
16
|
+
self.simbad = simbad.Simbad(self.ip, self.port, self.password)
|
|
17
|
+
self.stelaction = stelaction.StelAction(self.ip, self.port, self.password)
|
|
18
|
+
self.stelproperty = stelproperty.StelProperty(self.ip, self.port, self.password)
|
|
19
|
+
self.location = location.Location(self.ip, self.port, self.password)
|
|
20
|
+
self.locationsearch = locationsearch.LocationSearch(self.ip, self.port, self.password)
|
|
21
|
+
self.view = view.View(self.ip, self.port, self.password)
|
|
22
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class Location:
|
|
4
|
+
def __init__(self, ip="127.0.0.1", port=8090, password=""):
|
|
5
|
+
self.ip = ip
|
|
6
|
+
self.port = port
|
|
7
|
+
self.password = password
|
|
8
|
+
|
|
9
|
+
def listLocations(self):
|
|
10
|
+
"""
|
|
11
|
+
Returns the list of all stored location IDs (keys of StelLocationMgr::getAllMap)
|
|
12
|
+
as JSON string array.
|
|
13
|
+
"""
|
|
14
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/location/list",
|
|
15
|
+
auth=("",self.password))
|
|
16
|
+
try:
|
|
17
|
+
return r.json()
|
|
18
|
+
except requests.exceptions.JSONDecodeError:
|
|
19
|
+
raise Exception(r.text)
|
|
20
|
+
|
|
21
|
+
def listCountries(self):
|
|
22
|
+
"""
|
|
23
|
+
Returns the list of all known countries (StelLocaleMgr::getAllCountryNames), as a
|
|
24
|
+
JSON array of objects of format.
|
|
25
|
+
"""
|
|
26
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/location/countrylist",
|
|
27
|
+
auth=("",self.password))
|
|
28
|
+
try:
|
|
29
|
+
return r.json()
|
|
30
|
+
except requests.exceptions.JSONDecodeError:
|
|
31
|
+
raise Exception(r.text)
|
|
32
|
+
|
|
33
|
+
def listPlanets(self):
|
|
34
|
+
"""
|
|
35
|
+
Returns the list of all solar system planet names (SolarSystem::getAllPlanetEnglishNames),
|
|
36
|
+
as a JSON array of objects of format
|
|
37
|
+
"""
|
|
38
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/location/planetlist",
|
|
39
|
+
auth=("",self.password))
|
|
40
|
+
try:
|
|
41
|
+
return r.json()
|
|
42
|
+
except requests.exceptions.JSONDecodeError:
|
|
43
|
+
raise Exception(r.text)
|
|
44
|
+
|
|
45
|
+
def planetImage(self,planet):
|
|
46
|
+
"""
|
|
47
|
+
Returns the planet texture image for the planet (english name)
|
|
48
|
+
"""
|
|
49
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/location/planetimage",
|
|
50
|
+
params={"planet":planet},auth=("",self.password))
|
|
51
|
+
if r.status_code == 200:
|
|
52
|
+
return r.content
|
|
53
|
+
else:
|
|
54
|
+
raise Exception(r.text)
|
|
55
|
+
|
|
56
|
+
def setLocation(self, id=None,latitude=None,longitude=None,
|
|
57
|
+
altitude=None,name=None,country=None,planet=None):
|
|
58
|
+
"""
|
|
59
|
+
Changes and moves to a new location. If id is given, all other parameters are ignored,
|
|
60
|
+
and a location is searched from the named locations using StelLocationMgr::locationForString
|
|
61
|
+
with the id. Else, the other parameters change the specific field of the current StelLocation.
|
|
62
|
+
"""
|
|
63
|
+
params={}
|
|
64
|
+
# below we can pass "no id", effectively
|
|
65
|
+
# used so we can pass something for id saying there is no id
|
|
66
|
+
if id == 0:
|
|
67
|
+
id = None
|
|
68
|
+
if not id == None:
|
|
69
|
+
params["id"] = id
|
|
70
|
+
else:
|
|
71
|
+
if not latitude == None: params["latitude"] = latitude
|
|
72
|
+
if not longitude == None: params["longitude"] = longitude
|
|
73
|
+
if not altitude == None: params["altitude"] = altitude
|
|
74
|
+
if not name == None: params["name"] = name
|
|
75
|
+
if not country == None: params["country"] = country
|
|
76
|
+
if not planet == None: params["planet"] = planet
|
|
77
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/location/setlocationfields",
|
|
78
|
+
params=params,auth=("",self.password))
|
|
79
|
+
if not r.text == "ok":
|
|
80
|
+
raise Exception(r.text)
|
|
81
|
+
else:
|
|
82
|
+
return r
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class LocationSearch:
|
|
4
|
+
def __init__(self, ip="127.0.0.1", port=8090, password=""):
|
|
5
|
+
self.ip = ip
|
|
6
|
+
self.port = port
|
|
7
|
+
self.password = password
|
|
8
|
+
|
|
9
|
+
def search(self,term):
|
|
10
|
+
"""
|
|
11
|
+
Searches the term in the list of predefined locations of the StelLocationMgr, and
|
|
12
|
+
returns a JSON string array of the results.
|
|
13
|
+
"""
|
|
14
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/locationsearch/search",
|
|
15
|
+
params={"term":term},auth=("",self.password))
|
|
16
|
+
try:
|
|
17
|
+
return r.json()
|
|
18
|
+
except requests.exceptions.JSONDecodeError:
|
|
19
|
+
raise Exception(r.text)
|
|
20
|
+
|
|
21
|
+
def nearby(self,planet,latitude,longitude,radius):
|
|
22
|
+
"""
|
|
23
|
+
Searches near the location defined by planet, latitude and longitude for predefined
|
|
24
|
+
locations (inside the given radius) using StelLocationMgr::pickLocationsNearby,
|
|
25
|
+
returns a JSON string array.
|
|
26
|
+
"""
|
|
27
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/locationsearch/nearby",
|
|
28
|
+
params={"planet":planet,"latitude":latitude,
|
|
29
|
+
"longitude":longitude,"radius":radius},
|
|
30
|
+
auth=("",self.password))
|
|
31
|
+
try:
|
|
32
|
+
return r.json()
|
|
33
|
+
except requests.exceptions.JSONDecodeError:
|
|
34
|
+
raise Exception(r.text)
|
|
35
|
+
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class Main:
|
|
4
|
+
def __init__(self, ip="127.0.0.1", port=8090, password=""):
|
|
5
|
+
self.ip = ip
|
|
6
|
+
self.port = port
|
|
7
|
+
self.password = password
|
|
8
|
+
|
|
9
|
+
def getStatus(self, format="json"):
|
|
10
|
+
params = {"format": format}
|
|
11
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/main/status",params=params,auth=("",self.password))
|
|
12
|
+
try:
|
|
13
|
+
return r.json()
|
|
14
|
+
except requests.exceptions.JSONDecodeError:
|
|
15
|
+
raise Exception(r.text)
|
|
16
|
+
|
|
17
|
+
def getPlugins(self):
|
|
18
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/main/plugins",auth=("",self.password))
|
|
19
|
+
try:
|
|
20
|
+
return r.json()
|
|
21
|
+
except requests.exceptions.JSONDecodeError:
|
|
22
|
+
raise Exception(r.text)
|
|
23
|
+
|
|
24
|
+
def getView(self,coord=None,ref=None):
|
|
25
|
+
"""
|
|
26
|
+
Returns the current view direction as JSON.
|
|
27
|
+
Without the optional coord, all versions are returned, including j2000, jNow and altAz. The returned
|
|
28
|
+
values are 3D vectors.
|
|
29
|
+
For the vector in altAz system, the actually returned values are based on an azimuth Az' counted
|
|
30
|
+
from South (x=1) towards East (y=1), Az'=180-Az.
|
|
31
|
+
If the optional parameter ref is given, it governs refraction setting and it applies to the jNow
|
|
32
|
+
output only. "On" applies refraction, "off" does not apply, and "auto" (or any other value) applies
|
|
33
|
+
it when atmosphere setting is active.
|
|
34
|
+
"""
|
|
35
|
+
params = {}
|
|
36
|
+
if coord is not None:
|
|
37
|
+
params["coord"] = coord
|
|
38
|
+
if ref is not None:
|
|
39
|
+
params["ref"] = ref
|
|
40
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/main/view",
|
|
41
|
+
params=params,auth=("",self.password))
|
|
42
|
+
try:
|
|
43
|
+
return r.json()
|
|
44
|
+
except requests.exceptions.JSONDecodeError:
|
|
45
|
+
raise Exception(r.text)
|
|
46
|
+
|
|
47
|
+
def setTimeJD(self,time):
|
|
48
|
+
"""
|
|
49
|
+
Sets the current Stellarium simulation time. The time parameter defines the current time (Julian day)
|
|
50
|
+
as passed to StelCore::setJD.
|
|
51
|
+
"""
|
|
52
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/main/time",
|
|
53
|
+
data={"time":time},auth=("",self.password))
|
|
54
|
+
if not r.text == 'ok':
|
|
55
|
+
raise Exception(r.text)
|
|
56
|
+
return r
|
|
57
|
+
|
|
58
|
+
def setTimeRateJD(self,timeRate):
|
|
59
|
+
"""
|
|
60
|
+
Sets the current Stellarium simulation timerate.The timerate parameter allows to change the speed at
|
|
61
|
+
which the simulation time moves (in JDay/sec) as passed to StelCore::setTimeRate.
|
|
62
|
+
"""
|
|
63
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/main/time",
|
|
64
|
+
data={"timerate":timeRate},auth=("",self.password))
|
|
65
|
+
if not r.text == 'ok':
|
|
66
|
+
raise Exception(r.text)
|
|
67
|
+
return r
|
|
68
|
+
|
|
69
|
+
def setTime(self,dt):
|
|
70
|
+
"""
|
|
71
|
+
Sets the current Stellarium simulation time. The dt parameter defines the current time as a datetime
|
|
72
|
+
object in Python standard library.
|
|
73
|
+
"""
|
|
74
|
+
jd = dt.timestamp() / 86400.0 + 2440587.5
|
|
75
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/main/time",
|
|
76
|
+
data={"time":jd},auth=("",self.password))
|
|
77
|
+
if not r.text == 'ok':
|
|
78
|
+
raise Exception(r.text)
|
|
79
|
+
return r
|
|
80
|
+
|
|
81
|
+
def setTimeRate(self,timeRate):
|
|
82
|
+
"""
|
|
83
|
+
Sets the current Stellarium simulation timerate.The timerate parameter allows to change the speed at
|
|
84
|
+
which the simulation time moves (in seconds per second). Negative timerates are also allowed, which
|
|
85
|
+
means that time moves backwards.
|
|
86
|
+
"""
|
|
87
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/main/time",
|
|
88
|
+
data={"timerate":timeRate/86400.0},auth=("",self.password))
|
|
89
|
+
if not r.text == 'ok':
|
|
90
|
+
raise Exception(r.text)
|
|
91
|
+
return r
|
|
92
|
+
|
|
93
|
+
def setFocus(self,target=None,position=None,mode=None):
|
|
94
|
+
"""
|
|
95
|
+
Sets the current app focus/selection.
|
|
96
|
+
If no parameters are given, the current selection is cleared.
|
|
97
|
+
If the target parameter was given, the object to be selected is looked up by name (first the localized
|
|
98
|
+
name is tried, then the english name).
|
|
99
|
+
If the optional mode parameter is given, it determines how to change the view. The default is 'center'
|
|
100
|
+
which selects the object and moves it into the view's center. If it is set to 'zoom', it automatically
|
|
101
|
+
zooms in on the object (StelMovementMgr::autoZoomIn) on selection and automatically zooms out when the
|
|
102
|
+
selection is cleared. If it is set to 'mark', the selection is just marked, but no view adjustment is done.
|
|
103
|
+
If the position parameter is used, it is interpreted as a coordinate in the J2000 frame, and focused
|
|
104
|
+
using StelMovementMgr::moveToJ2000. The mode parameter has no effect here. The target parameter takes
|
|
105
|
+
precendence over the position parameter, if both are given.
|
|
106
|
+
"""
|
|
107
|
+
params = {}
|
|
108
|
+
if target is not None:
|
|
109
|
+
params["target"] = target
|
|
110
|
+
if position is not None:
|
|
111
|
+
params["position"] = position
|
|
112
|
+
if mode is not None:
|
|
113
|
+
params["mode"] = mode
|
|
114
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/main/focus",
|
|
115
|
+
data=params,auth=("",self.password))
|
|
116
|
+
if not r.text == 'true':
|
|
117
|
+
raise Exception(r.text)
|
|
118
|
+
return r
|
|
119
|
+
|
|
120
|
+
def setMove(self,x,y):
|
|
121
|
+
"""
|
|
122
|
+
Allows viewport movement, like using the arrow keys in the main program.This operation defines the intended
|
|
123
|
+
move direction. x and y define the intended move speed in azimuth and altitude (i.e. a negative x means
|
|
124
|
+
left).
|
|
125
|
+
"""
|
|
126
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/main/move",
|
|
127
|
+
data={"x":x,"y":y},auth=("",self.password))
|
|
128
|
+
if not r.text == 'ok':
|
|
129
|
+
raise Exception(r.text)
|
|
130
|
+
return r
|
|
131
|
+
|
|
132
|
+
def setView(self,coord=None,vec=None,az=None,alt=None,ref="auto"):
|
|
133
|
+
"""
|
|
134
|
+
Sets the view direction.When the coord parameter is given, it defines the coordinate system to use for
|
|
135
|
+
vec parameter. The possible values are j2000, jNow and altAz.
|
|
136
|
+
An optional parameter ref governs refraction mode, default auto.
|
|
137
|
+
If the coord and vec parameters are not given, the az and alt parameters are used to define the view
|
|
138
|
+
in altitude/azimuth spherical coordinates/angles.
|
|
139
|
+
"""
|
|
140
|
+
params = {}
|
|
141
|
+
if coord is not None and vec is not None:
|
|
142
|
+
if not coord in ["j2000","jNow","altAz"]:
|
|
143
|
+
raise ValueError("coord must be j2000, jNow or altAz.")
|
|
144
|
+
params[coord] = str(vec)
|
|
145
|
+
params["ref"] = ref
|
|
146
|
+
elif az is not None and alt is not None:
|
|
147
|
+
params["az"] = az
|
|
148
|
+
params["alt"] = alt
|
|
149
|
+
else:
|
|
150
|
+
raise ValueError("Either coord and vec or az and alt must be given.")
|
|
151
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/main/view",
|
|
152
|
+
data=params,auth=("",self.password))
|
|
153
|
+
if not r.text == 'ok':
|
|
154
|
+
raise Exception(r.text)
|
|
155
|
+
return r
|
|
156
|
+
|
|
157
|
+
def setFov(self,fov):
|
|
158
|
+
"""
|
|
159
|
+
Sets the current field of view using StelCore::setFov.
|
|
160
|
+
"""
|
|
161
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/main/fov",
|
|
162
|
+
data={"fov":fov},auth=("",self.password))
|
|
163
|
+
if not r.text == 'ok':
|
|
164
|
+
raise Exception(r.text)
|
|
165
|
+
return r
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class Objects:
|
|
4
|
+
def __init__(self, ip="127.0.0.1", port=8090, password=""):
|
|
5
|
+
self.ip = ip
|
|
6
|
+
self.port = port
|
|
7
|
+
self.password = password
|
|
8
|
+
|
|
9
|
+
def findObject(self, name):
|
|
10
|
+
"""
|
|
11
|
+
Finds objects which match the search string str, which may contain greek/unicode
|
|
12
|
+
characters like in the SearchDialog. Returns a JSON String array of search matches.
|
|
13
|
+
"""
|
|
14
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/objects/find",
|
|
15
|
+
params={"str":name},auth=("",self.password))
|
|
16
|
+
try:
|
|
17
|
+
return r.json()
|
|
18
|
+
except requests.exceptions.JSONDecodeError:
|
|
19
|
+
raise Exception(r.text)
|
|
20
|
+
|
|
21
|
+
def getInfo(self, name=None, format="json"):
|
|
22
|
+
"""
|
|
23
|
+
Returns an info string about the object identified by name in HTML or JSON format.
|
|
24
|
+
If no parameter name is given, the currently selected object is used.
|
|
25
|
+
"""
|
|
26
|
+
params = {"format":format}
|
|
27
|
+
if name is not None:
|
|
28
|
+
params["name"] = name
|
|
29
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/objects/info",
|
|
30
|
+
params=params,auth=("",self.password))
|
|
31
|
+
if format == "json":
|
|
32
|
+
try:
|
|
33
|
+
return r.json()
|
|
34
|
+
except requests.exceptions.JSONDecodeError:
|
|
35
|
+
raise Exception(r.text)
|
|
36
|
+
else:
|
|
37
|
+
return r.text
|
|
38
|
+
|
|
39
|
+
def listObjectTypes(self):
|
|
40
|
+
"""
|
|
41
|
+
Returns all object types available in the internal catalogs as a JSON array of
|
|
42
|
+
objects of format.
|
|
43
|
+
"""
|
|
44
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/objects/listobjecttypes"
|
|
45
|
+
,auth=("",self.password))
|
|
46
|
+
try:
|
|
47
|
+
return r.json()
|
|
48
|
+
except requests.exceptions.JSONDecodeError:
|
|
49
|
+
raise Exception(r.text)
|
|
50
|
+
|
|
51
|
+
def listObjectsByType(self, type, english=False):
|
|
52
|
+
"""
|
|
53
|
+
Returns all objects of the specified type. If english is true, the english names
|
|
54
|
+
will be returned, otherwise the localized names will be returned. Returns a JSON
|
|
55
|
+
string array.
|
|
56
|
+
"""
|
|
57
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/objects/listobjectsbytype",
|
|
58
|
+
params={"type":type,"english":1 if english else 0},
|
|
59
|
+
auth=("",self.password))
|
|
60
|
+
try:
|
|
61
|
+
return r.json()
|
|
62
|
+
except requests.exceptions.JSONDecodeError:
|
|
63
|
+
raise Exception(r.text)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class Scripts:
|
|
4
|
+
def __init__(self, ip="127.0.0.1", port=8090, password=""):
|
|
5
|
+
self.ip = ip
|
|
6
|
+
self.port = port
|
|
7
|
+
self.password = password
|
|
8
|
+
|
|
9
|
+
def listScripts(self):
|
|
10
|
+
"""
|
|
11
|
+
Lists all known script files, as a JSON string array.
|
|
12
|
+
"""
|
|
13
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/scripts/list",
|
|
14
|
+
auth=("",self.password))
|
|
15
|
+
try:
|
|
16
|
+
return r.json()
|
|
17
|
+
except requests.exceptions.JSONDecodeError:
|
|
18
|
+
raise Exception(r.text)
|
|
19
|
+
|
|
20
|
+
def getInfo(self, id, html=False):
|
|
21
|
+
"""
|
|
22
|
+
Returns information about the script identified by id. If the parameter html is true,
|
|
23
|
+
the info is formatted using StelScriptMgr::getHtmlDescription and suitable for inclusion
|
|
24
|
+
into an iframe element, otherwise this operation returns a JSON object.
|
|
25
|
+
"""
|
|
26
|
+
params = {"id":id}
|
|
27
|
+
if html:
|
|
28
|
+
params["html"] = 1
|
|
29
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/scripts/info",
|
|
30
|
+
params=params,auth=("",self.password))
|
|
31
|
+
try:
|
|
32
|
+
if not html:
|
|
33
|
+
return r.json()
|
|
34
|
+
else:
|
|
35
|
+
return r.text
|
|
36
|
+
except requests.exceptions.JSONDecodeError:
|
|
37
|
+
raise Exception(r.text)
|
|
38
|
+
|
|
39
|
+
def getStatus(self):
|
|
40
|
+
"""
|
|
41
|
+
Returns the current script status as a JSON object.
|
|
42
|
+
"""
|
|
43
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/scripts/status"
|
|
44
|
+
,auth=("",self.password))
|
|
45
|
+
try:
|
|
46
|
+
return r.json()
|
|
47
|
+
except requests.exceptions.JSONDecodeError:
|
|
48
|
+
raise Exception(r.text)
|
|
49
|
+
|
|
50
|
+
def runScript(self, id):
|
|
51
|
+
"""
|
|
52
|
+
Runs the script with the given id. Will fail if a script is currently running.
|
|
53
|
+
"""
|
|
54
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/scripts/run",
|
|
55
|
+
data={"id":id},auth=("",self.password))
|
|
56
|
+
if not r.text == 'ok':
|
|
57
|
+
raise Exception(r.text)
|
|
58
|
+
return r
|
|
59
|
+
|
|
60
|
+
def executeCode(self, code, useIncludes=False):
|
|
61
|
+
"""
|
|
62
|
+
Directly executes the given script code. If useIncludes is given and evaluates to true,
|
|
63
|
+
the standard include folder will be used. Script execution will fail if a script is
|
|
64
|
+
already running.
|
|
65
|
+
"""
|
|
66
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/scripts/direct",
|
|
67
|
+
data={"code":code,"useIncludes":useIncludes},
|
|
68
|
+
auth=("",self.password))
|
|
69
|
+
if not r.text == 'ok':
|
|
70
|
+
raise Exception(r.text)
|
|
71
|
+
return r
|
|
72
|
+
|
|
73
|
+
def stopScript(self):
|
|
74
|
+
"""
|
|
75
|
+
Stops the execution of a running script.
|
|
76
|
+
"""
|
|
77
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/scripts/stop",
|
|
78
|
+
auth=("",self.password))
|
|
79
|
+
if not r.text == 'ok':
|
|
80
|
+
raise Exception(r.text)
|
|
81
|
+
return r
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class Simbad:
|
|
4
|
+
def __init__(self, ip="127.0.0.1", port=8090, password=""):
|
|
5
|
+
self.ip = ip
|
|
6
|
+
self.port = port
|
|
7
|
+
self.password = password
|
|
8
|
+
|
|
9
|
+
def lookup(self, keyword):
|
|
10
|
+
"""
|
|
11
|
+
Performs a SIMBAD lookup for the string keyword using the Stellarium-configured server
|
|
12
|
+
and returns the results as a JSON object of format.
|
|
13
|
+
"""
|
|
14
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/simbad/lookup",
|
|
15
|
+
params={"str":keyword},auth=("",self.password))
|
|
16
|
+
try:
|
|
17
|
+
return r.json()
|
|
18
|
+
except requests.exceptions.JSONDecodeError:
|
|
19
|
+
raise Exception(r.text)
|
|
20
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class StelAction:
|
|
4
|
+
def __init__(self, ip="127.0.0.1", port=8090, password=""):
|
|
5
|
+
self.ip = ip
|
|
6
|
+
self.port = port
|
|
7
|
+
self.password = password
|
|
8
|
+
|
|
9
|
+
def listActions(self):
|
|
10
|
+
"""
|
|
11
|
+
Lists all registered StelActions in JSON.
|
|
12
|
+
"""
|
|
13
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/stelaction/list",
|
|
14
|
+
auth=("",self.password))
|
|
15
|
+
try:
|
|
16
|
+
return r.json()
|
|
17
|
+
except requests.exceptions.JSONDecodeError:
|
|
18
|
+
raise Exception(r.text)
|
|
19
|
+
|
|
20
|
+
def doAction(self, id):
|
|
21
|
+
"""
|
|
22
|
+
Triggers or toggles the StelAction specified by id. If it was a boolean
|
|
23
|
+
action, returns the new state of the action.
|
|
24
|
+
"""
|
|
25
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/stelaction/do",
|
|
26
|
+
data={"id":id},auth=("",self.password))
|
|
27
|
+
if r.text in ['true','false']:
|
|
28
|
+
return r.text == 'true'
|
|
29
|
+
else:
|
|
30
|
+
raise Exception(r.text)
|
|
31
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class StelProperty:
|
|
4
|
+
def __init__(self, ip="127.0.0.1", port=8090, password=""):
|
|
5
|
+
self.ip = ip
|
|
6
|
+
self.port = port
|
|
7
|
+
self.password = password
|
|
8
|
+
|
|
9
|
+
def listProperties(self):
|
|
10
|
+
"""
|
|
11
|
+
Lists all registered StelProperties in JSON.
|
|
12
|
+
"""
|
|
13
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/stelproperty/list",
|
|
14
|
+
auth=("",self.password))
|
|
15
|
+
try:
|
|
16
|
+
return r.json()
|
|
17
|
+
except requests.exceptions.JSONDecodeError:
|
|
18
|
+
raise Exception(r.text)
|
|
19
|
+
|
|
20
|
+
def setProperty(self, id, value):
|
|
21
|
+
"""
|
|
22
|
+
Sets the StelProperty identified by id to the value value. The value is converted
|
|
23
|
+
to the StelProperty type using QVariant logic, an error is returned if this is
|
|
24
|
+
somehow not possible.
|
|
25
|
+
"""
|
|
26
|
+
r = requests.post(f"http://{self.ip}:{self.port}/api/stelproperty/set",
|
|
27
|
+
data={"id":id,"value":value},auth=("",self.password))
|
|
28
|
+
if not r.text == 'ok':
|
|
29
|
+
raise Exception(r.text)
|
|
30
|
+
return r
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
class View:
|
|
4
|
+
def __init__(self, ip="127.0.0.1", port=8090, password=""):
|
|
5
|
+
self.ip = ip
|
|
6
|
+
self.port = port
|
|
7
|
+
self.password = password
|
|
8
|
+
|
|
9
|
+
def listLandscape(self):
|
|
10
|
+
"""
|
|
11
|
+
Lists the installed landscapes as JSON.
|
|
12
|
+
"""
|
|
13
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/view/listlandscape",
|
|
14
|
+
auth=("",self.password))
|
|
15
|
+
try:
|
|
16
|
+
return r.json()
|
|
17
|
+
except requests.exceptions.JSONDecodeError:
|
|
18
|
+
raise Exception(r.text)
|
|
19
|
+
|
|
20
|
+
def landscapeDesciption(self,path):
|
|
21
|
+
"""
|
|
22
|
+
Provides virtual filesystem access to the current landscape directory. The operation
|
|
23
|
+
can take a longer path in the URL. The remainder is used to access files in the landscape
|
|
24
|
+
directory. If no longer path is given, the current HTML landscape description (as per
|
|
25
|
+
LandscapeMgr::getCurrentLandscapeHtmlDescription) is returned. An example:
|
|
26
|
+
landscapeDesciption("image.png") returns image.png from the current landscape directory.
|
|
27
|
+
This operation allows to set up an HTML iframe or similar for the landscape description,
|
|
28
|
+
including all images, etc. embedded in the HTML description.
|
|
29
|
+
"""
|
|
30
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/view/landscapedescription/{path}",
|
|
31
|
+
auth=("",self.password))
|
|
32
|
+
if r.status_code == 200:
|
|
33
|
+
return r.content
|
|
34
|
+
else:
|
|
35
|
+
raise Exception(r.text)
|
|
36
|
+
|
|
37
|
+
def listSkyculture(self):
|
|
38
|
+
"""
|
|
39
|
+
Lists the installed sky cultures as JSON.
|
|
40
|
+
"""
|
|
41
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/view/listskyculture",
|
|
42
|
+
auth=("",self.password))
|
|
43
|
+
try:
|
|
44
|
+
return r.json()
|
|
45
|
+
except requests.exceptions.JSONDecodeError:
|
|
46
|
+
raise Exception(r.text)
|
|
47
|
+
|
|
48
|
+
def skycultureDescription(self,path):
|
|
49
|
+
"""
|
|
50
|
+
Provides virtual filesystem access to the current skyculture directory. The operation
|
|
51
|
+
can take a longer path in the URL. The remainder is used to access files in the skyculture
|
|
52
|
+
directory. If no longer path is given, the current HTML skyculture description (as per
|
|
53
|
+
StelSkyCultureMgr::getCurrentSkyCultureHtmlDescription) is returned. An example:
|
|
54
|
+
skycultureDescription("image.png") returns image.png from the current skyculture directory.
|
|
55
|
+
This operation allows to set up an HTML iframe or similar for the skycultures description,
|
|
56
|
+
including all images, etc. embedded in the HTML description.
|
|
57
|
+
"""
|
|
58
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/view/skyculturedescription/{path}",
|
|
59
|
+
auth=("",self.password))
|
|
60
|
+
if r.status_code == 200:
|
|
61
|
+
return r.content
|
|
62
|
+
else:
|
|
63
|
+
raise Exception(r.text)
|
|
64
|
+
|
|
65
|
+
def listProjection(self):
|
|
66
|
+
"""
|
|
67
|
+
Lists the available projection types as JSON.
|
|
68
|
+
"""
|
|
69
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/view/listprojection",
|
|
70
|
+
auth=("",self.password))
|
|
71
|
+
try:
|
|
72
|
+
return r.json()
|
|
73
|
+
except requests.exceptions.JSONDecodeError:
|
|
74
|
+
raise Exception(r.text)
|
|
75
|
+
|
|
76
|
+
def projectionDescription(self):
|
|
77
|
+
"""
|
|
78
|
+
Returns the HTML description of the current projection (StelProjector::getHtmlSummary)
|
|
79
|
+
"""
|
|
80
|
+
r = requests.get(f"http://{self.ip}:{self.port}/api/view/projectiondescription",
|
|
81
|
+
auth=("",self.password))
|
|
82
|
+
if r.status_code == 200:
|
|
83
|
+
return r.content
|
|
84
|
+
else:
|
|
85
|
+
raise Exception(r.text)
|