Last active
December 16, 2015 04:08
-
-
Save sanfx/5374502 to your computer and use it in GitHub Desktop.
Checks if sequence exist on disk. seqPath = image sequence path example: J:/Footages/33x01_02a/33x01_02a.%04d.sgi where %04d can be any sequence like 0001-0265, 231-689 but not KFd001- KFd567 string change buildPath at line 21 to customize for compatibility frstFrame = First frame as string lastFrame = Last frame as string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def sequenceExists(seqPath, firstFrame, lastFrame, sep=None): | |
""" Checks if sequence exist on disk. | |
seqPath (string): image sequence path | |
example: J:/Footages/33x01_02a/33x01_02a.%04d.sgi | |
where %04d can be any sequence like 0001-0265, 231-689 but not KFd001- KFd567 string | |
change buildPath at line 21 to customize for compatibility | |
frstFrame (string): First frame as string | |
lastFrame (string): Last frame as string | |
""" | |
builPath = "" | |
fnSep = sep or "." | |
seqPathLst = seqPath.split(fnSep) | |
frmNumLen = len(firstFrame) | |
for each in range(int(firstFrame),int(lastFrame)+1): | |
newLen = frmNumLen - len(str(each)) | |
numFmt = newLen* "0" + str(each) | |
buildPath = seqPathLst[0] + fnSep + numFmt + fnSep + seqPathLst[-1] | |
if not os.path.exists(buildPath): | |
return False | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment