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 #!/usr/bin/env python
import hashlib import hashlib
import subprocess import subprocess
import sys import os.path
# Run command line and get output youtubeDlDir = os.path.join(os.path.dirname(__file__), '..', 'youtube-dl')
def output(cmdline):
p = subprocess.Popen(cmdline, shell=True, stdout=subprocess.PIPE)
retval = p.communicate()[0]
p.wait()
return retval
# Read template page # Read template page
template = file('download.html.in', 'r').read() template = file('download.html.in', 'r').read()
# Build replacement strings # Build replacement strings
version = output('cd ../master && git tag | tail -1').strip() version = subprocess.check_output([os.path.join(youtubeDlDir, 'youtube-dl'), '--version']).strip()
data = output('cd ../master && git show %s:youtube-dl' % version) data = subprocess.check_output(['git', 'show', '%s:youtube-dl' % version], cwd=youtubeDlDir)
url = 'https://github.com/rg3/youtube-dl/raw/%s/youtube-dl' % version url = 'https://github.com/rg3/youtube-dl/raw/%s/youtube-dl' % version
md5sum = hashlib.md5(data).hexdigest() md5sum = hashlib.md5(data).hexdigest()
sha1sum = hashlib.sha1(data).hexdigest() sha1sum = hashlib.sha1(data).hexdigest()