]>
git.ipfire.org Git - ipfire.org.git/blob - www/webapp/datastore/releases.py
5 from tornado
.database
import Row
7 class ReleaseItem(Row
):
11 "desc" : "Installable CD image",
12 "url" : "http://download.ipfire.org/iso/",
13 "rem" : "Use this image to burn a CD and install IPFire from it.",
17 "desc" : "Torrent file",
18 "url" : "http://download.ipfire.org/torrent/",
19 "rem" : "Download the CD image from the torrent network.",
23 "desc" : "Flash image",
24 "url" : "http://download.ipfire.org/iso/",
25 "rem" : "An image that is meant to run on embedded devices.",
29 "desc" : "Alix image",
30 "url" : "http://download.ipfire.org/iso/",
31 "rem" : "Flash image where a serial console is enabled by default.",
35 "desc" : "USB FDD image",
36 "url" : "http://download.ipfire.org/iso/",
37 "rem" : "Install IPFire from a floppy-formated USB key.",
41 "desc" : "USB HDD image",
42 "url" : "http://download.ipfire.org/iso/",
43 "rem" : "If the floppy image doesn't work, use this image instead.",
47 "desc" : "Pregenerated Xen image",
48 "url" : "http://download.ipfire.org/iso/",
49 "rem" : "A ready-to-run image for Xen.",
53 def __init__(self
, info
):
56 def __getattr__(self
, key
):
62 for fileitem
in self
.info
["files"]:
63 filetype
= fileitem
["type"]
65 desc
= self
.options
[filetype
]["desc"],
66 file = fileitem
["name"],
67 hash = fileitem
.get("hash", None),
68 prio
= self
.options
[filetype
]["prio"],
69 rem
= self
.options
[filetype
]["rem"],
70 sha1
= fileitem
.get("sha1", None),
72 url
= self
.options
[filetype
]["url"] + fileitem
["name"],
75 ret
.sort(lambda a
, b
: cmp(a
.prio
, b
.prio
))
80 for download
in self
.downloads
:
81 if download
.type == "iso":
86 for download
in self
.downloads
:
87 if download
.type == "torrent":
92 return self
.status
== "stable"
95 def development(self
):
96 return self
.status
== "development"
99 class Releases(object):
100 def __init__(self
, application
, filename
="releases.json"):
101 self
.application
= application
107 def load(self
, filename
):
108 with
open(filename
) as f
:
109 self
.items
= [ReleaseItem(i
) for i
in simplejson
.load(f
)]
118 for item
in self
.all
:
126 for item
in self
.all
:
134 return self
.stable
[0]
137 def latest_devel(self
):
139 return self
.development
[0]
144 for item
in self
.online
:
150 def development(self
):
152 for item
in self
.online
:
160 for item
in self
.online
: