mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
12 years ago
|
#!/usr/bin/env python3
|
||
10 years ago
|
from __future__ import unicode_literals
|
||
12 years ago
|
|
||
|
import json
|
||
|
import sys
|
||
|
import hashlib
|
||
11 years ago
|
import os.path
|
||
|
|
||
12 years ago
|
|
||
|
if len(sys.argv) <= 1:
|
||
11 years ago
|
print('Specify the version number as parameter')
|
||
|
sys.exit()
|
||
12 years ago
|
version = sys.argv[1]
|
||
|
|
||
|
with open('update/LATEST_VERSION', 'w') as f:
|
||
11 years ago
|
f.write(version)
|
||
12 years ago
|
|
||
|
versions_info = json.load(open('update/versions.json'))
|
||
|
if 'signature' in versions_info:
|
||
11 years ago
|
del versions_info['signature']
|
||
12 years ago
|
|
||
|
new_version = {}
|
||
|
|
||
11 years ago
|
filenames = {
|
||
4 years ago
|
'bin': 'yt-dlp',
|
||
|
'exe': 'yt-dlp.exe',
|
||
|
'tar': 'yt-dlp-%s.tar.gz' % version}
|
||
11 years ago
|
build_dir = os.path.join('..', '..', 'build', version)
|
||
12 years ago
|
for key, filename in filenames.items():
|
||
11 years ago
|
url = 'https://yt-dl.org/downloads/%s/%s' % (version, filename)
|
||
11 years ago
|
fn = os.path.join(build_dir, filename)
|
||
|
with open(fn, 'rb') as f:
|
||
|
data = f.read()
|
||
|
if not data:
|
||
|
raise ValueError('File %s is empty!' % fn)
|
||
11 years ago
|
sha256sum = hashlib.sha256(data).hexdigest()
|
||
|
new_version[key] = (url, sha256sum)
|
||
12 years ago
|
|
||
|
versions_info['versions'][version] = new_version
|
||
|
versions_info['latest'] = version
|
||
|
|
||
11 years ago
|
with open('update/versions.json', 'w') as jsonf:
|
||
|
json.dump(versions_info, jsonf, indent=4, sort_keys=True)
|