]>
Raphaƫl G. Git Repositories - youtubedl/blob - devscripts/gh-pages/update-feed.py
2 from __future__
import unicode_literals
10 atom_template
= textwrap
.dedent("""\
11 <?xml version="1.0" encoding="utf-8"?>
12 <feed xmlns="http://www.w3.org/2005/Atom">
13 <link rel="self" href="http://ytdl-org.github.io/youtube-dl/update/releases.atom" />
14 <title>youtube-dl releases</title>
15 <id>https://yt-dl.org/feed/youtube-dl-updates-feed</id>
16 <updated>@TIMESTAMP@</updated>
20 entry_template
= textwrap
.dedent("""
22 <id>https://yt-dl.org/feed/youtube-dl-updates-feed/youtube-dl-@VERSION@</id>
23 <title>New version @VERSION@</title>
24 <link href="http://ytdl-org.github.io/youtube-dl" />
25 <content type="xhtml">
26 <div xmlns="http://www.w3.org/1999/xhtml">
27 Downloads available at <a href="https://yt-dl.org/downloads/@VERSION@/">https://yt-dl.org/downloads/@VERSION@/</a>
31 <name>The youtube-dl maintainers</name>
33 <updated>@TIMESTAMP@</updated>
37 now
= datetime
.datetime
.now()
38 now_iso
= now
.isoformat() + 'Z'
40 atom_template
= atom_template
.replace('@TIMESTAMP@', now_iso
)
42 versions_info
= json
.load(open('update/versions.json'))
43 versions
= list(versions_info
['versions'].keys())
49 year
, month
, day
= map(int, fields
[:3])
54 datetime
.date(year
, month
, day
)
63 patchlevel
= int(fields
[3])
66 timestamp
= '%04d-%02d-%02dT00:%02d:%02dZ' % (year
, month
, day
, faked
, patchlevel
)
68 entry
= entry_template
.replace('@TIMESTAMP@', timestamp
)
69 entry
= entry
.replace('@VERSION@', v
)
72 entries_str
= textwrap
.indent(''.join(entries
), '\t')
73 atom_template
= atom_template
.replace('@ENTRIES@', entries_str
)
75 with io
.open('update/releases.atom', 'w', encoding
='utf-8') as atom_file
:
76 atom_file
.write(atom_template
)