mirror of
https://github.com/JonasunderscoreJones/turbo-octo-potato.git
synced 2025-10-26 02:29:18 +01:00
Added down/upload functinality
This commit is contained in:
parent
bcb1c14a73
commit
be246aaf71
1 changed files with 12 additions and 1 deletions
|
|
@ -85,7 +85,14 @@ def get_languagages(repo, access_token):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Path to the projects.json file
|
# Path to the projects.json file
|
||||||
projects_json_path = os.path.expanduser("~/GitHub/jonasjones.dev/src/routes/projects/projects.json")
|
projects_json_path = os.path.expanduser("~/.cache/gh-projects/projects.json")
|
||||||
|
# create the directory if it doesn't exist
|
||||||
|
os.makedirs(os.path.dirname(projects_json_path), exist_ok=True)
|
||||||
|
# fetch the projects.json file from https://cdn.jonasjones.dev/api/projects/projects.json
|
||||||
|
projects_json_url = "https://cdn.jonasjones.dev/api/projects/projects.json"
|
||||||
|
projects_json = requests.get(projects_json_url)
|
||||||
|
with open(projects_json_path, "wb") as file:
|
||||||
|
file.write(projects_json.content)
|
||||||
|
|
||||||
# Load the existing projects.json file
|
# Load the existing projects.json file
|
||||||
with open(projects_json_path, "r") as file:
|
with open(projects_json_path, "r") as file:
|
||||||
|
|
@ -113,3 +120,7 @@ with open(projects_json_path, "w") as file:
|
||||||
json.dump(projects_data, file, indent=2)
|
json.dump(projects_data, file, indent=2)
|
||||||
|
|
||||||
print("Updated projects.json")
|
print("Updated projects.json")
|
||||||
|
|
||||||
|
os.system(f"rclone copy {projects_json_path} cdn:cdn/api/projects/")
|
||||||
|
|
||||||
|
print("Uploaded projects.json to cdn")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue