コード例 #1
0
ファイル: test_unit.py プロジェクト: psh845/fileseq
    def testFormat(self):
        seq = FileSequence("/cheech/chong.1-10,30,40#.exr")
        self.assertEquals("chong.0001-0010,0030,0040#.exr", str(seq.format()))
        self.assertEquals("0011-0029,0031-0039", seq.format("{inverted}"))

        seq = findSequencesOnDisk("broken_seq")[0]
        self.assertEquals("0000-0002,0004,0006-0008", seq.format("{range}"))
        self.assertEquals("broke.0000-0002,0004,0006-0008#.exr", seq.format())
        seq = findSequencesOnDisk("step_seq")[0]
        self.assertEquals("step_seq/step1.1-13x4,14-17#.exr", str(seq))
コード例 #2
0
ファイル: test_unit.py プロジェクト: donalm/fileseq
    def testFormat(self):
        seq = FileSequence("/cheech/chong.1-10,30,40#.exr")
        self.assertEquals("chong.0001-0010,0030,0040#.exr", str(seq.format()))
        self.assertEquals("0011-0029,0031-0039", seq.format("{inverted}"))

        seq = findSequencesOnDisk("broken_seq")[0]
        self.assertEquals("0000-0002,0004,0006-0008", seq.format("{range}"))
        self.assertEquals("broke.0000-0002,0004,0006-0008#.exr", seq.format())
        seq = findSequencesOnDisk("step_seq")[0]
        self.assertEquals("step_seq/step1.1-13x4,14-17#.exr", str(seq))
コード例 #3
0
ファイル: test_unit.py プロジェクト: rkoschmitzky/fileseq
    def testStrictPadding(self):
        tests = [
            ("seq/bar#.exr", ["seq/bar1000-1002,1004-1006#.exr"]),
            ("seq/bar@@@@.exr", ["seq/bar1000-1002,1004-1006@@@@.exr"]),
            ("seq/bar@@@.exr", ["seq/bar1000-1002,1004-1006@@@.exr"]),
            ("seq/bar@@.exr", ["seq/bar1000-1002,1004-1006@@.exr"]),
            ("seq/[email protected]", ["seq/bar1000-1002,[email protected]"]),
            ("seq/bar@@@@@.exr", []),
            ("seq/bar#@.exr", []),
            ("seq/foo.#.exr", ["seq/foo.1-5#.exr"]),
            ("seq/foo.#.jpg", ["seq/foo.1-5#.jpg"]),
            ("seq/foo.#.exr", ["seq/foo.1-5#.exr"]),
            ("seq/foo.debug.#.exr", ["seq/foo.debug.1-5#.exr"]),
            ("seq/#.exr", ["seq/1-3#.exr"]),
            ("seq/foo_#.exr", ["seq/foo_1#.exr"]),
            ("seq/foo_#_extra.exr", []),
            ("seq/foo_##.exr", []),
            ("seq/[email protected]", []),
            ("seq/foo_#@.exr", []),
            ("seq/foo_@@_extra.exr", []),
            ("seq/baz_{left,right}.#.exr",
             ["seq/baz_left.1-3#.exr", "seq/baz_right.1-3#.exr"]),
            ("seq/baz_{left,right}.@@@@.exr",
             ["seq/baz_left.1-3@@@@.exr", "seq/baz_right.1-3@@@@.exr"]),
            ("seq/baz_{left,right}.@@@.exr", []),
            ("seq/baz_{left,right}.#@.exr", []),
        ]

        for pattern, expected in tests:
            seqs = findSequencesOnDisk(pattern, strictPadding=True)
            for seq in seqs:
                self.assertTrue(isinstance(seq, FileSequence))
            actual = self.toNormpaths([str(seq) for seq in seqs])
            expected = self.toNormpaths(expected)
            self.assertEqual(actual, expected)
コード例 #4
0
ファイル: test_unit.py プロジェクト: donalm/fileseq
    def testCrossPlatformPathSep(self):
        expected = {
            "seqsubdirs/sub1/1-3#.exr",
            "seqsubdirs/sub1/bar1000-1002,1004-1006#.exr",
            "seqsubdirs/sub1/foo.1-5#.exr",
            "seqsubdirs/sub1/foo.1-5#.jpg",
            "seqsubdirs/sub1/foo.debug.1-5#.exr",
            "seqsubdirs/sub1/foo_1#.exr",
        }

        import ntpath 
        _join = os.path.join
        os.path.join = ntpath.join

        try:
            self.assertEqual(os.path.join('a', 'b'), 'a\\b')
            seqs = findSequencesOnDisk("seqsubdirs/sub1")

            self.assertEquals(len(expected), len(seqs))

            actual = set(str(s) for s in seqs)
            self.assertEqual(actual, expected)

        finally:
            os.path.join = _join
コード例 #5
0
ファイル: test_unit.py プロジェクト: rkoschmitzky/fileseq
 def testFindSequenceOnDiskNegative(self):
     seqs = findSequencesOnDisk("seqneg")
     self.assertEquals("seqneg/bar.-1-1#.exr", str(seqs[0]))
     self.assertEquals("seqneg/bar.-001.exr", seqs[0].frame(-1))
     self.assertEquals("seqneg/bar.-1001.exr", seqs[0].frame(-1001))
     self.assertEquals("seqneg/bar.-10011.exr", seqs[0].frame(-10011))
     self.assertEquals("seqneg/bar.1000.exr", seqs[0].frame(1000))
コード例 #6
0
ファイル: test_unit.py プロジェクト: donalm/fileseq
    def testStrictPadding(self):
        tests = [
            ("seq/bar#.exr", ["seq/bar1000-1002,1004-1006#.exr"]),
            ("seq/bar@@@@.exr", ["seq/bar1000-1002,1004-1006#.exr"]),
            ("seq/bar@@@.exr", []),
            ("seq/foo.#.exr", ["seq/foo.1-5#.exr"]),
            ("seq/foo.#.jpg", ["seq/foo.1-5#.jpg"]),
            ("seq/foo.#.exr", ["seq/foo.1-5#.exr"]),
            ("seq/foo.debug.#.exr", ["seq/foo.debug.1-5#.exr"]),
            ("seq/#.exr", ["seq/1-3#.exr"]),
            ("seq/foo_#.exr", ["seq/foo_1#.exr"]),
            ("seq/foo_#_extra.exr", []),
            ("seq/foo_##.exr", []),
            ("seq/[email protected]", []),
            ("seq/foo_@@_extra.exr", []),
            ("seq/baz_{left,right}.#.exr", ["seq/baz_left.1-3#.exr", "seq/baz_right.1-3#.exr"]),
            ("seq/baz_{left,right}.@@@@.exr", ["seq/baz_left.1-3#.exr", "seq/baz_right.1-3#.exr"]),
            ("seq/baz_{left,right}.@@@.exr", []),
        ]

        for pattern, expected in tests:
            seqs = findSequencesOnDisk(pattern, strictPadding=True)
            for seq in seqs:
                self.assertTrue(isinstance(seq, FileSequence))
            actual = self.toNormpaths([str(seq) for seq in seqs])
            expected = self.toNormpaths(expected)
            self.assertEqual(actual, expected)
コード例 #7
0
ファイル: test_unit.py プロジェクト: rkoschmitzky/fileseq
    def testCrossPlatformPathSep(self):
        expected = {
            "seqsubdirs/sub1/1-3#.exr",
            "seqsubdirs/sub1/bar1000-1002,1004-1006#.exr",
            "seqsubdirs/sub1/foo.1-5#.exr",
            "seqsubdirs/sub1/foo.1-5#.jpg",
            "seqsubdirs/sub1/foo.debug.1-5#.exr",
            "seqsubdirs/sub1/foo_1#.exr",
        }

        import ntpath
        _join = os.path.join
        os.path.join = ntpath.join

        try:
            self.assertEqual(os.path.join('a', 'b'), 'a\\b')
            seqs = findSequencesOnDisk("seqsubdirs/sub1")

            self.assertEquals(len(expected), len(seqs))

            actual = set(str(s) for s in seqs)
            self.assertEqual(actual, expected)

        finally:
            os.path.join = _join
コード例 #8
0
ファイル: run.py プロジェクト: IngenuityEngine/fileseq
	def testFindSequencesOnDisk(self):
		seqs = fileseq.findSequencesOnDisk("seq")
		self.assertEquals(2, len(seqs))

		known = set(["seq/bar1000-1002,1004-1006#.exr", "seq/foo.1-5#.exr"])
		found = set([str(s) for s in seqs])
		self.assertFalse(known.difference(found))
コード例 #9
0
ファイル: run.py プロジェクト: benroeder/fileseq
	def testFindSequenceOnDiskNegative(self):
		seqs = fileseq.findSequencesOnDisk("seqneg")
		self.assertEquals("seqneg/bar.-1-1#.exr", str(seqs[0]))
		self.assertEquals("seqneg/bar.-0001.exr", seqs[0].frame(-1))
		self.assertEquals("seqneg/bar.-1001.exr", seqs[0].frame(-1001))
		self.assertEquals("seqneg/bar.-10011.exr", seqs[0].frame(-10011))
		self.assertEquals("seqneg/bar.1000.exr", seqs[0].frame(1000))
コード例 #10
0
    def testFindSequencesOnDisk(self):
        seqs = fileseq.findSequencesOnDisk("seq")
        self.assertEquals(3, len(seqs))

        known = set([
            "seq/bar1000-1002,1004-1006#.exr",
            "seq/foo.1-5#.exr",
            "seq/foo.1-5#.jpg",
        ])
        found = set([str(s) for s in seqs])
        self.assertFalse(known.difference(found))
コード例 #11
0
ファイル: test_unit.py プロジェクト: donalm/fileseq
    def testFindSequencesOnDiskSkipHiddenFiles(self):
        seqs = findSequencesOnDisk("seqhidden")
        self.assertEquals(3, len(seqs))

        known = set(self.toNormpaths([
            "seqhidden/bar1000-1002,1004-1006#.exr",
            "seqhidden/foo.1-5#.exr",
            "seqhidden/foo.1-5#.jpg",
        ]))
        found = set(self.toNormpaths([str(s) for s in seqs]))
        self.assertEqual(known, found)
        self.assertFalse(known.difference(found))
コード例 #12
0
ファイル: test_unit.py プロジェクト: psh845/fileseq
    def testFindSequencesOnDiskSkipHiddenFiles(self):
        seqs = findSequencesOnDisk("seqhidden")
        self.assertEquals(3, len(seqs))

        known = set(self.toNormpaths([
            "seqhidden/bar1000-1002,1004-1006#.exr",
            "seqhidden/foo.1-5#.exr",
            "seqhidden/foo.1-5#.jpg",
        ]))
        found = set(self.toNormpaths([str(s) for s in seqs]))
        self.assertEqual(known, found)
        self.assertFalse(known.difference(found))
コード例 #13
0
    def _register_sequences_in_dir(self, dir_path):
        """Register all sequences in a directory with extensions in either CLIP_EXTENSIONS or IMAGE_EXTENSIONS

        Parameters
        ----------
        dir_path : path_like
            directory in which clips or images are sought
        """
        seqs = findSequencesOnDisk(str(dir_path))
        for seq in seqs:
            extension = seq.extension()
            if extension in CLIP_EXTENSIONS or extension in IMAGE_EXTENSIONS:
                self.add_entry(seq)
コード例 #14
0
ファイル: test_unit.py プロジェクト: rkoschmitzky/fileseq
    def testFindSequencesOnDiskIncludeHiddenFiles(self):
        seqs = findSequencesOnDisk("seqhidden", include_hidden=True)
        self.assertEquals(7, len(seqs))

        known = {
            "seqhidden/bar1000-1002,1004-1006#.exr",
            "seqhidden/.bar1000-1002,1004-1006#.exr",
            "seqhidden/foo.1-5#.exr",
            "seqhidden/.foo.1-5#.exr",
            "seqhidden/foo.1-5#.jpg",
            "seqhidden/.foo.1-5#.jpg",
            "seqhidden/.hidden",
        }
        found = set([str(s) for s in seqs])
        self.assertEqualPaths(known, found)
コード例 #15
0
    def testFindSequencesOnDisk(self):
        seqs = findSequencesOnDisk("seq", strictPadding=True)
        self.assertEquals(7, len(seqs))

        known = {
            "seq/bar1000-1002,1004-1006#.exr",
            "seq/foo.1-5#.exr",
            "seq/foo.1-5#.jpg",
            "seq/foo.debug.1-5#.exr",
            "seq/foo_1#.exr",
            "seq/foo_0001_extra.exr",
            "seq/1-3#.exr",
        }
        found = set([str(s) for s in seqs])
        self.assertEqualPaths(found, known)
コード例 #16
0
ファイル: test_unit.py プロジェクト: donalm/fileseq
    def testFindSequencesOnDiskIncludeHiddenFiles(self):
        seqs = findSequencesOnDisk("seqhidden", include_hidden=True)
        self.assertEquals(7, len(seqs))

        known = {
            "seqhidden/bar1000-1002,1004-1006#.exr",
            "seqhidden/.bar1000-1002,1004-1006#.exr",
            "seqhidden/foo.1-5#.exr",
            "seqhidden/.foo.1-5#.exr",
            "seqhidden/foo.1-5#.jpg",
            "seqhidden/.foo.1-5#.jpg",
            "seqhidden/.hidden",
        }
        found = set([str(s) for s in seqs])
        self.assertEqualPaths(known, found)
コード例 #17
0
ファイル: test_unit.py プロジェクト: donalm/fileseq
    def testFindSequencesOnDisk(self):
        seqs = findSequencesOnDisk("seq", strictPadding=True)
        self.assertEquals(9, len(seqs))

        known = {
            "seq/bar1000-1002,1004-1006#.exr",
            "seq/foo.1-5#.exr",
            "seq/foo.1-5#.jpg",
            "seq/foo.debug.1-5#.exr",
            "seq/foo_1#.exr",
            "seq/foo_0001_extra.exr",
            "seq/1-3#.exr",
            "seq/baz_left.1-3#.exr",
            "seq/baz_right.1-3#.exr",
        }
        found = set([str(s) for s in seqs])
        self.assertEqualPaths(found, known)
コード例 #18
0
    def __render_movie_from_sequence(self, inFile):
        import fileseq
        from draft import Draft

        codec = "H264"
        quality = 80

        lut = Draft.LUT.CreateRec709()

        fs = fileseq.findSequencesOnDisk(inFile)[0]

        output_path = os.path.join(fs.dirname(),
                                   "{}.mov".format(fs.basename()[:-1]))

        if not os.path.exists(output_path):
            firstFrame = fs.frame(fs.start())
            firstFrame = Draft.Image.ReadFromFile(firstFrame)

            check_beauty = False
            if firstFrame.HasChannel('Beauty.blue'):
                channels = {
                    'Beauty.blue': 'B',
                    'Beauty.green': 'G',
                    'Beauty.red': 'R'
                }
                check_beauty = True

            inputWidth = firstFrame.width
            inputHeight = firstFrame.height

            encoder = Draft.VideoEncoder(output_path,
                                         width=inputWidth,
                                         height=inputHeight,
                                         quality=quality,
                                         codec=codec)

            progressCounter = 0
            for currFrame in range(fs.start(), fs.end()):

                currFile = fs.frame(currFrame)
                frame = Draft.Image.ReadFromFile(currFile)

                if check_beauty:
                    imgLayer = Draft.Image.CreateImage(frame.width,
                                                       frame.height,
                                                       channels.keys())
                    imgLayer.Copy(frame, channels=channels.keys())
                    for ch in channels:
                        imgLayer.RenameChannel(ch, channels[ch])
                else:
                    imgLayer = frame

                lut.Apply(imgLayer)

                encoder.EncodeNextFrame(imgLayer)

                progressCounter = progressCounter + 1
                progress = progressCounter * 100 / (fs.end() - fs.start())
                print("Progress: %i%%" % progress)

            encoder.FinalizeEncoding()

        return {'path': output_path, 'first_frame': fs.start()}
コード例 #19
0
ファイル: test_unit.py プロジェクト: rkoschmitzky/fileseq
 def testNegSequencesOnDisk(self):
     seqs = findSequencesOnDisk("seqneg")
     self.assertEquals(1, len(seqs))
コード例 #20
0
ファイル: frames.py プロジェクト: JGoldstone/shell_tools
 def _find_sequences_and_debris(self):
     seqs = findSequencesOnDisk(self.dir)
     if self.sequence_left_substrings:
         seqs = {s for s in seqs if s.basename().startswith(self.sequence_left_substrings)}
     self._image_essence_sequences = {s for s in seqs if s.extension() in KNOWN_IMAGE_ESSENCE_CONTAINERS}
     self._debris = {s.basename() for s in seqs if s not in self._image_essence_sequences}
コード例 #21
0
ファイル: run.py プロジェクト: benroeder/fileseq
	def testNegSequencesOnDisk(self):
	    seqs = fileseq.findSequencesOnDisk("seqneg")
	    self.assertEquals(1, len(seqs))