Commit c05f9ec7 authored by Mikhail Karnevskiy's avatar Mikhail Karnevskiy
Browse files

Add check of metadata stream list

parent cf00d3e5
......@@ -48,9 +48,10 @@ def get_new_stream(stream, receiver_stream_list, metadata_stream_list,
Naming scheme to chose next stream
"""
receiver_stream_list = sorted(receiver_stream_list, key=lambda x: x['timestampCreated'])
receiver_stream_list = [x['name'] for x in receiver_stream_list]
metadata_stream_list = [x['name'] for x in metadata_stream_list]
if 'basename' in naming_scheme:
receiver_stream_list = sorted(receiver_stream_list, key=lambda x: x['timestampCreated'])
receiver_stream_list = [x['name'] for x in receiver_stream_list]
if sender_stream_list is None:
log.warning(
"Cannot calculate next stream. sender stream list is None"
......@@ -60,21 +61,19 @@ def get_new_stream(stream, receiver_stream_list, metadata_stream_list,
sender_stream_list = [x for x in sender_stream_list if x['finished']]
sender_stream_list = [x['name'] for x in sender_stream_list]
for receiver_stream in receiver_stream_list:
if receiver_stream != stream and receiver_stream not in sender_stream_list:
if (receiver_stream != stream and
receiver_stream not in sender_stream_list and
receiver_stream in metadata_stream_list):
return receiver_stream
elif naming_scheme == 'date':
receiver_stream_list = sorted(receiver_stream_list, key=lambda x: x['timestampCreated'])
receiver_stream_list = [x['name'] for x in receiver_stream_list]
if stream not in receiver_stream_list:
pos = 0
else:
pos = receiver_stream_list.index(stream) + 1
if pos < len(receiver_stream_list):
if pos < len(receiver_stream_list) and receiver_stream_list[pos] in metadata_stream_list:
return receiver_stream_list[pos]
elif naming_scheme == 'numeric':
receiver_stream_list = [x['name'] for x in receiver_stream_list]
metadata_stream_list = [x['name'] for x in metadata_stream_list]
max_stream_number = max_stream(receiver_stream_list)
try:
if (int(stream) < max_stream_number
......@@ -202,7 +201,7 @@ class Streamer:
else:
sender_stream_list = None
if self.metadata_receiver:
if self.metadata_receiver and not self.fix_metadata_stream:
try:
metadata_stream_list = (
self.metadata_receiver.get_stream_list())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment