Ranges don't get detected from a string sequence with no padding while single frames do
walrusVision opened this issue · 5 comments
A string sequence with a single file and no padding will get correctly picked up and turned into a FileSequence with padding and a frameset. However a string sequence with a range and no padding won't, the range will be combined into the basename of the object.
Current behaviour
Single frame which works as expected
>>> fs = fileseq.FileSequence('test.1.exr')
>>> fs.basename()
'test.'
>>> fs.padding()
'@'
>>> fs.frameSet()
FrameSet("1")
Frame range which doesn't work as expected.
>>> fs = fileseq.FileSequence('test.1-10.exr')
>>> fs.basename()
'test.1-10'
>>> fs.padding()
''
>>> fs.frameSet()
>>>
Expected behaviour
>>> fs = fileseq.FileSequence('test.1-10.exr')
>>> fs.basename()
'test.'
>>> fs.padding()
'@'
>>> fs.frameSet()
FrameSet("1-10")
Thanks for registering this issue. It likely has to do with the different regular expressions that detect single file patterns vs range patterns. The "1-10" without padding is likely falling into the single file pattern, whereas the "1" falls into the sequence pattern.
We could adjust the pattern to capture "1-10" as a sequence with a default padding char, but it would be possibly a breaking change. So I am tagging this with a v2 label.
There is now a v2 branch available, if this change wants to be a PR
@walrusVision I started to look at this, while working on related v2 breaking changes. Something that concerns me about making this proposed change is that it would lead to more false-positive sequence matching. ie:
arbitrary_numbers.1234567-987654.mov
The assumption from this library so far has been that the input string must indicate a sequence via some form of a padding character, if it is including a range. I'm worried that if we start assuming a range without padding, we might wrongly introduce really large sequence objects to single file strings.
I guess then we should ask should fileseq be picking up cases like fileseq.FileSequence('test.1.exr')
? Could be be considered the same class as arbitrary_numbers.1234567-987654.mov
?
There is a difference in the code between detecting what it thinks is a single file, vs a range. The single file pattern is far safer since it wouldn't lead to any kind of memory explosion. My opinion is that we don't change the range detection in a way that it would make it easier to consider arbitrary_numbers.1234567-987654.mov
a range, without having a padding char.