]>
Raphaƫl G. Git Repositories - youtubedl/blob - devscripts/gh-pages/generate-download.py
fcd7e1dff663f1607c2842081b40dc1890cf677a
2 from __future__
import unicode_literals
8 versions_info
= json
.load(open('update/versions.json'))
9 version
= versions_info
['latest']
10 URL
= versions_info
['versions'][version
]['bin'][0]
12 data
= urllib
.request
.urlopen(URL
).read()
15 with open('download.html.in', 'r', encoding
='utf-8') as tmplf
:
16 template
= tmplf
.read()
18 sha256sum
= hashlib
.sha256(data
).hexdigest()
19 template
= template
.replace('@PROGRAM_VERSION@', version
)
20 template
= template
.replace('@PROGRAM_URL@', URL
)
21 template
= template
.replace('@PROGRAM_SHA256SUM@', sha256sum
)
22 template
= template
.replace('@EXE_URL@', versions_info
['versions'][version
]['exe'][0])
23 template
= template
.replace('@EXE_SHA256SUM@', versions_info
['versions'][version
]['exe'][1])
24 template
= template
.replace('@TAR_URL@', versions_info
['versions'][version
]['tar'][0])
25 template
= template
.replace('@TAR_SHA256SUM@', versions_info
['versions'][version
]['tar'][1])
26 with open('download.html', 'w', encoding
='utf-8') as dlf
: