from stream import *
import config
import errors
+import util
def normalize_stream(s, stream):
stream_tokens = [s]
stream_tokens.append("{0}:{1}:{2}".format(current_span[0], current_span[1] - current_span[0], fout))
if len(stream[f]) == 0:
- stream_tokens.append("0:0:{0}".format(fout))
+ stream_tokens.append("0:0:{0}".format(fout))
- return stream_tokens
+ return stream_tokens
def normalize(collection):
streams = {}
class CollectionReader(object):
def __init__(self, manifest_locator_or_text):
- if re.search(r'^[a-f0-9]{32}\+\d+(\+\S)*$', manifest_locator_or_text):
+ if re.search(r'^[a-f0-9]{32}(\+\d+)?(\+\S+)*$', manifest_locator_or_text):
self._manifest_locator = manifest_locator_or_text
self._manifest_text = None
- else:
+ elif re.search(r'^\S+( [a-f0-9]{32,}(\+\S+)*)*( \d+:\d+:\S+)+\n', manifest_locator_or_text):
self._manifest_text = manifest_locator_or_text
self._manifest_locator = None
+ else:
+ raise errors.ArgumentError(
+ "Argument to CollectionReader must be a manifest or a collection UUID")
self._streams = None
def __enter__(self):
manifest += ' ' + ' '.join(stream[1])
manifest += ' ' + ' '.join("%d:%d:%s" % (sfile[0], sfile[1], sfile[2].replace(' ', '\\040')) for sfile in stream[2])
manifest += "\n"
-
+
#print 'writer',manifest
#print 'after reader',CollectionReader(manifest).manifest_text()