]>
Raphaƫl G. Git Repositories - youtubedl/blob - devscripts/gh-pages/add-version.py
9 print('Specify the version number as parameter')
13 with open('update/LATEST_VERSION', 'w') as f
:
16 versions_info
= json
.load(open('update/versions.json'))
17 if 'signature' in versions_info
:
18 del versions_info
['signature']
22 filenames
= {'bin': 'youtube-dl', 'exe': 'youtube-dl.exe', 'tar': 'youtube-dl-%s.tar.gz' % version
}
23 for key
, filename
in filenames
.items():
24 print('Downloading and checksumming %s...' %filename
)
25 url
= 'http://youtube-dl.org/downloads/%s/%s' % (version
, filename
)
26 data
= urllib
.request
.urlopen(url
).read()
27 sha256sum
= hashlib
.sha256(data
).hexdigest()
28 new_version
[key
] = (url
, sha256sum
)
30 versions_info
['versions'][version
] = new_version
31 versions_info
['latest'] = version
33 json
.dump(versions_info
, open('update/versions.json', 'w'), indent
=4, sort_keys
=True)