Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/magnet2feed.py
blob: dc953c838c89d273b3640c0efc3625785e92e873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3

from feedgenerator import Rss201rev2Feed
import sys
from os.path import basename

def main(link, arch, date, feed_url):
    feed = Rss201rev2Feed(title='ArchLinux32 torrent download feed ({arch} ISO)'.format(arch=arch),
                          link=feed_url,
                          description="A torrent feed to download the latest ArchLinux32 {arch} iso".format(
                              arch=arch
                          ),
                          language='en')

    feed.add_item(title='ArchLinux32 {arch} {date}'.format(arch=arch, date=date),
                  link=link,
                  description='ArchLinux32 {arch} {date}'.format(arch=arch, date=date))

    with open(basename(feed_url).format(arch=arch), mode='w') as feed_file:
        feed.write(feed_file, 'utf-8')

if __name__ == '__main__':
    if len(sys.argv) != 5:
        print('Error: {cmd} magnet arch date feed_url'.format(cmd=sys.argv[0]))

    main(link=sys.argv[1], arch=sys.argv[2], date=sys.argv[3], feed_url=sys.argv[4])