From 915f2a92ac12df97c1f09873201bfb38995cf0a7 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 23 Sep 2020 03:16:06 +0200 Subject: update workflow, semi fix integrated updater --- scripts/update-version.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scripts/update-version.py (limited to 'scripts/update-version.py') diff --git a/scripts/update-version.py b/scripts/update-version.py new file mode 100644 index 000000000..d6c560f09 --- /dev/null +++ b/scripts/update-version.py @@ -0,0 +1,28 @@ +from datetime import datetime +import urllib.request + +response = urllib.request.urlopen('https://blackjack4494.github.io/youtube-dlc/update/LATEST_VERSION') + +_LATEST_VERSION = response.read().decode('utf-8') + +_OLD_VERSION = _LATEST_VERSION.rsplit("-", 1) + +if len(_OLD_VERSION) > 0: + old_ver = _OLD_VERSION[0] + +old_rev = '' +if len(_OLD_VERSION) > 1: + old_rev = _OLD_VERSION[1] + +ver = f'{datetime.today():%Y.%m.%d}' +rev = '' + +if old_ver == ver: + if old_rev: + rev = int(old_rev) + 1 + else: + rev = 1 + +_SEPARATOR = '-' + +version = _SEPARATOR.join(filter(None, [ver, str(rev)])) -- cgit v1.2.3