Skip to content

Commit

Permalink
Fedora
Browse files Browse the repository at this point in the history
  • Loading branch information
xavivars committed Oct 11, 2023
1 parent def6855 commit bbe362b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
38 changes: 38 additions & 0 deletions fedora/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import requests
from cachetools import cached, TTLCache

from utils import download_data, add_program

add_program("fedora", 'fedora', 'fedora')


@cached(cache=TTLCache(maxsize=10, ttl=300))
def get():

d = get_fedora()

version = d['version']

return [
download_data(
f'Fedora {version} - Live ISO',
url=d['link'],
os='linux',
get_size=True
)
]

def get_fedora():
url = 'https://fedoraproject.org/releases.json'

r = requests.get(url)

js = r.json()

stable = False

stable = list(filter(lambda x: 'Beta' not in x['version'], js))
stable = list(filter(lambda x: x['arch'] == 'x86_64' and x['variant']=='Workstation', stable))

if len(stable) > 0:
return stable[0]
11 changes: 11 additions & 0 deletions handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import calibre
import debian
import fedora
import notepadplusplus
import sevenzip
import tor
Expand Down Expand Up @@ -168,6 +169,16 @@ def debian_route():
return "NoData", 404



@app.route("/fedora")
def fedora_route():
r = fedora.get()
if r is not None:
return __jsonify(r)
else:
return "NoData", 404


def __jsonify(r):
r = sorted(r, key=lambda x: x['download_os'], reverse=True)
return jsonify(r)
Expand Down

0 comments on commit bbe362b

Please sign in to comment.