May-07-2018, 11:40 PM
Hi all. First post, very new to Python and programming in general. K, now the question:
I have this script:
I have this script:
import sys, shutil, subprocess, ffmpy
def getDimensions(inputVideo):
args = '-v error -select_streams v:0 -show_entries stream=width,height ' \
'-of compact'
call = ffmpy.FFprobe(r'E:\\App Back-Ups\FFprobe\ffprobe.exe', args, \
{inputVideo : None})
return call.run(None, subprocess.PIPE)
def getHeight(tupleIn):
a = str(tupleIn[0])
b = a.rfind('=')
return a[b + 1:b + 4]
toMove = sys.argv[1]
output = getDimensions(toMove)
height = getHeight(output)
if height == '480':
pathStr1 = 'E:\\My Movies\DVD Rips\\'
pathStr2 = 'G:\\My Movies\DVD Rips'
else:
pathStr1 = 'E:\\My Movies\Blu-ray Rips\\'
pathStr2 = 'G:\\My Movies\Blu-ray Rips'
lastSep = toMove.rfind('\\')
toCopy = pathStr1 + toMove[lastSep + 1:]
shutil.move(toMove, pathStr1)
shutil.copy(toCopy, pathStr2)
input('Press \'Enter\' to exit...')
sys.exit()It works fine, but sometimes the movie file sizes are quite large and they take a while to copy. I'm wondering how to add a progress bar or percent (preferable) to the runtime. I'm stuck figuring out how because shutil pauses while it's processing the move/copy and does not pick up the next line of script until after it has finished the copy. So, is it possible to add a simple percentage copied output to this script? Just so I know how much is done and how much more is left.
