Update generate-download

This commit is contained in:
Philipp Hagemeister 2011-09-13 23:06:09 +02:00
parent 463fe92d26
commit ac47cfe369

View file

@ -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()