diff --git a/src/fileseq/filesequence.py b/src/fileseq/filesequence.py index 1b61963..0609e45 100644 --- a/src/fileseq/filesequence.py +++ b/src/fileseq/filesequence.py @@ -814,6 +814,8 @@ def yield_sequences_in_list( :obj:`FileSequence`: """ seqs = {} + variant_seq = 0 + variant_single = 1 if allow_subframes: _check = cls.DISK_SUB_RE.match else: @@ -839,7 +841,7 @@ def yield_sequences_in_list( except decimal.DecimalException: continue _, _, subframe = frame.partition(".") - key = (dirname, basename, ext, len(subframe)) + key = (dirname, basename, ext, len(subframe), variant_seq) seqs.setdefault(key, frames).add(frame) else: @@ -849,9 +851,9 @@ def yield_sequences_in_list( continue if frame: _, _, subframe = frame.partition(".") - key = (dirname, basename, ext, len(subframe)) + key = (dirname, basename, ext, len(subframe), variant_seq) else: - key = (dirname, basename, ext, 0) + key = (dirname, basename, ext, 0, variant_single) seqs.setdefault(key, set()) if frame: seqs[key].add(frame) @@ -896,7 +898,8 @@ def frames_to_seq(frames, pad_length, decimal_places): finish_new_seq(seq) return seq - for (dirname, basename, ext, decimal_places), frames in iteritems(seqs): + for parts, frames in iteritems(seqs): + (dirname, basename, ext, decimal_places) = parts[:4] # Short-circuit logic if we do not have multiple frames, since we # only need to build and return a single simple sequence if not frames: diff --git a/test/test_unit.py b/test/test_unit.py index 5ce8a06..53e1106 100755 --- a/test/test_unit.py +++ b/test/test_unit.py @@ -1361,6 +1361,22 @@ def test_yield_sequences_in_list_pad_style(self): self.assertEqual(fileseq.PAD_STYLE_HASH1, actual.padStyle()) self.assertEqual(4, actual.zfill()) + def test_yield_sequences_in_list_frame_no_frame(self): + paths = [ + 'frame_no_frame/file02.jpg', + 'frame_no_frame/file.jpg', + 'frame_no_frame/name.jpg', + ] + + expects = [ + 'frame_no_frame/file2@@.jpg', + 'frame_no_frame/file.jpg', + 'frame_no_frame/name.jpg', + ] + actual = {str(fs) for fs in FileSequence.yield_sequences_in_list(paths)} + for expect in expects: + self.assertIn(expect, actual) + def testIgnoreFrameSetStrings(self): for char in "xy:,".split(): fs = FileSequence("/path/to/file{0}1-1x1#.exr".format(char))