-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Problem
When pyseq encounters a frame range that is negative it doesn't parse it correctly.
For example I have an application that saves out to the following format:
file.-002.jpg
file.-001.jpg
file.0000.jpg
file.0001.jpg
file.0003.jpg
Testing that it parses:
data = ["file.-002.jpg", "file.-001.jpg", "file.0000.jpg", "file.0001.jpg", "file.0003.jpg"]
print pyseq.get_sequences(data)
# [<pyseq.Sequence "file.-1-2.jpg">, <pyseq.Sequence "file.0-3.jpg">]Solution
Parse digits including the - (minus) sign to ensure it is parsed as it should.
I quickly tested to change:
digits_re = re.compile(r'\d+')To:
digits_re = re.compile(r'-?\d+')And it parsed the above file sequence correctly as a single sequence. YAY! (Dirty fix?)
Though to have this as a fully reliable implementation I'm imagining some changes need to be made to uncompress and alike to be perfect. Similarly tests should be implemented to also ensure the functionality remains reliable over time.