From 10fc438ed2ae7321f1d65c2e91e980c24ea29397 Mon Sep 17 00:00:00 2001 From: Jason Michalski Date: Fri, 16 Nov 2007 03:25:08 +0000 Subject: [PATCH] Patch from nick@cpanel.net millisecs not found files with space in the name fixes #28 fixes #29 --- plugins/video/transcode.py | 14 ++++++++------ pyTivo.conf.dist | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/video/transcode.py b/plugins/video/transcode.py index c1bc638..2731552 100644 --- a/plugins/video/transcode.py +++ b/plugins/video/transcode.py @@ -48,14 +48,13 @@ def transcode(inFile, outFile, tsn=''): settings = {} settings['audio_br'] = Config.getAudioBR(tsn) settings['video_br'] = Config.getVideoBR(tsn) - settings['in_file'] = inFile settings['max_video_br'] = MAX_VIDEO_BR settings['buff_size'] = BUFF_SIZE settings['aspect_ratio'] = ' '.join(select_aspect(inFile, tsn)) cmd_string = Config.getFFMPEGTemplate(tsn) % settings - cmd = [FFMPEG] + cmd_string.split() + cmd = [FFMPEG, '-i', inFile] + cmd_string.split() debug_write(['transcode: ffmpeg command is ', ' '.join(cmd), '\n']) ffmpeg = subprocess.Popen(cmd, stdout=subprocess.PIPE) @@ -251,9 +250,6 @@ def video_info(inFile): output = ffmpeg.stderr.read() debug_write(['video_info: ffmpeg output=', output, '\n']) - durre = re.compile(r'.*Duration: (.{2}):(.{2}):(.{2})\.(.),') - d = durre.search(output) - rezre = re.compile(r'.*Video: ([^,]+),.*') x = rezre.search(output) if x: @@ -298,7 +294,13 @@ def video_info(inFile): if x: fps = '29.97' - millisecs = ((int(d.group(1))*3600) + (int(d.group(2))*60) + int(d.group(3)))*1000 + (int(d.group(4))*100) + durre = re.compile(r'.*Duration: (.{2}):(.{2}):(.{2})\.(.),') + d = durre.search(output) + if d: + millisecs = ((int(d.group(1))*3600) + (int(d.group(2))*60) + int(d.group(3)))*1000 + (int(d.group(4))*100) + else: + millisecs = 0 + info_cache[inFile] = (mtime, (codec, width, height, fps, millisecs)) debug_write(['video_info: Codec=', codec, ' width=', width, ' height=', height, ' fps=', fps, ' millisecs=', millisecs, '\n']) return codec, width, height, fps, millisecs diff --git a/pyTivo.conf.dist b/pyTivo.conf.dist index 012a6fe..287b6fd 100644 --- a/pyTivo.conf.dist +++ b/pyTivo.conf.dist @@ -27,7 +27,7 @@ ffmpeg=/usr/bin/ffmpeg #Valid: 720, 704, 544, 480, 352 #width=1440 #height=720 -ffmpeg_prams=-i %(in_file)s -vcodec mpeg2video -r 29.97 -b %(video_br)s -maxrate %(max_video_br)s -bufsize %(buff_size)s %(aspect_ratio)s -comment pyTivo.py -ac 2 -ab %(audio_br)s -ar 44100 -f vob - +ffmpeg_prams=-vcodec mpeg2video -r 29.97 -b %(video_br)s -maxrate %(max_video_br)s -bufsize %(buff_size)s %(aspect_ratio)s -comment pyTivo.py -ac 2 -ab %(audio_br)s -ar 44100 -f vob - ##Per tivo options # section named _tivo_TSN with the tsn in all caps -- 2.11.4.GIT