reshuffled license (now CC0 in license text), moved tocs to subfolder and added tocs for platform

This commit is contained in:
Trilarion
2019-09-09 12:41:32 +02:00
parent 1581152bc3
commit d779cefbb0
56 changed files with 3191 additions and 2459 deletions

View File

@ -385,7 +385,6 @@
"https://github.com/fabianschuiki/OpenSkyscraper.git",
"https://github.com/fabiensanglard/chocolate_duke3D.git",
"https://github.com/fariazz/World-of-Heroes.git",
"https://github.com/farmboy0/slashem.git",
"https://github.com/fasterthanlime/isaac-paper.git",
"https://github.com/fastrgv/AdaVenture.git",
"https://github.com/fofix/fofix.git",
@ -542,6 +541,7 @@
"https://github.com/osgamearchive/gltron.git",
"https://github.com/osgamearchive/mpango.git",
"https://github.com/osgamearchive/scorched3d.git",
"https://github.com/osgamearchive/slashem.git",
"https://github.com/osgamearchive/spacetraderjava.git",
"https://github.com/ospaceteam/outerspace.git",
"https://github.com/ozkriff/zoc.git",
@ -683,6 +683,7 @@
"https://github.com/xesf/twin-e.git",
"https://github.com/xoreos/xoreos.git",
"https://github.com/xythobuz/OpenRaider.git",
"https://github.com/yairm210/UnCiv.git",
"https://github.com/yeKcim/warmux.git",
"https://github.com/yquake2/yquake2.git",
"https://github.com/yvt/openspades.git",

View File

@ -94,6 +94,7 @@ https://github.com/apsillers/Taggem
https://github.com/arianne/stendhal
https://github.com/ArmageddonGames/ZeldaClassic
https://github.com/assaultcube (https://sourceforge.net/projects/actiongame/)
https://github.com/bitcraft/pyscroll
https://github.com/bitcraft/PyTMX
https://github.com/BobbyBao/SharpGame
https://github.com/ByoxCode/DrawView
@ -180,6 +181,7 @@ https://github.com/TalonBraveInfo/OpenHoW
https://github.com/team-eternity/eternity
https://github.com/the-insulines
https://github.com/theaigames
https://github.com/Tinob/Ishiiruka (https://github.com/shiiion/Ishiiruka, https://github.com/SirMangler/PrimeHack-Updater)
https://github.com/tonihele/OpenKeeper
https://github.com/tpcstld/2048
https://github.com/unknown-horizons/godot-port
@ -189,7 +191,6 @@ https://github.com/Vocaluxe/Vocaluxe
https://github.com/Wargus/stratagus
https://github.com/wesnoth/haldric
https://github.com/xyzz/openmw-android
https://github.com/yairm210/UnCiv
https://github.com/yiotro/Antiyoy
https://gitlab.com/LibreGames
https://gitlab.com/vgstation/vgstation-old (and vgstation in general)

View File

@ -28,17 +28,15 @@ def update_readme_and_tocs(infos):
"""
print('update readme and toc files')
# delete all toc files
entries = os.listdir(games_path)
entries = (x for x in entries if x.startswith('_'))
for entry in entries:
os.remove(os.path.join(games_path, entry))
# delete content of toc path
for file in os.listdir(tocs_path):
os.remove(os.path.join(tocs_path, file))
# read readme
readme_file = os.path.join(root_path, 'README.md')
readme_text = read_text(readme_file)
# compile regex for identifying the building blocks
# compile regex for identifying the building blocks in the readme
regex = re.compile(r"(.*?)(\[comment\]: # \(start.*?end of autogenerated content\))(.*)", re.DOTALL)
# apply regex
@ -49,27 +47,37 @@ def update_readme_and_tocs(infos):
start = matches[0]
end = matches[2]
# create all toc and readme entry
# create all toc
title = 'All'
file = '_all.md'
update_prefix = '**[{}](games/{}#{})** ({})'.format(title, file, title, len(infos))
tocs_text = '**[{}](games/tocs/{}#{})** ({})\n'.format(title, file, title, len(infos))
create_toc(title, file, infos)
update = []
# create by category
categories_text = []
for keyword in recommended_keywords:
infos_filtered = [x for x in infos if keyword in x['keywords']]
title = keyword.capitalize()
name = keyword.replace(' ', '-')
file = '_{}.md'.format(name)
update.append('**[{}](games/{}#{})** ({})'.format(title, file, name, len(infos_filtered)))
categories_text.append('**[{}](games/tocs/{}#{})** ({})'.format(title, file, name, len(infos_filtered)))
create_toc(title, file, infos_filtered)
update.sort()
update.insert(0, update_prefix)
update = ', '.join(update)
update += '\n'
categories_text.sort()
tocs_text += '\nBy category: {}\n'.format(', '.join(categories_text))
# create by platform
platforms_text = []
for platform in valid_platforms:
infos_filtered = [x for x in infos if platform in x.get('platform', [])]
title = platform
name = platform.lower()
file = '_{}.md'.format(name)
platforms_text.append('**[{}](games/tocs/{}#{})** ({})'.format(title, file, name, len(infos_filtered)))
create_toc(title, file, infos_filtered)
tocs_text += '\nBy platform: {}\n'.format(', '.join(platforms_text))
# insert new text in the middle (the \n before the second comment is necessary, otherwise Markdown displays it as part of the bullet list)
text = start + "[comment]: # (start of autogenerated content, do not edit)\n" + update + "\n[comment]: # (end of autogenerated content)" + end
text = start + "[comment]: # (start of autogenerated content, do not edit)\n" + tocs_text + "\n[comment]: # (end of autogenerated content)" + end
# write to readme
write_text(readme_file, text)
@ -80,7 +88,7 @@ def create_toc(title, file, entries):
"""
# file path
toc_file = os.path.join(games_path, file)
toc_file = os.path.join(tocs_path, file)
# header line
text = '[comment]: # (autogenerated content, do not edit)\n# {}\n\n'.format(title)
@ -88,7 +96,7 @@ def create_toc(title, file, entries):
# assemble rows
rows = []
for entry in entries:
rows.append('- **[{}]({})** ({})'.format(entry['name'], entry['file'], ', '.join(entry['code language'] + entry['code license'] + entry['state'])))
rows.append('- **[{}]({})** ({})'.format(entry['name'], '../' + entry['file'], ', '.join(entry['code language'] + entry['code license'] + entry['state'])))
# sort rows (by title)
rows.sort(key=str.casefold)
@ -779,6 +787,7 @@ if __name__ == "__main__":
# paths
root_path = os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.pardir))
games_path = os.path.join(root_path, 'games')
tocs_path = os.path.join(games_path, 'tocs')
# backlog
game_urls = extract_links(games_path)

View File

@ -26,12 +26,15 @@ def entry_iterator(games_path):
# get all entries (ignore everything starting with underscore)
entries = os.listdir(games_path)
entries = (x for x in entries if not x.startswith('_'))
# iterate over all entries
for entry in entries:
entry_path = os.path.join(games_path, entry)
# ignore directories ("tocs" for example)
if os.path.isdir(entry_path):
continue
# read entry
content = read_text(entry_path)