Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## {{{ A simple recrusive directory walker that search for VIDEO_TS folders
- import sys
- import os
- from subprocess import call
- def setNumFile(path, fileName):
- num = 0
- while True:
- num = num + 1
- if not os.path.exists(path + "/" + fileName + '_[' + str(num) + ']' + ".iso"):
- break
- return fileName + '_[' + str(num) + ']'
- def callImgburn(path, name):
- isoFolder = "D:\\burnISO"
- if os.path.isfile(isoFolder + "/" + name + ".iso"):
- name = setNumFile(isoFolder, name)
- call(['C:\Program Files (x86)\ImgBurn\ImgBurn.exe', '/MODE', 'BUILD',
- '/BUILDMODE', 'IMAGEFILE', '/NOIMAGEDETAILS', '/VOLUMELABEL', name,
- '/SRC', path, '/DEST', isoFolder+'\\'+name+'.iso', '/START', '/CLOSE'])
- def checkDVDFolder(startDir, movieName):
- imgBurnCalls = 0
- directories = [startDir]
- while len(directories)>0:
- directory = directories.pop()
- for name in os.listdir(directory):
- fullpath = os.path.join(directory, name)
- if os.path.isdir(fullpath):
- if os.path.basename(fullpath) == "VIDEO_TS":
- callImgburn(fullpath, movieName)
- imgBurnCalls = imgBurnCalls + 1
- directories.append(fullpath) # It's a directory, store it.
- return imgBurnCalls
- numCalls = checkDVDFolder(sys.argv[1], sys.argv[3])
- if numCalls <= 0:
- print "Video2iso.py says: I cant find anny VIDEO_TS folders"
- else:
- print "Video2iso.py says: I manufactured "+str(numCalls)+" iso files"
- ## End of the program }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement