mirror of
https://github.com/open-goal/jak-project
synced 2026-07-07 22:22:21 -04:00
docs: Refresh the homepage and add some basic gallery support (#1051)
* docs: refresh the homepage * docs: basic gallery support added * homepage background image back to jpg * docs: remove data file tracker, as it's soon to be removed
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import glob
|
||||
|
||||
src_files = glob.glob("./goal_src/**/*.g[cs]", recursive=True)
|
||||
|
||||
# Find how many of each have been started
|
||||
|
||||
src_files_started = 0
|
||||
src_files_finished = 0
|
||||
data_files_started = 0
|
||||
|
||||
for f in src_files:
|
||||
with open(f, "r") as temp_file:
|
||||
lines = temp_file.readlines()
|
||||
line_count = len(lines)
|
||||
if line_count > 7:
|
||||
# Check to see if there are any TODOs
|
||||
if any("TODO" in string for string in lines):
|
||||
src_files_finished = src_files_finished + 1
|
||||
else:
|
||||
src_files_started = src_files_started + 1
|
||||
|
||||
import json
|
||||
with open('./docs/gh-pages-proj/src/config/progress.json', 'r+', encoding='utf-8') as f:
|
||||
data = {
|
||||
'jak1': {
|
||||
'fileProgress': {
|
||||
'src_files_total': len(src_files),
|
||||
'src_files_finished': src_files_finished,
|
||||
'src_files_started': src_files_started
|
||||
}
|
||||
}
|
||||
}
|
||||
f.seek(0)
|
||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
||||
f.truncate()
|
||||
@@ -0,0 +1,34 @@
|
||||
import glob
|
||||
import os
|
||||
from pathlib import Path
|
||||
import datetime
|
||||
|
||||
galleryLinks = {
|
||||
'jak1': [],
|
||||
'jak2': [],
|
||||
'jak3': [],
|
||||
'jakx': [],
|
||||
'misc': []
|
||||
}
|
||||
|
||||
def get_links(key, folder_to_search):
|
||||
if os.path.isdir(folder_to_search):
|
||||
files = [f for f in glob.glob(folder_to_search + "/*.*", recursive=True)]
|
||||
for f in files:
|
||||
galleryLinks[key].append({
|
||||
'fileName': os.path.basename(f),
|
||||
'lastModified': datetime.datetime.fromtimestamp(os.path.getmtime(f)).isoformat(),
|
||||
'caption': Path(f).stem.replace("-", " ").title()
|
||||
})
|
||||
|
||||
get_links('jak1', './docs/gh-pages-proj/src/assets/gallery/jak1')
|
||||
get_links('jak2', './docs/gh-pages-proj/src/assets/gallery/jak2')
|
||||
get_links('jak3', './docs/gh-pages-proj/src/assets/gallery/jak3')
|
||||
get_links('jakx', './docs/gh-pages-proj/src/assets/gallery/jakx')
|
||||
get_links('misc', './docs/gh-pages-proj/src/assets/gallery/misc')
|
||||
|
||||
import json
|
||||
with open('./docs/gh-pages-proj/src/config/gallery.json', 'r+', encoding='utf-8') as f:
|
||||
f.seek(0)
|
||||
json.dump(galleryLinks, f, ensure_ascii=False, indent=2)
|
||||
f.truncate()
|
||||
Reference in New Issue
Block a user