diff --git a/pims/api.py b/pims/api.py index 0da4792a..c08cf216 100644 --- a/pims/api.py +++ b/pims/api.py @@ -162,13 +162,19 @@ def open(sequence, **kwargs): >>> frame_count = len(video) # Number of frames in video >>> frame_shape = video.frame_shape # Pixel dimensions of video """ - files = glob.glob(sequence) + if not isinstance(sequence, list): + sequence = [sequence] + + files = [] + for each_seq in sequence: + files.extend(glob.glob(each_seq)) + if len(files) > 1: # todo: test if ImageSequence can read the image type, # delegate to subclasses as needed - return ImageSequence(sequence, **kwargs) + return ImageSequence(files, **kwargs) - _, ext = os.path.splitext(sequence) + _, ext = os.path.splitext(files[0]) if ext is None or len(ext) < 2: raise UnknownFormatError( "Could not detect your file type because it did not have an " @@ -201,7 +207,7 @@ def priority(cls): exceptions = '' for handler in sort_on_priority(eligible_handlers): try: - return handler(sequence, **kwargs) + return handler(files[0], **kwargs) except Exception as e: message = '{0} errored: {1}'.format(str(handler), str(e)) warn(message)