Commits

rg3  committed 157fbbe

Finish templating system

  • Participants
  • Parent commits 4249f98

Comments (0)

Files changed (3)

 
 Note that if you directly click on these hyperlinks, your web browser will most likely display the program contents. It's usually better to right-click on it and choose the appropriate option, normally called Save Target As or Save Link As, depending on the web browser you are using.
 
-==== 2009.02.07 ====
+==== [[http://bitbucket.org/rg3/youtube-dl/raw/ef03a5f5f333/youtube-dl|2009.02.07]] ====
 
 * **MD5**: db2c474cbe794e8c755476e51306ec56
 * **SHA1**: d69ea33c77d35b2bd9070eaa5613920cf8665f61

File Home.wiki.in

 
 Note that if you directly click on these hyperlinks, your web browser will most likely display the program contents. It's usually better to right-click on it and choose the appropriate option, normally called Save Target As or Save Link As, depending on the web browser you are using.
 
-==== 2009.02.07 ====
+==== [[@PROGRAM_URL@|@PROGRAM_VERSION@]] ====
 
 * **MD5**: @PROGRAM_MD5SUM@
 * **SHA1**: @PROGRAM_SHA1SUM@

File generate-home

 import hashlib
 import subprocess
 
+# Get commit for current version
+p = subprocess.Popen('cd ../src && hg tags | grep "^$( ../src/youtube-dl --version )" | cut -d: -f2', shell=True, stdout=subprocess.PIPE)
+commit = p.communicate()[0].strip()
+p.wait()
+
+# Read template page
 template = file('Home.wiki.in', 'r').read()
+
+# Build replacement strings
+data = file('../src/youtube-dl', 'rb').read()
 version = subprocess.Popen(['../src/youtube-dl', '--version'], stdout=subprocess.PIPE).communicate()[0].strip()
-data = file('../src/youtube-dl', 'rb').read()
+url = 'http://bitbucket.org/rg3/youtube-dl/raw/%s/youtube-dl' % commit
 md5sum = hashlib.md5(data).hexdigest()
 sha1sum = hashlib.sha1(data).hexdigest()
 sha256sum = hashlib.sha256(data).hexdigest()
 template = template.replace('@PROGRAM_VERSION@', version)
+template = template.replace('@PROGRAM_URL@', url)
 template = template.replace('@PROGRAM_MD5SUM@', md5sum)
 template = template.replace('@PROGRAM_SHA1SUM@', sha1sum)
 template = template.replace('@PROGRAM_SHA256SUM@', sha256sum)