]> jfr.im git - yt-dlp.git/blob - scripts/update-version.py
Option to present -F output to a more tabular form
[yt-dlp.git] / scripts / update-version.py
1 from __future__ import unicode_literals
2 from datetime import datetime
3 import urllib.request
4
5 response = urllib.request.urlopen('https://blackjack4494.github.io/youtube-dlc/update/LATEST_VERSION')
6
7 _LATEST_VERSION = response.read().decode('utf-8')
8
9 _OLD_VERSION = _LATEST_VERSION.rsplit("-", 1)
10
11 if len(_OLD_VERSION) > 0:
12 old_ver = _OLD_VERSION[0]
13
14 old_rev = ''
15 if len(_OLD_VERSION) > 1:
16 old_rev = _OLD_VERSION[1]
17
18 now = datetime.now()
19 # ver = f'{datetime.today():%Y.%m.%d}'
20 ver = now.strftime("%Y.%m.%d")
21 rev = ''
22
23 if old_ver == ver:
24 if old_rev:
25 rev = int(old_rev) + 1
26 else:
27 rev = 1
28
29 _SEPARATOR = '-'
30
31 version = _SEPARATOR.join(filter(None, [ver, str(rev)]))