Add script for tagging versions, yaml changelog

This commit is contained in:
Ivan Habunek 2022-01-25 08:35:24 +01:00
parent 310010363f
commit 28b4c6146b
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95
6 changed files with 304 additions and 61 deletions

View File

@ -1,69 +1,58 @@
Twitch Downloader change log
============================
twitch-dl changelog
===================
1.18.0 (2022-01-25)
-------------------
<!-- Do not edit. This file is automatically generated from changelog.yaml.-->
**1.18.0 (2022-01-25)**
* Add `--output` option to `download` command which allows setting output file
template (#70)
* Ask to overwrite before downloading to avoid later prompt
1.17.1 (2022-01-19)
-------------------
**1.17.1 (2022-01-19)**
* Upgrade m3u8 lib to 1.0.0+
1.17.0 (2021-12-03)
-------------------
**1.17.0 (2021-12-03)**
* Fix speed calculation when resuming download (#75, thanks CroquetteTheThe)
* Add artist and title metadata to resulting video (#80)
1.16.1 (2021-07-31)
-------------------
**1.16.1 (2021-07-31)**
* Fix compat with older versions of python (#71)
1.16.0 (2021-06-09)
-------------------
**1.16.0 (2021-06-09)**
* Fix clips download caused by Twitch changes (#64, thanks to all participants)
1.15.0 (2021-02-15)
-------------------
**1.15.0 (2021-02-15)**
* Add support for new format of clip slug (thanks @Loveangel1337)
1.14.1 (2021-01-14)
-------------------
**1.14.1 (2021-01-14)**
* Handle videos which don't exist more gracefully
1.14.0 (2021-01-14)
-------------------
**1.14.0 (2021-01-14)**
* Added `info` command for displaying video or clip info (#51)
* Don't show there are more videos when there aren't (#52, thanks @scottyallen)
* Fixed Twitch regression for getting the access token (#53)
1.13.1 (2020-11-23)
-------------------
**1.13.1 (2020-11-23)**
* Fixed clip download issue (#45)
1.13.0 (2020-11-10)
-------------------
**1.13.0 (2020-11-10)**
* Added `clips` command for listing and batch downloading clips (#26)
1.12.1 (2020-09-29)
-------------------
**1.12.1 (2020-09-29)**
* Fix bug introduced in previous version which broke joining
1.12.0 (2020-09-29)
-------------------
**1.12.0 (2020-09-29)**
* Added `source` as alias for best available quality (#33)
* Added `--no-join` option to `download` to skip ffmpeg join (#36)
@ -71,43 +60,37 @@ Twitch Downloader change log
for confirmation (#37)
* Added `--pager` option to `videos`, don't page by default (#30)
1.11.0 (2020-09-03)
-------------------
**1.11.0 (2020-09-03)**
* Make downloading more robust, fixes issues with some VODs (#35)
* Bundle twitch-dl to a standalone archive, simplifying installation, see
installation instructions in README
1.10.2 (2020-08-11)
-------------------
**1.10.2 (2020-08-11)**
* Fix version number displayed by `twitch-dl --version` (#29)
1.10.1 (2020-08-09)
-------------------
**1.10.1 (2020-08-09)**
* Fix videos incorrectly identified as clips (#28)
* Make download command work with video URLs lacking "www" before "twitch.tv"
* Make download command work with video URLs lacking 'www' before 'twitch.tv'
* Print an error when video or clip is not found instead of an exception trace
1.10.0 (2020-08-07)
-------------------
**1.10.0 (2020-08-07)**
* Add `--quality` option to `download` command, allows specifying the video
quality to download. In this case, twitch-dl will require no user input. (#22)
* Fix download of clips which contain numbers in their slug (#24)
* Fix URL to video displayed by `videos` command (it was missing /videos/)
1.9.0 (2020-06-10)
------------------
**1.9.0 (2020-06-10)**
* **Breaking**: wrongly named `--max_workers` option changed to `--max-workers`.
The shorthand option `-w` remains the same.
* Fix bug where `videos` command would crash if there was no game info (#21)
* Allow unicode characters in filenames, no longer strips e.g. cyrillic script
1.8.0 (2020-05-17)
------------------
**1.8.0 (2020-05-17)**
* Fix videos command (#18)
* **Breaking**: `videos` command no longer takes the `--offset` parameter due to
@ -115,58 +98,50 @@ Twitch Downloader change log
* Add paging to `videos` command to replace offset
* Add `--game` option to `videos` command to filter by game
1.7.0 (2020-04-25)
------------------
**1.7.0 (2020-04-25)**
* Support for specifying broadcast type when listing videos (#13)
1.6.0 (2020-04-11)
------------------
**1.6.0 (2020-04-11)**
* Support for downloading clips (#15)
1.5.1 (2020-04-11)
------------------
**1.5.1 (2020-04-11)**
* Fix VOD naming issue (#12)
* Nice console output while downloading
1.5.0 (2020-04-10)
------------------
**1.5.0 (2020-04-10)**
* Fix video downloads after Twitch deprecated access token access
* Don't print errors when retrying download, only if all fails
1.4.0 (2019-08-23)
------------------
**1.4.0 (2019-08-23)**
* Fix usage of deprecated v3 API
* Use m3u8 lib for parsing playlists
* Add `--keep` option not preserve downloaded VODs
1.3.1 (2019-08-13)
------------------
**1.3.1 (2019-08-13)**
* No changes, bumped to fix issue with pypi
1.3.0 (2019-08-13)
------------------
**1.3.0 (2019-08-13)**
* Add `--sort` and `--offset` options to `videos` command, allows paging (#7)
* Show video URL in `videos` command output
1.2.0 (2019-07-05)
------------------
**1.2.0 (2019-07-05)**
* Add `--format` option to `download` command for specifying the output format (#6)
* Add `--format` option to `download` command for specifying the output format
(#6)
* Add `--version` option for printing program version
1.1.0 (2019-06-06)
------------------
**1.1.0 (2019-06-06)**
* Allow limiting download by start and end time
1.0.0 (2019-04-30)
------------------
**1.0.0 (2019-04-30)**
* Initial release

View File

@ -33,3 +33,6 @@ man:
test:
pytest
changelog:
./scripts/generate_changelog > CHANGELOG.md

163
changelog.yaml Normal file
View File

@ -0,0 +1,163 @@
1.18.0:
date: 2022-01-25
changes:
- "Add `--output` option to `download` command which allows setting output file template (#70)"
- "Ask to overwrite before downloading to avoid later prompt"
1.17.1:
date: 2022-01-19
changes:
- "Upgrade m3u8 lib to 1.0.0+"
1.17.0:
date: 2021-12-03
changes:
- "Fix speed calculation when resuming download (#75, thanks CroquetteTheThe)"
- "Add artist and title metadata to resulting video (#80)"
1.16.1:
date: 2021-07-31
changes:
- "Fix compat with older versions of python (#71)"
1.16.0:
date: 2021-06-09
changes:
- "Fix clips download caused by Twitch changes (#64, thanks to all participants)"
1.15.0:
date: 2021-02-15
changes:
- "Add support for new format of clip slug (thanks @Loveangel1337)"
1.14.1:
date: 2021-01-14
changes:
- "Handle videos which don't exist more gracefully"
1.14.0:
date: 2021-01-14
changes:
- "Added `info` command for displaying video or clip info (#51)"
- "Don't show there are more videos when there aren't (#52, thanks @scottyallen)"
- "Fixed Twitch regression for getting the access token (#53)"
1.13.1:
date: 2020-11-23
changes:
- "Fixed clip download issue (#45)"
1.13.0:
date: 2020-11-10
changes:
- "Added `clips` command for listing and batch downloading clips (#26)"
1.12.1:
date: 2020-09-29
changes:
- "Fix bug introduced in previous version which broke joining"
1.12.0:
date: 2020-09-29
changes:
- "Added `source` as alias for best available quality (#33)"
- "Added `--no-join` option to `download` to skip ffmpeg join (#36)"
- "Added `--overwrite` option to `download` to overwrite target without prompting for confirmation (#37)"
- "Added `--pager` option to `videos`, don't page by default (#30)"
1.11.0:
date: 2020-09-03
changes:
- "Make downloading more robust, fixes issues with some VODs (#35)"
- "Bundle twitch-dl to a standalone archive, simplifying installation, see installation instructions in README"
1.10.2:
date: 2020-08-11
changes:
- "Fix version number displayed by `twitch-dl --version` (#29)"
1.10.1:
date: 2020-08-09
changes:
- "Fix videos incorrectly identified as clips (#28)"
- "Make download command work with video URLs lacking 'www' before 'twitch.tv'"
- "Print an error when video or clip is not found instead of an exception trace"
1.10.0:
date: 2020-08-07
changes:
- "Add `--quality` option to `download` command, allows specifying the video quality to download. In this case, twitch-dl will require no user input. (#22)"
- "Fix download of clips which contain numbers in their slug (#24)"
- "Fix URL to video displayed by `videos` command (it was missing /videos/)"
1.9.0:
date: 2020-06-10
changes:
- "**Breaking**: wrongly named `--max_workers` option changed to `--max-workers`. The shorthand option `-w` remains the same."
- "Fix bug where `videos` command would crash if there was no game info (#21)"
- "Allow unicode characters in filenames, no longer strips e.g. cyrillic script"
1.8.0:
date: 2020-05-17
changes:
- "Fix videos command (#18)"
- "**Breaking**: `videos` command no longer takes the `--offset` parameter due to API changes"
- "Add paging to `videos` command to replace offset"
- "Add `--game` option to `videos` command to filter by game"
1.7.0:
date: 2020-04-25
changes:
- "Support for specifying broadcast type when listing videos (#13)"
1.6.0:
date: 2020-04-11
changes:
- "Support for downloading clips (#15)"
1.5.1:
date: 2020-04-11
changes:
- "Fix VOD naming issue (#12)"
- "Nice console output while downloading"
1.5.0:
date: 2020-04-10
changes:
- "Fix video downloads after Twitch deprecated access token access"
- "Don't print errors when retrying download, only if all fails"
1.4.0:
date: 2019-08-23
changes:
- "Fix usage of deprecated v3 API"
- "Use m3u8 lib for parsing playlists"
- "Add `--keep` option not preserve downloaded VODs"
1.3.1:
date: 2019-08-13
changes:
- "No changes, bumped to fix issue with pypi"
1.3.0:
date: 2019-08-13
changes:
- "Add `--sort` and `--offset` options to `videos` command, allows paging (#7)"
- "Show video URL in `videos` command output"
1.2.0:
date: 2019-07-05
changes:
- "Add `--format` option to `download` command for specifying the output format (#6)"
- "Add `--version` option for printing program version"
1.1.0:
date: 2019-06-06
changes:
- "Allow limiting download by start and end time"
1.0.0:
date: 2019-04-30
changes:
- "Initial release"

View File

@ -1,3 +1,4 @@
pytest
twine
wheel
pyyaml

33
scripts/generate_changelog Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env python3
"""
Generates a more user-readable changelog from changelog.yaml.
"""
import textwrap
import yaml
with open("changelog.yaml", "r") as f:
data = yaml.safe_load(f)
print("twitch-dl changelog")
print("===================")
print()
print("<!-- Do not edit. This file is automatically generated from changelog.yaml.-->")
print()
for version in data.keys():
date = data[version]["date"]
changes = data[version]["changes"]
print(f"**{version} ({date})**")
print()
for c in changes:
lines = textwrap.wrap(c, 78)
initial = True
for line in lines:
if initial:
print("* " + line)
initial = False
else:
print(" " + line)
print()

68
scripts/tag_version Executable file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env python3
"""
Creates an annotated git tag for a given version number.
The tag will include the version number and changes for given version.
Usage: tag_version [version]
"""
import subprocess
import sys
import textwrap
import yaml
import twitchdl
from datetime import date
from os import path
from pkg_resources import get_distribution
path = path.join(path.dirname(path.dirname(path.abspath(__file__))), "changelog.yaml")
with open(path, "r") as f:
changelog = yaml.safe_load(f)
if len(sys.argv) != 2:
print("Wrong argument count", file=sys.stderr)
sys.exit(1)
version = sys.argv[1]
changelog_item = changelog.get(version)
if not changelog_item:
print(f"Version `{version}` not found in changelog.", file=sys.stderr)
sys.exit(1)
if twitchdl.__version__ != version:
print(f"twitchdl.__version__ is `{twitchdl.__version__}`, expected {version}.", file=sys.stderr)
sys.exit(1)
dist_version = get_distribution('twitch-dl').version
if dist_version != version:
print(f"Version in setup.py is `{dist_version}`, expected {version}.", file=sys.stderr)
sys.exit(1)
release_date = changelog_item["date"]
changes = changelog_item["changes"]
if not isinstance(release_date, date):
print(f"Release date not set for version `{version}` in the changelog.", file=sys.stderr)
sys.exit(1)
commit_message = f"twitch-dl {version}\n\n"
for c in changes:
lines = textwrap.wrap(c, 70)
initial = True
for line in lines:
lead = " *" if initial else " "
initial = False
commit_message += f"{lead} {line}\n"
proc = subprocess.run(["git", "tag", "-a", version, "-m", commit_message])
if proc.returncode != 0:
sys.exit(1)
print()
print(commit_message)
print()
print(f"Version {version} tagged \\o/")