|
2 | 2 |
|
3 | 3 | # |
4 | 4 | # Copyright (C) 2016 James Elliott |
5 | | -# Copyright (C) 2016-2018 Plailect |
| 5 | +# Copyright (C) 2016-2018 Plailect |
6 | 6 | # Copyright (C) 2022-2023 Nintendo Homebrew |
7 | 7 | # |
8 | 8 | # SPDX-License-Identifier: MIT |
|
35 | 35 | xml.write("<rss version=\"2.0\">\n") |
36 | 36 | xml.write("\t<channel>\n") |
37 | 37 | xml.write("\t\t<title>Plailect Guide Feed</title>\n") |
38 | | - xml.write("\t\t<lastBuildDate>{0}</lastBuildDate>\n".format(datetime.datetime.utcnow().strftime("%a, %d %b %Y %X +0000"))) |
| 38 | + xml.write(f"\t\t<lastBuildDate>{datetime.datetime.utcnow().strftime("%a, %d %b %Y %X +0000")}</lastBuildDate>\n") |
39 | 39 | xml.write("\t\t<link>https://github.com/hacks-guide/Guide_3DS/</link>\n") |
40 | 40 |
|
41 | 41 | for filename in os.listdir(dir): |
|
47 | 47 | tor = bencodepy.decode(raw) |
48 | 48 | trackers = [] |
49 | 49 | infohash = hashlib.sha1(bencodepy.encode(tor[b"info"])).hexdigest().upper() |
50 | | - magp = {"xt": "urn:btih:{0}".format(infohash), "dn": tor[b"info"][b"name"], "xl": tor[b"info"][b"length"]} |
| 50 | + magp = {"xt": f"urn:btih:{infohash}", "dn": tor[b"info"][b"name"], "xl": tor[b"info"][b"length"]} |
51 | 51 | magstr = urllib.parse.urlencode(magp) |
52 | 52 | if b'announce-list' in tor: |
53 | 53 | for anncl in tor[b'announce-list']: |
|
66 | 66 | for i in items: |
67 | 67 | pubdate = datetime.datetime.utcfromtimestamp(int(i["ts"])) |
68 | 68 | xml.write("\t\t<item>\n") |
69 | | - xml.write("\t\t\t<title>{0}</title>\n".format(i["name"])) |
70 | | - xml.write("\t\t\t<description>{0}</description>\n".format(i["name"])) |
71 | | - xml.write("\t\t\t<guid>{0}</guid>\n".format(i["infohash"])) |
72 | | - xml.write("\t\t\t<link>magnet:?xt=urn:btih:{0}</link>\n".format(i["infohash"])) |
73 | | - xml.write("\t\t\t<pubDate>{0}</pubDate>\n".format(pubdate.strftime("%a, %d %b %Y %X +0000"))) |
74 | | - xml.write("\t\t\t<contentLength>{0}</contentLength>\n".format(i["length"])) |
75 | | - xml.write("\t\t\t<infoHash>{0}</infoHash>\n".format(i["infohash"])) |
76 | | - xml.write("\t\t\t<magnetURI>magnet:?xt=urn:btih:{0}</magnetURI>\n".format(i["infohash"])) |
| 69 | + xml.write(f"\t\t\t<title>{i['name']}</title>\n") |
| 70 | + xml.write(f"\t\t\t<description>{i['name']}</description>\n".format(i["name"])) |
| 71 | + xml.write(f"\t\t\t<guid>{i['infohash']}</guid>\n") |
| 72 | + xml.write(f"\t\t\t<link>magnet:?xt=urn:btih:{i['infohash']}</link>\n") |
| 73 | + xml.write(f"\t\t\t<pubDate>{pubdate.strftime("%a, %d %b %Y %X +0000")}</pubDate>\n") |
| 74 | + xml.write(f"\t\t\t<contentLength>{i['length']}</contentLength>\n") |
| 75 | + xml.write(f"\t\t\t<infoHash>{i['infohash']}</infoHash>\n") |
| 76 | + xml.write(f"\t\t\t<magnetURI>magnet:?xt=urn:btih:{i['infohash']}</magnetURI>\n") |
77 | 77 | #xml.write("\t\t\t<fileName>{0}</fileName><fileName>\n".format(name)) |
78 | | - xml.write("\t\t\t<enclosure url=\"magnet:?xt=urn:btih:{0}\" type=\"application/x-bittorrent\" />\n".format(i["infohash"])) |
| 78 | + xml.write(f"\t\t\t<enclosure url=\"magnet:?xt=urn:btih:{i['infohash']}\" type=\"application/x-bittorrent\" />\n") |
79 | 79 |
|
80 | 80 | if i["trackers"]: |
81 | 81 | xml.write("\t\t\t<trackers>\n") |
82 | 82 | xml.write("\t\t\t\t<group order=\"random\">\n") |
83 | 83 |
|
84 | 84 | for tracker in i["trackers"]: |
85 | 85 | xml.write("\t\t\t\t\t<tracker>\n") |
86 | | - xml.write("\t\t\t\t\t\t{0}\n".format(tracker)) |
| 86 | + xml.write(f"\t\t\t\t\t\t{tracker}\n") |
87 | 87 | xml.write("\t\t\t\t\t</tracker>\n") |
88 | 88 |
|
89 | 89 | xml.write("\t\t\t\t</group>\n") |
|
0 commit comments