]>
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     <feed xmlns="http://www.w3.org/2005/Atom"> 
  12         <link rel="self" href="http://rg3.github.io/youtube-dl/update/releases.atom" /> 
  13         <title>youtube-dl releases</title> 
  14         <id>https://yt-dl.org/feed/youtube-dl-updates-feed</id> 
  15         <updated>@TIMESTAMP@</updated> 
  19 entry_template 
= textwrap
.dedent(""" 
  21         <id>https://yt-dl.org/feed/youtube-dl-updates-feed/youtube-dl-@VERSION@</id> 
  22         <title>New version @VERSION@</title> 
  23         <link href="http://rg3.github.io/youtube-dl" /> 
  24         <content type="xhtml"> 
  25             <div xmlns="http://www.w3.org/1999/xhtml"> 
  26                 Downloads available at <a href="https://yt-dl.org/downloads/@VERSION@/">https://yt-dl.org/downloads/@VERSION@/</a> 
  30             <name>The youtube-dl maintainers</name> 
  32         <updated>@TIMESTAMP@</updated> 
  36 now 
= datetime
.datetime
.now() 
  37 now_iso 
= now
.isoformat() + 'Z' 
  39 atom_template 
= atom_template
.replace('@TIMESTAMP@', now_iso
) 
  41 versions_info 
= json
.load(open('update/versions.json')) 
  42 versions 
= list(versions_info
['versions'].keys()) 
  48     year
, month
, day 
= map(int, fields
[:3]) 
  53             datetime
.date(year
, month
, day
) 
  62             patchlevel 
= int(fields
[3]) 
  65     timestamp 
= '%04d-%02d-%02dT00:%02d:%02dZ' % (year
, month
, day
, faked
, patchlevel
) 
  67     entry 
= entry_template
.replace('@TIMESTAMP@', timestamp
) 
  68     entry 
= entry
.replace('@VERSION@', v
) 
  71 entries_str 
= textwrap
.indent(''.join(entries
), '\t') 
  72 atom_template 
= atom_template
.replace('@ENTRIES@', entries_str
) 
  74 with io
.open('update/releases.atom', 'w', encoding
='utf-8') as atom_file
: 
  75     atom_file
.write(atom_template
)