All pastes #761538 Raw Edit

leleobhz

public python v1 · immutable
·published 2007-11-04 23:06 UTC
rendered paste body
def mencoder(link,destin):        from string import join        aim = (parse_asx(link))        process = subprocess.Popen(['mencoder', '-oac', 'copy', '-ovc', 'copy', '-o', str(destin), str(aim[0])], stdout=subprocess.PIPE, stderr=subprocess.PIPE)        global pid_mencoder        pid_mencoder=process.pid        while process.poll() == None:                buffer = []                while True:                        char = process.stdout.read(1)                        if char == '\r':                                aLine = join( buffer, '' )                                buffer = []                                break                        else:                                buffer.append(char)                if aLine:                        if re.findall('\(...\)', aLine):                                print aLine                                percentage = aLine.lstrip("\(")                                percentage = aLine.rstrip("\)%")                                percentage = int(percentage)                                progress_count_mencoder = progress_count + percentage                                print (percentage)                                progress.update(progress_count_mencoder)