2021-06-03 03:43:42 -06:00
|
|
|
#!/usr/bin/env python3
|
2020-09-22 19:35:14 -06:00
|
|
|
from __future__ import unicode_literals
|
2021-06-03 03:43:42 -06:00
|
|
|
|
2020-09-22 19:16:06 -06:00
|
|
|
from datetime import datetime
|
2021-01-28 12:32:37 -07:00
|
|
|
# import urllib.request
|
2020-09-22 19:16:06 -06:00
|
|
|
|
2021-01-28 12:32:37 -07:00
|
|
|
# response = urllib.request.urlopen('https://blackjack4494.github.io/youtube-dlc/update/LATEST_VERSION')
|
2021-01-29 10:45:27 -07:00
|
|
|
# old_version = response.read().decode('utf-8')
|
2020-09-22 19:16:06 -06:00
|
|
|
|
2021-02-24 11:45:56 -07:00
|
|
|
exec(compile(open('yt_dlp/version.py').read(), 'yt_dlp/version.py', 'exec'))
|
2021-01-29 10:45:27 -07:00
|
|
|
old_version = locals()['__version__']
|
2020-09-22 19:16:06 -06:00
|
|
|
|
2021-02-09 05:34:00 -07:00
|
|
|
old_version_list = old_version.split(".", 4)
|
2020-09-22 19:16:06 -06:00
|
|
|
|
2021-01-29 10:45:27 -07:00
|
|
|
old_ver = '.'.join(old_version_list[:3])
|
|
|
|
old_rev = old_version_list[3] if len(old_version_list) > 3 else ''
|
2020-09-22 19:16:06 -06:00
|
|
|
|
2021-02-16 04:24:42 -07:00
|
|
|
ver = datetime.utcnow().strftime("%Y.%m.%d")
|
2021-01-24 13:47:37 -07:00
|
|
|
rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
|
2020-09-22 19:16:06 -06:00
|
|
|
|
2021-01-29 10:45:27 -07:00
|
|
|
VERSION = '.'.join((ver, rev)) if rev else ver
|
|
|
|
# VERSION_LIST = [(int(v) for v in ver.split(".") + [rev or 0])]
|
2020-09-22 19:16:06 -06:00
|
|
|
|
2021-02-24 11:45:56 -07:00
|
|
|
print('::set-output name=ytdlp_version::' + VERSION)
|
2020-09-22 19:16:06 -06:00
|
|
|
|
2021-02-24 11:45:56 -07:00
|
|
|
file_version_py = open('yt_dlp/version.py', 'rt')
|
2020-09-22 19:16:06 -06:00
|
|
|
data = file_version_py.read()
|
2021-01-29 10:45:27 -07:00
|
|
|
data = data.replace(old_version, VERSION)
|
2020-09-22 19:16:06 -06:00
|
|
|
file_version_py.close()
|
2021-01-24 13:47:37 -07:00
|
|
|
|
2021-02-24 11:45:56 -07:00
|
|
|
file_version_py = open('yt_dlp/version.py', 'wt')
|
2020-09-22 19:16:06 -06:00
|
|
|
file_version_py.write(data)
|
|
|
|
file_version_py.close()
|