1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-11-20 01:52:32 +01:00
This commit is contained in:
GilbN 2022-07-10 16:55:04 +00:00
parent 4cfc54f5ab
commit 977cdaf917
3 changed files with 57 additions and 5 deletions

17
fetch.sh Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Downloads all docker mod scripts
MODS=$(curl https://develop.theme-park.dev/themes.json | jq -r '.["docker-mods"]')
if [[ "$0" == "bash" ]]; then
DIR="/tmp/theme-park-mods"
else
DIR="$0"
fi
mkdir -p "$DIR"
printf "\nSaving mods into $DIR\n\n"
jq -r 'to_entries | map(.key + "|" + (.value | tostring)) | .[]' <<< "$MODS" | \
while IFS='|' read key value; do
curl "$value" --create-dirs --output "$DIR/$key" --silent
echo "Fetched $key script"
done
sudo chmod go+rx $DIR

View File

@ -544,6 +544,35 @@
"base_css": "https://theme-park.dev/css/base/webtools/webtools-base.css?sha=b7eaa31bf1cd7215460b844e7985f3bf8c55689f"
}
},
"docker-mods": {
"bazarr": "https://theme-park.dev/docker-mods/bazarr/root/etc/cont-init.d/98-themepark",
"calibre-web": "https://theme-park.dev/docker-mods/calibre-web/root/etc/cont-init.d/98-themepark",
"deluge": "https://theme-park.dev/docker-mods/deluge/root/etc/cont-init.d/98-themepark",
"duplicati": "https://theme-park.dev/docker-mods/duplicati/root/etc/cont-init.d/98-themepark",
"emby": "https://theme-park.dev/docker-mods/emby/root/etc/cont-init.d/98-themepark",
"jackett": "https://theme-park.dev/docker-mods/jackett/root/etc/cont-init.d/98-themepark",
"jellyfin": "https://theme-park.dev/docker-mods/jellyfin/root/etc/cont-init.d/98-themepark",
"lazylibrarian": "https://theme-park.dev/docker-mods/lazylibrarian/root/etc/cont-init.d/98-themepark",
"librespeed": "https://theme-park.dev/docker-mods/librespeed/root/etc/cont-init.d/98-themepark",
"lidarr": "https://theme-park.dev/docker-mods/lidarr/root/etc/cont-init.d/98-themepark",
"mylar3": "https://theme-park.dev/docker-mods/mylar3/root/etc/cont-init.d/98-themepark",
"nzbget": "https://theme-park.dev/docker-mods/nzbget/root/etc/cont-init.d/98-themepark",
"plex": "https://theme-park.dev/docker-mods/plex/root/etc/cont-init.d/98-themepark",
"prowlarr": "https://theme-park.dev/docker-mods/prowlarr/root/etc/cont-init.d/98-themepark",
"qbittorrent": "https://theme-park.dev/docker-mods/qbittorrent/root/etc/cont-init.d/98-themepark",
"radarr": "https://theme-park.dev/docker-mods/radarr/root/etc/cont-init.d/98-themepark",
"readarr": "https://theme-park.dev/docker-mods/readarr/root/etc/cont-init.d/98-themepark",
"rutorrent": "https://theme-park.dev/docker-mods/rutorrent/root/etc/cont-init.d/98-themepark",
"sabnzbd": "https://theme-park.dev/docker-mods/sabnzbd/root/etc/cont-init.d/98-themepark",
"sonarr": "https://theme-park.dev/docker-mods/sonarr/root/etc/cont-init.d/98-themepark",
"swag": "https://theme-park.dev/docker-mods/swag/root/etc/cont-init.d/98-themepark",
"synclounge": "https://theme-park.dev/docker-mods/synclounge/root/etc/cont-init.d/98-themepark",
"tautulli": "https://theme-park.dev/docker-mods/tautulli/root/etc/cont-init.d/98-themepark",
"thelounge": "https://theme-park.dev/docker-mods/thelounge/root/etc/cont-init.d/98-themepark",
"transmission": "https://theme-park.dev/docker-mods/transmission/root/etc/cont-init.d/98-themepark",
"vuetorrent": "https://theme-park.dev/docker-mods/vuetorrent/root/etc/cont-init.d/98-themepark",
"whisparr": "https://theme-park.dev/docker-mods/whisparr/root/etc/cont-init.d/98-themepark"
},
"themes": {
"Aquamarine": {
"url": "https://theme-park.dev/css/theme-options/aquamarine.css?sha=7f02500167b598d1a64c86198ed3c9af9dec5466"

View File

@ -61,7 +61,7 @@ def create_addons_json():
return dumps(ADDONS, sort_keys=True)
def create_json(app_folders: list = None, themes: list = None, community_themes: list = None, no_sub_folders=False):
def create_json(app_folders: list = None, themes: list = None, community_themes: list = None ,docker_mods: list = None, no_sub_folders=False) -> str:
if no_sub_folders:
THEMES_DICT = {}
theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/theme-options/*.css"]) if isdir(".git") else []
@ -71,12 +71,12 @@ def create_json(app_folders: list = None, themes: list = None, community_themes:
THEMES = {
theme.split(".")[0].capitalize(): {
"url": f"{scheme}://{DOMAIN}/css/theme-options/{theme}?sha={THEME_SHAS.get(theme)}"
}for theme in themes
}for theme in themes if themes
}
COMMUNITY_THEMES = {
theme.split(".")[0].capitalize(): {
"url": f"{scheme}://{DOMAIN}/css/community-theme-options/{theme}?sha={COMMUNITY_THEME_SHAS.get(theme)}"
}for theme in community_themes
}for theme in community_themes if community_themes
}
THEMES_DICT.update(dict(sorted({
"themes": {
@ -111,12 +111,17 @@ def create_json(app_folders: list = None, themes: list = None, community_themes:
} for app in app_folders if isfile(f'./css/base/{app}/.deprecated')
}
}.items())))
APPS.update(dict(sorted({
"docker-mods": {
mod: f"{scheme}://{DOMAIN}/docker-mods/{mod}/root/etc/cont-init.d/98-themepark" for mod in docker_mods if docker_mods
}
}.items())))
THEMES = loads(create_json(themes=themes, community_themes=community_themes, no_sub_folders=True))
APPS.update(ADDONS)
APPS.update(THEMES)
return dumps(APPS)
def create_theme_options():
def create_theme_options() -> None:
app_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/base/*base.css"]) if isdir(".git") else []
theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/theme-options/*.css"]) if isdir(".git") else []
community_theme_shas = subprocess.check_output(["git", "ls-files", "-s", "./css/community-theme-options/*.css"]) if isdir(".git") else []
@ -145,6 +150,7 @@ scheme = env.get('TP_SCHEME','https') if env.get('TP_SCHEME') else 'https'
if __name__ == "__main__":
app_folders = [name for name in listdir('./css/base') if isdir(join('./css/base', name))]
themes = [name for name in listdir('./css/theme-options') if isfile(join('./css/theme-options', name))]
docker_mods = [name for name in listdir('./docker-mods') if isdir(join('./docker-mods', name))]
community_themes = [name for name in listdir('./css/community-theme-options') if isfile(join('./css/community-theme-options', name))]
develop = True if isdir(".git") and subprocess.check_output(["git", "symbolic-ref", "--short", "HEAD"]).decode('ascii').strip() == "develop" else False
if env_domain:
@ -153,7 +159,7 @@ if __name__ == "__main__":
with open("CNAME", "rt", closefd=True) as cname:
CNAME = cname.readline()
DOMAIN = CNAME if not develop else f"develop.{CNAME}"
apps = loads(create_json(app_folders=app_folders, themes=themes, community_themes=community_themes))
apps = loads(create_json(app_folders=app_folders, themes=themes, community_themes=community_themes, docker_mods=docker_mods))
with open("themes.json", "w") as outfile:
dump(apps, outfile, indent=2, sort_keys=True)
create_theme_options()