mirror of
https://github.com/mustbeperfect/definitive-opensource.git
synced 2026-04-17 23:53:26 +02:00
Moved data directory back to core/
This commit is contained in:
@@ -41,13 +41,13 @@ def format_stars(n):
|
||||
|
||||
def generate_contents(platform="all"):
|
||||
|
||||
with open("../../data/static/categories.json", "r", encoding="utf-8") as f:
|
||||
with open("core/data/static/categories.json", "r", encoding="utf-8") as f:
|
||||
cat_data = json.load(f)
|
||||
with open("../../data/dynamic/applications.json", "r", encoding="utf-8") as f:
|
||||
with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as f:
|
||||
app_data = json.load(f)
|
||||
with open("../../data/static/tags.json", "r", encoding="utf-8") as f:
|
||||
with open("core/data/static/tags.json", "r", encoding="utf-8") as f:
|
||||
tags_data = json.load(f)
|
||||
with open("../../data/static/platforms.json", "r", encoding="utf-8") as f:
|
||||
with open("core/data/static/platforms.json", "r", encoding="utf-8") as f:
|
||||
platforms_data = json.load(f)
|
||||
|
||||
categories = cat_data.get("categories", [])
|
||||
|
||||
@@ -2,7 +2,7 @@ import json
|
||||
|
||||
# Generates mainheader with dynamic project count
|
||||
def generate_mainheader():
|
||||
with open("../../data/dynamic/applications.json", "r", encoding="utf-8") as f:
|
||||
with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
project_count = len(data.get("applications", []))
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import json
|
||||
|
||||
with open("../../data/dynamic/applications.json") as f:
|
||||
with open("core/data/dynamic/applications.json") as f:
|
||||
applications = json.load(f)["applications"]
|
||||
|
||||
with open("../../data/static/categories.json") as f:
|
||||
with open("core/data/static/categories.json") as f:
|
||||
categories_data = json.load(f)["subcategories"]
|
||||
valid_categories = {c["id"].lower() for c in categories_data}
|
||||
|
||||
with open("../../data/static/platforms.json") as f:
|
||||
with open("core/data/static/platforms.json") as f:
|
||||
platforms_data = json.load(f)["platforms"]
|
||||
valid_platforms = {p["id"].lower() for p in platforms_data}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import json
|
||||
from datetime import datetime
|
||||
import os
|
||||
|
||||
with open('../../data/dynamic/applications.json', 'r') as f:
|
||||
with open('core/data/dynamic/applications.json', 'r') as f:
|
||||
data = json.load(f)
|
||||
|
||||
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
|
||||
@@ -57,7 +57,7 @@ def update_application_data(app):
|
||||
for app in data['applications']:
|
||||
app = update_application_data(app)
|
||||
|
||||
with open('../../data/dynamic/applications.json', 'w') as f:
|
||||
with open('core/data/dynamic/applications.json', 'w') as f:
|
||||
json.dump(data, f, indent=4)
|
||||
|
||||
print("Updated application data successfully!")
|
||||
|
||||
@@ -4,7 +4,7 @@ import json
|
||||
from datetime import datetime, timedelta
|
||||
import os
|
||||
|
||||
INPUT_FILE = "../../data/dynamic/applications.json"
|
||||
INPUT_FILE = "core/data/dynamic/applications.json"
|
||||
OUTPUT_FILE = "resources/maintenance/status_maintenance.md"
|
||||
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN")
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ def main() -> None:
|
||||
parser.add_argument(
|
||||
"--applications-file",
|
||||
default=str(APPLICATIONS_FILE),
|
||||
help="Path to applications.json (default: ../../data/dynamic/applications.json).",
|
||||
help="Path to applications.json (default: core/data/dynamic/applications.json).",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--full-details",
|
||||
|
||||
@@ -3,7 +3,7 @@ import json
|
||||
"""
|
||||
|
||||
# Load the JSON data from file
|
||||
with open("../../data/dynamic/applications.json", "r", encoding="utf-8") as file:
|
||||
with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as file:
|
||||
data = json.load(file)
|
||||
|
||||
# Convert all platform entries to lowercase
|
||||
@@ -12,7 +12,7 @@ for app in data.get("applications", []):
|
||||
app["platforms"] = [platform.lower() for platform in app["platforms"]]
|
||||
|
||||
# Write the modified data back to the file
|
||||
with open("../../data/dynamic/applications.json", "w", encoding="utf-8") as file:
|
||||
with open("core/data/dynamic/applications.json", "w", encoding="utf-8") as file:
|
||||
json.dump(data, file, indent=4)
|
||||
|
||||
print("All platform entries have been converted to lowercase.")
|
||||
@@ -20,7 +20,7 @@ print("All platform entries have been converted to lowercase.")
|
||||
|
||||
"""
|
||||
# Load the JSON file
|
||||
with open("../../data/dynamic/applications.json", "r", encoding="utf-8") as file:
|
||||
with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as file:
|
||||
data = json.load(file)
|
||||
|
||||
# Add "flags" and "stars" properties to each application
|
||||
@@ -28,14 +28,14 @@ for app in data.get("applications", []):
|
||||
app["homepage_url"] = ""
|
||||
|
||||
# Save the updated JSON back to the file
|
||||
with open("../../data/dynamic/applications.json", "w", encoding="utf-8") as file:
|
||||
with open("core/data/dynamic/applications.json", "w", encoding="utf-8") as file:
|
||||
json.dump(data, file, indent=4, ensure_ascii=False)
|
||||
|
||||
print("Operation successful: applications.json updated")
|
||||
"""
|
||||
|
||||
# Load applications.json
|
||||
with open("../../data/dynamic/applications.json", "r", encoding="utf-8") as f:
|
||||
with open("core/data/dynamic/applications.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
# Platforms to check for
|
||||
@@ -58,5 +58,5 @@ for app in data.get("applications", []):
|
||||
app["tags"] = sorted(tags)
|
||||
|
||||
# Save the updated file
|
||||
with open("../../data/dynamic/applications.json", "w", encoding="utf-8") as f:
|
||||
with open("core/data/dynamic/applications.json", "w", encoding="utf-8") as f:
|
||||
json.dump(data, f, indent=4)
|
||||
|
||||
Reference in New Issue
Block a user