chore: more dev QoL, exclude dolphin dev from json. fix: scummvm
This commit is contained in:
@@ -2,11 +2,10 @@ import sys
|
||||
import os
|
||||
|
||||
|
||||
def stitch_markdown_files(init_file, table_file, faq_file, output_file="README.md"):
|
||||
files = [init_file, table_file, faq_file]
|
||||
def stitch_markdown_files(markdown_files, output_file="README.md"):
|
||||
combined_content = []
|
||||
|
||||
for file in files:
|
||||
for file in markdown_files:
|
||||
if not os.path.exists(file):
|
||||
print(f"❌ File not found: {file}")
|
||||
sys.exit(1)
|
||||
@@ -18,12 +17,13 @@ def stitch_markdown_files(init_file, table_file, faq_file, output_file="README.m
|
||||
with open(output_file, "w", encoding="utf-8") as f:
|
||||
f.write("\n\n".join(combined_content) + "\n")
|
||||
|
||||
print(f"✅ README.md successfully created with {len(files)} sections.")
|
||||
print(f"✅ {output_file} successfully created with {len(markdown_files)} sections.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 4:
|
||||
print("Usage: python stitch_markdown.py init.md table.md faq.md")
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python stitch_markdown.py file1.md file2.md ... [fileN.md]")
|
||||
sys.exit(1)
|
||||
|
||||
stitch_markdown_files(sys.argv[1], sys.argv[2], sys.argv[3])
|
||||
input_files = sys.argv[1:]
|
||||
stitch_markdown_files(input_files)
|
||||
|
||||
@@ -24,6 +24,10 @@ def generate_markdown_table(apps):
|
||||
rows.append(divider)
|
||||
|
||||
for app in apps:
|
||||
meta = app.get("meta", {})
|
||||
if meta.get("excludeFromTable", False):
|
||||
continue
|
||||
|
||||
name = app.get("name", "")
|
||||
category = ", ".join(app.get("categories", []))
|
||||
obtainium_link = make_obtainium_link(app)
|
||||
|
||||
@@ -1,23 +1,35 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
def minify_json(input_file, output_file):
|
||||
try:
|
||||
# Read JSON data from input file
|
||||
with open(input_file, 'r', encoding='utf-8') as f:
|
||||
with open(input_file, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
# Minify JSON and write to output file
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, separators=(',', ':'), ensure_ascii=False)
|
||||
# Filter out apps with meta.exclude_from_json = true
|
||||
if "apps" in data:
|
||||
filtered_apps = []
|
||||
for app in data["apps"]:
|
||||
meta = app.get("meta", {})
|
||||
if not meta.get("excludeFromExport", False):
|
||||
filtered_apps.append(app)
|
||||
data["apps"] = filtered_apps
|
||||
|
||||
print(f"Minified JSON saved to {output_file}")
|
||||
# Minify JSON and write to output file
|
||||
with open(output_file, "w", encoding="utf-8") as f:
|
||||
json.dump(data, f, separators=(",", ":"), ensure_ascii=False)
|
||||
|
||||
print(
|
||||
f"Minified JSON saved to {output_file} ({len(data.get('apps', []))} apps included)"
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: python minify_json.py input.json output.json")
|
||||
else:
|
||||
minify_json(sys.argv[1], sys.argv[2])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user