-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add generating downloads from JSON #187
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
{ | ||
"stable": | ||
[ | ||
{ | ||
"name": "Windows", | ||
"qTox": | ||
[ | ||
{ | ||
"name": "32 bit", | ||
"url": "https://build.tox.chat/view/qtox/job/qTox_pkg_windows_x86_stable_release/lastSuccessfulBuild/artifact/setup-qtox.exe", | ||
"sha256": "", | ||
"gpg": "" | ||
}, | ||
|
||
{ | ||
"name": "64 bit", | ||
"url": "https://build.tox.chat/view/qtox/job/qTox_pkg_windows_x86-64_stable_release/lastSuccessfulBuild/artifact/setup-qtox.exe", | ||
"sha256": "", | ||
"gpg": "" | ||
} | ||
], | ||
"uTox": | ||
[ | ||
{ | ||
"name": "32 bit", | ||
"url": "https://downloads.utox.io/stable/uTox_win32.exe", | ||
"sha256": "", | ||
"gpg": "" | ||
}, | ||
|
||
{ | ||
"name": "64 bit", | ||
"url": "https://downloads.utox.io/stable/uTox_win64.exe", | ||
"sha256": "", | ||
"gpg": "" | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
"name": "OS X", | ||
"qTox": | ||
[ | ||
{ | ||
"name": "32 bit", | ||
"url": "https://github.com/qTox/qTox/releases/download/v1.13.0/qTox.dmg", | ||
"sha256": "", | ||
"gpg": "" | ||
} | ||
], | ||
"uTox": | ||
[ | ||
{ | ||
"name": "64 bit (OS X 10.7+)", | ||
"url": "https://github.com/uTox/uTox/releases/download/v0.16.1/uTox-0.16.1.dmg", | ||
"sha256": "", | ||
"gpg": "" | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
"name": "GNU/Linux", | ||
"": | ||
[ | ||
{ | ||
"name": "Debian", | ||
"url": "#gnulinux" | ||
}, | ||
|
||
{ | ||
"name": "Gentoo", | ||
"url": "#gnulinux" | ||
}, | ||
|
||
{ | ||
"name": "Arch", | ||
"url": "#gnulinux" | ||
} | ||
], | ||
"uTox mostly static": | ||
[ | ||
{ | ||
"name": "32 bit", | ||
"url": "https://build.tox.chat/job/uTox_build_linux_x86_release/lastSuccessfulBuild/artifact/utox_linux_x86.tar.xz" | ||
}, | ||
{ | ||
"name": "64 bit", | ||
"url": "https://build.tox.chat/job/uTox_build_linux_x86-64_release/lastSuccessfulBuild/artifact/utox_linux_x86-64.tar.xz" | ||
} | ||
], | ||
"Toxic mostly static": | ||
[ | ||
{ | ||
"name": "32 bit", | ||
"url": "https://build.tox.chat/job/toxic_build_linux_x86_release/lastSuccessfulBuild/artifact/toxic_build_linux_x86_release.tar.xz" | ||
}, | ||
{ | ||
"name": "64 bit", | ||
"url": "https://build.tox.chat/job/toxic_build_linux_x86-64_release/lastSuccessfulBuild/artifact/toxic_build_linux_x86-64_release.tar.xz" | ||
} | ||
], | ||
"Toxic fully static (text chat only)": | ||
[ | ||
{ | ||
"name": "32 bit", | ||
"url": "https://build.tox.chat/job/toxic-no-x11-musl_build_linux_x86_release/lastSuccessfulBuild/artifact/toxic-no-x11-musl_build_linux_x86_release.tar.xz" | ||
}, | ||
{ | ||
"name": "64 bit", | ||
"url": "https://build.tox.chat/job/toxic-no-x11-musl_build_linux_x86-64_release/lastSuccessfulBuild/artifact/toxic-no-x11-musl_build_linux_x86-64_release.tar.xz" | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
"name": "FreeBSD", | ||
"": | ||
[ | ||
{ | ||
"name": "qTox", | ||
"url": "https://www.freshports.org/net-im/qTox" | ||
}, | ||
|
||
|
||
{ | ||
"name": "uTox", | ||
"url": "https://www.freshports.org/net-im/uTox" | ||
}, | ||
|
||
|
||
{ | ||
"name": "Toxic", | ||
"url": "https://www.freshports.org/net-im/toxic" | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
"name": "iOS", | ||
"": | ||
[ | ||
{ | ||
"name": "Antidote (iOS 8+)", | ||
"url": "https://itunes.apple.com/app/antidote-for-tox/id933117605" | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
"name": "Android", | ||
"Antox": | ||
[ | ||
{ | ||
"name": "F-droid", | ||
"url": "#fdroid" | ||
}, | ||
|
||
{ | ||
"name": "Google-Play", | ||
"url": "https://play.google.com/store/apps/details?id=chat.tox.antox" | ||
}, | ||
|
||
{ | ||
"name": "APK", | ||
"url": "https://pkg.tox.chat/fdroid/repo/antox.apk" | ||
} | ||
] | ||
} | ||
], | ||
|
||
"nightly": | ||
[ | ||
{ | ||
"name": "qTox nightly", | ||
"Windows": | ||
[ | ||
{ | ||
"name": "32 bit", | ||
"url": "https://build.tox.chat/view/qtox/job/qTox_build_windows_x86_release/lastSuccessfulBuild/artifact/qTox_build_windows_x86_release.zip", | ||
"sha256": "", | ||
"gpg": "" | ||
}, | ||
|
||
{ | ||
"name": "64 bit", | ||
"url": "https://build.tox.chat/view/qtox/job/qTox_build_windows_x86-64_release/lastSuccessfulBuild/artifact/qTox_build_windows_x86-64_release.zip", | ||
"sha256": "", | ||
"gpg": "" | ||
} | ||
] | ||
} | ||
] | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
|
||
THEME = "themes/website" | ||
|
||
DOWNLOADS_JSON_PATH = "downloads.json" | ||
|
||
# pelican is mainly aimed at blogs and a regular pelican template has only | ||
# a predefined set of files with predefined names which do blog things. | ||
|
@@ -31,6 +32,12 @@ | |
|
||
import fnmatch | ||
import os | ||
import json | ||
|
||
jsonFile = open(DOWNLOADS_JSON_PATH) | ||
DOWNLOADS = json.load(jsonFile) | ||
jsonFile.close() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if the file do not exists? Could we add a try/catch block here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the file doesn't exist it will throw a Python error in the console and stop the site from building:
We could have a try catch with our own messages for different kinds of exceptions, but is there an advantage? |
||
|
||
|
||
TEMPLATES_DIR = THEME + '/templates' | ||
for root, dirnames, filenames in os.walk(TEMPLATES_DIR): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be way more useful as a normalized JSON where each item in an array has id. ie. https://github.com/paularmstrong/normalizr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be more complicated for no benefit. Leaving things like this is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you need ids for? Isn't it better to access elements by name:
downloads["stable"]["Windows"]["qTox"] instead of downloads["stable"]["0"]["0"] ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it wouldn't be downloads["stable"]["0"]["0"], but my point is that it's more difficult to make a mistake with names and ids are more difficult to remember, because they don't mean anything. I don't understand why it would be more useful with ids. Maybe you could give an example?