diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 9efbdef..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/main.py b/main.py index 9362938..a015ee8 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,45 @@ import sys import galdPl +import requests +from bs4 import BeautifulSoup +import os + +def get_json_files_from_folder(folder): + base_url = "https://git.gald.site/gald/galdistream/src/branch/main/resources/" + url = base_url + folder + r = requests.get(url, timeout=10) + r.raise_for_status() + soup = BeautifulSoup(r.text, "html.parser") + files = [] + for a in soup.find_all("a", class_="ui basic label"): + href = a.get("href", "") + if href.endswith(".json"): + file_path = href.split("/resources/")[-1] + files.append(file_path) + return files + +def update_json_db(): + base_url_raw = "https://git.gald.site/gald/galdistream/raw/branch/main/resources/" + folders = ["movies", "series"] + all_files = [] + for folder in folders: + try: + all_files += [f"{folder}/{file}" for file in get_json_files_from_folder(folder)] + except Exception as e: + print(f"Chyba při získávání souborů ze složky {folder}: {e}") + for file in all_files: + url = base_url_raw + file + local_path = "resources/" + file + try: + r = requests.get(url, timeout=10) + r.raise_for_status() + os.makedirs(os.path.dirname(local_path), exist_ok=True) + with open(local_path, "wb") as f: + f.write(r.content) + except Exception as e: + print(f"Chyba při stahování {file}: {e}") if __name__ == '__main__': + update_json_db() galdPl.router(sys.argv[2][1:]) diff --git a/resources/.DS_Store b/resources/.DS_Store deleted file mode 100644 index d16b74e..0000000 Binary files a/resources/.DS_Store and /dev/null differ diff --git a/resources/series/game-of-thrones.json b/resources/series/game-of-thrones.json index 0e13974..eaa2622 100644 --- a/resources/series/game-of-thrones.json +++ b/resources/series/game-of-thrones.json @@ -2,6 +2,21 @@ "title": "Hra o trůny (Game of Thrones)", "icon": "DefaultTVShows.png", "seasons": [ + { + "season": 1, + "episodes": [ + { "title": "S01E01 - Zima se blíží", "search": "hra o truny s01e01" }, + { "title": "S01E02 - Králova cesta", "search": "hra o truny s01e02" }, + { "title": "S01E03 - Lord Snow", "search": "hra o truny s01e03" }, + { "title": "S01E04 - Mrzák, bastardi a zlá zmrzačená věc", "search": "hra o truny s01e04" }, + { "title": "S01E05 - Vlk a lev", "search": "hra o truny s01e05" }, + { "title": "S01E06 - Zlatá koruna", "search": "hra o truny s01e06" }, + { "title": "S01E07 - Vyhraj, nebo zemři", "search": "hra o truny s01e07" }, + { "title": "S01E08 - Zostuzení", "search": "hra o truny s01e08" }, + { "title": "S01E09 - Baelor", "search": "hra o truny s01e09" }, + { "title": "S01E10 - Oheň a krev", "search": "hra o truny s01e10" } + ] + }, { "season": 2, "episodes": [