custom device name for fake udp
This commit is contained in:
10
streams.py
10
streams.py
@@ -48,7 +48,7 @@ class Stream(Base):
|
||||
_deadline = INF
|
||||
_next_connect = 0
|
||||
|
||||
def __init__(self, uri, name=None, timeout=5, encoding='latin-1'):
|
||||
def __init__(self, uri, name=None, timeout=5, encoding='latin-1', **kwds):
|
||||
self.name = name or uri
|
||||
self.uri = uri
|
||||
self.tags = {}
|
||||
@@ -63,7 +63,7 @@ class Stream(Base):
|
||||
self.generator = self.event_generator()
|
||||
try:
|
||||
self.connect()
|
||||
self.init()
|
||||
self.init(**kwds)
|
||||
except Exception as e:
|
||||
print(self.uri, repr(e))
|
||||
raise
|
||||
@@ -261,10 +261,10 @@ class EventStream:
|
||||
while 1:
|
||||
for stream in self.wait_ready(1):
|
||||
if not isinstance(stream, Stream):
|
||||
for streamcls, uri, *args in stream.events():
|
||||
for streamcls, uri, kwargs in stream.events():
|
||||
if uri not in self.streams:
|
||||
print('add stream', uri, *args)
|
||||
self.streams[uri] = streamcls(uri, *args)
|
||||
print('add stream', uri, kwargs)
|
||||
self.streams[uri] = streamcls(uri, **kwargs)
|
||||
for name, stream in self.streams.items():
|
||||
try:
|
||||
if stream.get_events(events, maxevents):
|
||||
|
||||
Reference in New Issue
Block a user