From ac47cfe3693427e4e3b237b4ae54026b2e3e8ddf Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Tue, 13 Sep 2011 23:06:09 +0200 Subject: [PATCH] Update generate-download --- generate-download | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/generate-download b/generate-download index c5680b8ac..d6d5d42de 100755 --- a/generate-download +++ b/generate-download @@ -1,21 +1,16 @@ #!/usr/bin/env python import hashlib import subprocess -import sys +import os.path -# Run command line and get output -def output(cmdline): - p = subprocess.Popen(cmdline, shell=True, stdout=subprocess.PIPE) - retval = p.communicate()[0] - p.wait() - return retval +youtubeDlDir = os.path.join(os.path.dirname(__file__), '..', 'youtube-dl') # Read template page template = file('download.html.in', 'r').read() # Build replacement strings -version = output('cd ../master && git tag | tail -1').strip() -data = output('cd ../master && git show %s:youtube-dl' % version) +version = subprocess.check_output([os.path.join(youtubeDlDir, 'youtube-dl'), '--version']).strip() +data = subprocess.check_output(['git', 'show', '%s:youtube-dl' % version], cwd=youtubeDlDir) url = 'https://github.com/rg3/youtube-dl/raw/%s/youtube-dl' % version md5sum = hashlib.md5(data).hexdigest() sha1sum = hashlib.sha1(data).hexdigest()