]>
Raphaƫl G. Git Repositories - youtubedl/blob - devscripts/gh-pages/update-feed.py
9 atom_template
=textwrap
.dedent("""\
10 <?xml version='1.0' encoding='utf-8'?>
11 <atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
12 <atom:title>youtube-dl releases</atom:title>
13 <atom:id>youtube-dl-updates-feed</atom:id>
14 <atom:updated>@TIMESTAMP@</atom:updated>
18 entry_template
=textwrap
.dedent("""
20 <atom:id>youtube-dl-@VERSION@</atom:id>
21 <atom:title>New version @VERSION@</atom:title>
22 <atom:link href="http://rg3.github.io/youtube-dl" />
23 <atom:content type="xhtml">
24 <div xmlns="http://www.w3.org/1999/xhtml">
25 Downloads available at <a href="https://yt-dl.org/downloads/@VERSION@/">https://yt-dl.org/downloads/@VERSION@/</a>
29 <atom:name>The youtube-dl maintainers</atom:name>
31 <atom:updated>@TIMESTAMP@</atom:updated>
35 now
= datetime
.datetime
.now()
36 now_iso
= now
.isoformat()
38 atom_template
= atom_template
.replace('@TIMESTAMP@',now_iso
)
42 versions_info
= json
.load(open('update/versions.json'))
43 versions
= list(versions_info
['versions'].keys())
47 entry
= entry_template
.replace('@TIMESTAMP@',v
.replace('.','-'))
48 entry
= entry
.replace('@VERSION@',v
)
51 entries_str
= textwrap
.indent(''.join(entries
), '\t')
52 atom_template
= atom_template
.replace('@ENTRIES@', entries_str
)
54 with open('update/releases.atom','w',encoding
='utf-8') as atom_file
:
55 atom_file
.write(atom_template
)