-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* improve configuration handling * change config variable names to snake case * populate tag ui with github api * tag box and asset box update each other * only call api once * fix some combo box formatting * clean up combobox callbacks * working cancel button with quick mode * get download url by tag and name * working somewhat * all modes working
- Loading branch information
Alex R
authored
Apr 13, 2021
1 parent
77f209d
commit 677c37a
Showing
5 changed files
with
331 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import requests | ||
import json | ||
|
||
url = "https://api.github.com/repos/JF002/InfiniTime/releases" | ||
version_blacklist = ( | ||
"0.6.0", | ||
"0.6.1", | ||
"0.6.2", | ||
"0.7.0", | ||
"0.7.1", | ||
"0.8.0-develop", | ||
"0.8.1-develop", | ||
"0.8.2-develop", | ||
"0.9.0-develop", | ||
"0.9.0", | ||
"0.8.3", | ||
"0.8.2" | ||
) | ||
|
||
|
||
def get_quick_deploy_list(): | ||
r = requests.get(url) | ||
d = json.loads(r.content) | ||
quick_deploy_list = [] | ||
for item in d: | ||
for asset in item["assets"]: | ||
if ( | ||
asset["content_type"] == "application/zip" | ||
and item["tag_name"] not in version_blacklist | ||
): | ||
helper_dict = { | ||
"tag_name": item["tag_name"], | ||
"name": asset["name"], | ||
"browser_download_url": asset["browser_download_url"], | ||
} | ||
quick_deploy_list.append(helper_dict) | ||
return quick_deploy_list | ||
|
||
|
||
def get_tags(full_list): | ||
tags = set() | ||
for element in full_list: | ||
tags.add(element["tag_name"]) | ||
return sorted(tags, reverse=True) | ||
|
||
def get_assets_by_tag(tag, full_list): | ||
asset_list = [] | ||
for element in full_list: | ||
if tag == element["tag_name"]: | ||
asset_list.append(element["name"]) | ||
return asset_list | ||
|
||
def get_download_url(name, tag, full_list): | ||
for element in full_list: | ||
if tag == element["tag_name"] and name == element["name"]: | ||
return element["browser_download_url"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.