Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pims/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -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)
Expand Down