comparison bin/vidref @ 2043:67575505c400

comment out more greplin so services can start
author drewp@bigasterisk.com
date Mon, 09 May 2022 23:18:05 -0700
parents 1b690005aabd
children 9aa046cc9b33
comparison
equal deleted inserted replaced
2042:8849c9e5da30 2043:67575505c400
17 from run_local import log 17 from run_local import log
18 18
19 from typing import cast 19 from typing import cast
20 import logging, optparse, json, base64, os, glob 20 import logging, optparse, json, base64, os, glob
21 21
22 from greplin import scales 22 # from greplin import scales
23 from greplin.scales.cyclonehandler import StatsHandler 23 # from greplin.scales.cyclonehandler import StatsHandler
24 from rdflib import URIRef 24 from rdflib import URIRef
25 from twisted.internet import reactor, defer 25 from twisted.internet import reactor, defer
26 import cyclone.web, cyclone.httpclient, cyclone.websocket 26 import cyclone.web, cyclone.httpclient, cyclone.websocket
27 27
28 from cycloneerr import PrettyErrorHandler 28 from cycloneerr import PrettyErrorHandler
29 from light9 import networking, showconfig 29 from light9 import networking, showconfig
30 from light9.newtypes import Song 30 from light9.newtypes import Song
31 from light9.vidref import videorecorder 31 from light9.vidref import videorecorder
32 from rdfdb.syncedgraph import SyncedGraph 32 from rdfdb.syncedgraph import SyncedGraph
33 from standardservice.scalessetup import gatherProcessStats 33 # from standardservice.scalessetup import gatherProcessStats
34 34
35 parser = optparse.OptionParser() 35 parser = optparse.OptionParser()
36 parser.add_option("-v", "--verbose", action="store_true", help="logging.DEBUG") 36 parser.add_option("-v", "--verbose", action="store_true", help="logging.DEBUG")
37 (options, args) = parser.parse_args() 37 (options, args) = parser.parse_args()
38 38
39 log.setLevel(logging.DEBUG if options.verbose else logging.INFO) 39 log.setLevel(logging.DEBUG if options.verbose else logging.INFO)
40 40
41 gatherProcessStats() 41 # gatherProcessStats()
42 stats = scales.collection( 42 # stats = scales.collection(
43 '/webServer', 43 # '/webServer',
44 scales.RecentFpsStat('liveWebsocketFrameFps'), 44 # scales.RecentFpsStat('liveWebsocketFrameFps'),
45 scales.IntStat('liveClients'), 45 # scales.IntStat('liveClients'),
46 ) 46 # )
47 47
48 48
49 class Snapshot(cyclone.web.RequestHandler): 49 class Snapshot(cyclone.web.RequestHandler):
50 50
51 @defer.inlineCallbacks 51 @defer.inlineCallbacks
76 76
77 class Live(cyclone.websocket.WebSocketHandler): 77 class Live(cyclone.websocket.WebSocketHandler):
78 78
79 def connectionMade(self, *args, **kwargs): 79 def connectionMade(self, *args, **kwargs):
80 pipeline.liveImages.subscribe(on_next=self.onFrame) 80 pipeline.liveImages.subscribe(on_next=self.onFrame)
81 stats.liveClients += 1 81 # stats.liveClients += 1
82 82
83 def connectionLost(self, reason): 83 def connectionLost(self, reason):
84 #self.subj.dispose() 84 #self.subj.dispose()
85 stats.liveClients -= 1 85 # stats.liveClients -= 1
86 pass
86 87
87 def onFrame(self, cf: videorecorder.CaptureFrame): 88 def onFrame(self, cf: videorecorder.CaptureFrame):
88 if cf is None: return 89 if cf is None: return
89 90
90 stats.liveWebsocketFrameFps.mark() 91 # stats.liveWebsocketFrameFps.mark()
91 92
92 self.sendMessage( 93 self.sendMessage(
93 json.dumps({ 94 json.dumps({
94 'jpeg': base64.b64encode(cf.asJpeg()).decode('ascii'), 95 'jpeg': base64.b64encode(cf.asJpeg()).decode('ascii'),
95 'description': f't={cf.t}', 96 'description': f't={cf.t}',
186 (r'/snapshot/(.*)', SnapshotPic, { 187 (r'/snapshot/(.*)', SnapshotPic, {
187 "path": 'todo', 188 "path": 'todo',
188 }), 189 }),
189 (r'/time', Time), 190 (r'/time', Time),
190 (r'/time/stream', TimeStream), 191 (r'/time/stream', TimeStream),
191 (r'/stats/(.*)', StatsHandler, { 192 # (r'/stats/(.*)', StatsHandler, {
192 'serverName': 'vidref' 193 # 'serverName': 'vidref'
193 }), 194 # }),
194 ], 195 ],
195 debug=True, 196 debug=True,
196 )) 197 ))
197 log.info("serving on %s" % port) 198 log.info("serving on %s" % port)
198 199