Skip to content

Commit f05837c

Browse files
Merge pull request #8 from staros-projects/dev
v1.2.1
2 parents 4666eea + 6c61112 commit f05837c

File tree

4 files changed

+9
-27
lines changed

4 files changed

+9
-27
lines changed

app/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
from pydantic import BaseModel
5252

53-
BACKEND_API_VERSION = '1.2.0'
53+
BACKEND_API_VERSION = '1.2.1'
5454

5555
class SetTimeProp(BaseModel):
5656
unixtime: str
@@ -608,7 +608,7 @@ async def deleteAllSnapshots(background_tasks: BackgroundTasks):
608608
print(f"The directory {dirToClean} does not exist.")
609609

610610

611-
@app.get("/sunscan/shutdown", response_class=JSONResponse)
611+
@app.post("/sunscan/shutdown", response_class=JSONResponse)
612612
async def shutdownSUNSCAN():
613613
os.system("sudo shutdown -h now")
614614
return JSONResponse(content={"message": "Shutdown ok"}, status_code=200)

app/power.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,6 @@ def battery_power_plugged(self):
100100
self.logger.info('Invalid battery output')
101101
return battery_power_plugged
102102

103-
def set_next_boot_datetime(self, datetime):
104-
"""
105-
Set the next boot datetime.
106-
107-
Args:
108-
datetime: The datetime for the next boot.
109-
110-
Returns:
111-
bool: Always returns True (placeholder implementation).
112-
113-
Note:
114-
This is a placeholder method. The actual implementation for
115-
scheduling the next boot is not yet available.
116-
"""
117-
# TODO: For directly scheduling next boot instead of using PiSugar's web interface
118-
# Currently, it can be done manually through the PiSugar web interface
119-
return True
120-
121103
def sync_time(self):
122104
"""
123105
Synchronize the PiSugar RTC with the current system time.

app/storage.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,19 @@ def get_scans(path='storage/scans/', withDetails=False):
115115
scans = sorted(scans, key=lambda x: x['creation_date'], reverse=True)
116116

117117
scans_with_status = []
118-
for s in scans:
119-
118+
for s in scans:
120119
if os.path.exists(os.path.join(s['path'],'sunscan_clahe.jpg')):
121120
s['status'] = 'completed'
122121
elif os.path.exists(os.path.join(s['path'],'sunscan_log.txt')):
123122
s['status'] = 'failed'
124123

125-
if os.path.exists(os.path.join(s['path'], 'sunscan_conf.txt')):
126-
d = open(os.path.join(s['path'], 'sunscan_conf.txt'))
127-
c = json.load(d)
128-
s['configuration'] = c
124+
try:
125+
with open(os.path.join(s['path'], 'sunscan_conf.txt')) as d:
126+
c = json.load(d)
127+
s['configuration'] = c
128+
except Exception as e:
129+
pass
129130
scans_with_status.append(s)
130-
print(s)
131131
return scans_with_status
132132

133133

sunscan_backend_source.zip

110 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)