Add 3D printer status to stats
This commit is contained in:
@@ -24,7 +24,7 @@ class LoggingThrottle(throttling.BaseThrottle):
|
||||
return True
|
||||
elif path == '/sessions/' and user == None:
|
||||
return True
|
||||
elif path in ['/pinball/high_scores/', '/protocoin/printer_balance/', '/hosting/high_scores/']:
|
||||
elif path in ['/pinball/high_scores/', '/protocoin/printer_balance/', '/hosting/high_scores/', '/stats/ord2/printer3d/', '/stats/ord3/printer3d/']:
|
||||
return True
|
||||
|
||||
if request.data:
|
||||
|
@@ -30,6 +30,7 @@ DEFAULTS = {
|
||||
'autoscan': '',
|
||||
'last_scan': {},
|
||||
'closing': {},
|
||||
'printer3d': {},
|
||||
}
|
||||
|
||||
if secrets.MUMBLE:
|
||||
|
@@ -953,6 +953,23 @@ class StatsViewSet(viewsets.ViewSet, List):
|
||||
|
||||
return Response(200)
|
||||
|
||||
@action(detail=True, methods=['post'])
|
||||
def printer3d(self, request, pk=None):
|
||||
printer3d = cache.get('printer3d', {})
|
||||
|
||||
devicename = pk
|
||||
status = request.data['result']['status']
|
||||
|
||||
printer3d[devicename] = dict(
|
||||
progress=int(status['display_status']['progress'] * 100),
|
||||
#filename=status['print_stats']['filename'],
|
||||
state=status['idle_timeout']['state'],
|
||||
)
|
||||
cache.set('printer3d', printer3d)
|
||||
|
||||
return Response(200)
|
||||
|
||||
|
||||
|
||||
class MemberCountViewSet(Base, List):
|
||||
pagination_class = None
|
||||
|
Reference in New Issue
Block a user