diff options
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/generate_changelog.py | 116 | ||||
-rw-r--r-- | misc/how to do a release | 47 | ||||
-rwxr-xr-x | misc/randominfo.py | 12 | ||||
-rwxr-xr-x | misc/test-tokens.py | 26 |
4 files changed, 0 insertions, 201 deletions
diff --git a/misc/generate_changelog.py b/misc/generate_changelog.py deleted file mode 100755 index 1bce073..0000000 --- a/misc/generate_changelog.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python3 -import email.utils -import feedgenerator - -def parse_changelog(lines): - got_version = False - got_date = False - got_url = False - done_remarks = False - releases = [] - release = {} - release_remarks = [] - release_changes = [] - current_change = "" - - for idx, line in enumerate(lines): - line = line.rstrip() - - if not got_version: - got_version = True - release["version"] = line - continue - - if not got_date: - release["date"] = email.utils.parsedate_to_datetime(line) - got_date = True - continue - - key, sep, val = line.partition(": ") - if key in ["url", "sha256", "released"] and val != "": - release[key] = val - continue - - if not done_remarks: - if line == "": - done_remarks = True - release["remarks"] = release_remarks - release_remarks = [] - continue - else: - release_remarks.append(line) - continue - - if line != "": - release_changes.append(line.rstrip()) - - if idx + 1 != len(lines): - continue - - release["changes"] = release_changes - if release.get("released") != "no": - releases.append(release) - - got_version = False - got_date = False - done_remarks = False - release = {} - release_changes = [] - - return releases - -def generate_rss_feed(releases): - feed = feedgenerator.Rss201rev2Feed( - title="yt-dlp-rajiko changelog", - description="Notifications for new yt-dlp-rajiko releases, with changelogs", - link="https://427738.xyz/yt-dlp-rajiko/", - language="en-GB", - ttl=180, # 3 hours - ) - - for release in releases: - title = "yt-dlp-rajiko " + release["version"] + " has been released" - description = "" - description += "<p>" - for remark in release["remarks"]: - description += remark - description += "<br/>" - description += "</p>" - description += "<p>This release:</p>\n" - description += "<ul>" - for change in release["changes"]: - description += "<li>" - description += change - description += "</li>\n" - description += "</ul></p>" - - if release.get("url"): - if release["version"] != "1.0": - description += "\n<p>If you use pip, you should be able to upgrade with <code>pip install yt-dlp-rajiko --upgrade --extra-index-url https://427738.xyz/yt-dlp-rajiko/pip/</code>.<br>" - description += "If you installed manually, you can download the updated <code>.whl</code> from this post's link." - if release.get("sha256"): - description += " The SHA256 checksum should be <code>" - description += release.get("sha256") - description += "</code>." - description += "</p>" - else: - description += '\n<p>Please see <a href="https://427738.xyz/yt-dlp-rajiko/#install">the homepage</a> for initial installation instructions.</p>' - - feed.add_item( - title=title, - description=description, - link=release.get("url"), - pubdate=release["date"] - ) - return feed - -if __name__ == "__main__": - with open("CHANGELOG") as f: - releases = parse_changelog(f.readlines()) - - feed = generate_rss_feed(releases) - feed_contents = feed.writeString("utf-8") - feed_contents = feed_contents.replace("<rss", '<?xml-stylesheet href="rss-style.xsl" type="text/xsl"?>\n<rss') - - with open('CHANGELOG.xml', 'w') as fp: - fp.write(feed_contents) diff --git a/misc/how to do a release b/misc/how to do a release deleted file mode 100644 index f5eb85f..0000000 --- a/misc/how to do a release +++ /dev/null @@ -1,47 +0,0 @@ -putting this here because i'll forget how to do it otherwise - -update the pyproject.toml -tag it in git, eg v1.0 - -## build the builds -python3 -m build - -and then put BOTH items from `dist` into the pip index dir - ~/site2/yt-dlp-rajiko/pip/yt-dlp-rajiko/ -because without the .whl pip has to "build" it itself, with all the stuff that needs to be installed for that to work -update the pip index html -update the dl/ "latest" symlinks - -## update the changelog file - -~/site2/yt-dlp-rajiko/CHANGELOG - -``` -version number -date (git log v1.0 --pretty --date=rfc2822) -url: whl download link -sha256: sha256 of the whl -brief summary of the release -can span multiple lines - -bullet points of changes, 1 per line -simple present tense, third person singular - continue "this release...", eg.. -fixes a bug where the computer would explode -makes downloading 5000x faster -``` - -./generate_changelog.py to make the new rss feed - -## update the website - -move the previous release into the "Previous releases" <details> -update the sha256 (just sha256 command in the pip dir) -update the whl link -repeat for japanese version - -now push to the server - -## update github - -paste the changelog output into a github release, upload the new builds - -and thats probably all diff --git a/misc/randominfo.py b/misc/randominfo.py deleted file mode 100755 index bdb7660..0000000 --- a/misc/randominfo.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -from yt_dlp_plugins.extractor import radiko -from yt_dlp import YoutubeDL - - -ie = radiko._RadikoBaseIE() -ydl = YoutubeDL(auto_init=False) -ie.set_downloader(ydl) - -info = ie._generate_random_info() -print("random device info") -print(info) diff --git a/misc/test-tokens.py b/misc/test-tokens.py deleted file mode 100755 index ba6475f..0000000 --- a/misc/test-tokens.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 -import unittest - -from yt_dlp_plugins.extractor import radiko -from yt_dlp import YoutubeDL - - -class test_tokens(unittest.TestCase): - - def setUp(self): - self.ie = radiko._RadikoBaseIE() - ydl = YoutubeDL(auto_init=False) - self.ie.set_downloader(ydl) - - def test_area(self): - # check areas etc work - for i in range(1, 48): - area = "JP" + str(i) - with self.subTest(f"Negotiating token for {area}", area=area): - token = self.ie._negotiate_token(area) - self.assertEqual(token.get("X-Radiko-AreaId"), area) - - -if __name__ == '__main__': - unittest.main() - # may wish to set failfast=True |