Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Progress Finished Question
#1
Hi all. First post, very new to Python and programming in general. K, now the question:
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.
Reply


Messages In This Thread
Progress Finished Question - by malonn - May-07-2018, 11:40 PM
RE: Progress Finished Question - by Larz60+ - May-08-2018, 01:40 AM
RE: Progress Finished Question - by malonn - May-08-2018, 01:06 PM
RE: Progress Finished Question - by wavic - May-08-2018, 01:35 PM
RE: Progress Finished Question - by malonn - May-08-2018, 05:42 PM
RE: Progress Finished Question - by wavic - May-08-2018, 05:53 PM
RE: Progress Finished Question - by malonn - May-09-2018, 01:08 AM
RE: Progress Finished Question - by wavic - May-09-2018, 06:54 AM
RE: Progress Finished Question - by malonn - May-09-2018, 01:35 PM
RE: Progress Finished Question - by wavic - May-09-2018, 03:50 PM
RE: Progress Finished Question - by malonn - May-09-2018, 11:13 PM
RE: Progress Finished Question - by malonn - May-11-2018, 07:48 PM
RE: Progress Finished Question - by wavic - May-12-2018, 05:43 AM
RE: Progress Finished Question - by malonn - May-12-2018, 05:57 PM
RE: Progress Finished Question - by wavic - May-12-2018, 06:13 PM
RE: Progress Finished Question - by wavic - May-12-2018, 09:37 PM
RE: Progress Finished Question - by malonn - May-21-2018, 06:30 PM
RE: Progress Finished Question - by wavic - May-21-2018, 09:31 PM
RE: Progress Finished Question - by malonn - May-21-2018, 11:10 PM
RE: Progress Finished Question - by wavic - May-21-2018, 11:45 PM
RE: Progress Finished Question - by malonn - May-21-2018, 11:52 PM
RE: Progress Finished Question - by wavic - May-22-2018, 12:10 AM
RE: Progress Finished Question - by malonn - May-22-2018, 01:44 AM
RE: Progress Finished Question - by wavic - May-22-2018, 04:12 AM
RE: Progress Finished Question - by malonn - May-22-2018, 02:05 PM
RE: Progress Finished Question - by wavic - May-22-2018, 02:42 PM
RE: Progress Finished Question - by malonn - May-22-2018, 04:27 PM
RE: Progress Finished Question - by wavic - May-22-2018, 11:20 PM
RE: Progress Finished Question - by malonn - May-22-2018, 11:55 PM
RE: Progress Finished Question - by wavic - May-23-2018, 12:20 AM
RE: Progress Finished Question - by malonn - May-23-2018, 12:41 AM
RE: Progress Finished Question - by wavic - May-23-2018, 01:29 AM
RE: Progress Finished Question - by malonn - May-23-2018, 02:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Process finished with exit code 137 (interrupted by signal 9: SIGKILL) erdemath 2 9,552 Apr-18-2022, 08:40 PM
Last Post: erdemath
  Progress bar bnadir55 1 1,835 Apr-11-2022, 01:52 PM
Last Post: deanhystad
  Using .hdf5 files only once they are finished writing pyhill00 7 2,797 Nov-25-2021, 06:01 PM
Last Post: pyhill00
  How to check if a file has finished being written leocsmith 2 7,849 Apr-14-2021, 04:21 PM
Last Post: perfringo
  Progress Indicator for Xmodem 0.4.6 KenHorse 1 1,977 Jan-30-2021, 07:12 PM
Last Post: bowlofred
  process finished with exit code -1073741819 (0xC0000005) GMCobraz 8 5,426 Sep-01-2020, 08:19 AM
Last Post: GMCobraz
  How to stop Xmodem after bin file transfer was finished shaya2103 0 2,511 Nov-27-2019, 04:33 PM
Last Post: shaya2103
  How can I add a progress bar for my software? aquerci 8 3,781 Nov-16-2019, 04:20 PM
Last Post: aquerci
  wget progress bar anasrocks 1 4,736 Jun-06-2019, 03:12 PM
Last Post: heiner55
  Process finished with exit code -107374819 (0xC0000375) mrazko 2 8,489 Apr-05-2019, 12:46 PM
Last Post: mrazko

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020