regular replacements of shortcuts

This commit is contained in:
Trilarion 2017-12-11 11:43:23 +01:00
parent 11ac040169
commit a8cc037a09
12 changed files with 81 additions and 20 deletions

View File

@ -4,14 +4,10 @@
This script runs with Python 3, it could also with Python 2 with some minor tweaks probably, but that's not important. This script runs with Python 3, it could also with Python 2 with some minor tweaks probably, but that's not important.
TODO remove "?source=navbar" from the end of links (sourceforge specific)
TODO check for "_{One line description}_" or "- Wikipedia: {URL}" in game files and print warning TODO check for "_{One line description}_" or "- Wikipedia: {URL}" in game files and print warning
TODO print all games without license or code information TODO print all games without license or code information
TODO for those games with github repositories get activity, number of open issues, number of merge requests and display in a health monitor file TODO for those games with github repositories get activity, number of open issues, number of merge requests and display in a health monitor file
TODO get number of games with github or bitbucket repository and list those who have neither TODO get number of games with github or bitbucket repository and list those who have neither
TODO in readme put contents to the top, put all games folder into another folder and this script as well as the template too
TODO change Wikipedia to Media
TODO single player to SP, multi player to MP for keywords
TODO list those with exotic licenses (not GPL, zlib, MIT, BSD) or without licenses TODO list those with exotic licenses (not GPL, zlib, MIT, BSD) or without licenses
TODO Which C, C++ projects do not use CMake TODO Which C, C++ projects do not use CMake
TODO list those inactive (sort by year backwards) TODO list those inactive (sort by year backwards)
@ -220,6 +216,66 @@ def check_validity_external_links():
print("{} links checked".format(number_checked_links)) print("{} links checked".format(number_checked_links))
def fix_notation():
"""
Changes notation, quite special. Only run when needed.
"""
regex = re.compile(r"- Wikipedia:(.*)")
# get category paths
category_paths = get_category_paths()
# for each category
for category_path in category_paths:
# get paths of all entries in this category
entry_paths = get_entry_paths(category_path)
for entry_path in entry_paths:
# read it line by line
with open(entry_path) as f:
content = f.readlines()
# apply regex on every line
matched_lines = [regex.findall(line) for line in content]
# loop over all the lines
for line, match in enumerate(matched_lines):
if match:
match = match[0]
# patch content
content[line] = "- Media:{}\n".format(match)
# write it line by line
with open(entry_path, "w") as f:
f.writelines(content)
def regular_replacements():
"""
Replacing some stuff by shortcuts. Can be run regularly
"""
# get category paths
category_paths = get_category_paths()
# for each category
for category_path in category_paths:
# get paths of all entries in this category
entry_paths = get_entry_paths(category_path)
for entry_path in entry_paths:
# read it line by line
with open(entry_path) as f:
content = f.read()
# now the replacements
content = content.replace('?source=navbar', '') # sourceforge specific
content = content.replace('single player', 'SP')
content = content.replace('multi player', 'MP')
# write it line by line
with open(entry_path, "w") as f:
f.write(content)
if __name__ == "__main__": if __name__ == "__main__":
@ -228,11 +284,16 @@ if __name__ == "__main__":
readme_path = os.path.join(games_path, os.pardir, 'README.md') readme_path = os.path.join(games_path, os.pardir, 'README.md')
# recount and write to readme # recount and write to readme
update_readme() #update_readme()
# generate list in toc files # generate list in toc files
update_category_tocs() #update_category_tocs()
# check external links (only rarely) # check external links (only rarely)
# check_validity_external_links() # check_validity_external_links()
# special, only run when needed
# fix_notation()
# regular replacements
regular_replacements()

View File

@ -1,11 +1,11 @@
# Hero of Allacrost # Hero of Allacrost
_Hero of Allacrost is a single player 2D role-playing game inspired by classic console RPGs._ _Hero of Allacrost is a 2D role-playing game inspired by classic console RPGs._
- Home: http://allacrost.org - Home: http://allacrost.org
- Download: https://bitbucket.org/allacrost/allacrost/downloads/ - Download: https://bitbucket.org/allacrost/allacrost/downloads/
- State: stable - State: stable
- Keywords: single player, 2D - Keywords: SP, 2D
- Code: https://bitbucket.org/allacrost/allacrost/src (hg) - Code: https://bitbucket.org/allacrost/allacrost/src (hg)
- Language(s): C++, Lua - Language(s): C++, Lua
- License: GPL-2.0 - License: GPL-2.0

View File

@ -6,7 +6,7 @@ _Arx Libertatis is a cross-platform, open source port of Arx Fatalis, a 2002 fir
- Wikipedia: https://en.wikipedia.org/wiki/Arx_Fatalis#Development - Wikipedia: https://en.wikipedia.org/wiki/Arx_Fatalis#Development
- Download: http://wiki.arx-libertatis.org/Download - Download: http://wiki.arx-libertatis.org/Download
- State: mature - State: mature
- Keywords: single player - Keywords: SP
- Code: https://github.com/arx/ArxLibertatis - Code: https://github.com/arx/ArxLibertatis
- Language(s): C++ - Language(s): C++
- License: GPL-3.0 - License: GPL-3.0

View File

@ -5,8 +5,8 @@ _{One line description}_
- Home: http://www.spiderwebsoftware.com/blades/opensource.html - Home: http://www.spiderwebsoftware.com/blades/opensource.html
- Wikipedia: <https://en.wikipedia.org/wiki/Exile_(1995_video_game_series)#Blades_of_Exile> - Wikipedia: <https://en.wikipedia.org/wiki/Exile_(1995_video_game_series)#Blades_of_Exile>
- Download: {URL} - Download: {URL}
- State: beta, mature (inactive since) - State: mature
- Keywords: single player, multi player, RTS, TBS (if none, remove the line) - Keywords: SP, MP, RTS, TBS
- Code: https://github.com/calref/cboe - Code: https://github.com/calref/cboe
- Language(s): C++ - Language(s): C++
- License: GPL-2.0 - License: GPL-2.0

View File

@ -1,6 +1,6 @@
# Catch Challenger # Catch Challenger
_A independent MMORPG, Lan game and a single player game._ _A independent MMORPG, Lan game and a SP game._
- Home: https://catchchallenger.first-world.info/ - Home: https://catchchallenger.first-world.info/
- Download: https://catchchallenger.first-world.info/download.html - Download: https://catchchallenger.first-world.info/download.html

View File

@ -4,7 +4,7 @@ _2D RPG set in a fantasy world._
- Home: https://github.com/iamCode/Dawn/wiki - Home: https://github.com/iamCode/Dawn/wiki
- State: beta, inactive since 2011 - State: beta, inactive since 2011
- Keywords: single player - Keywords: SP
- Code: https://github.com/iamCode/Dawn - Code: https://github.com/iamCode/Dawn
- Language(s): C++ - Language(s): C++
- License: GPL-3.0 - License: GPL-3.0

View File

@ -1,11 +1,11 @@
# DNT # DNT
_3D single player RPG in a satirical post-apocalyptical world._ _3D RPG in a satirical post-apocalyptical world._
- Home: http://dnt.dnteam.org/cgi-bin/about.py https://sourceforge.net/projects/dnt/ - Home: http://dnt.dnteam.org/cgi-bin/about.py https://sourceforge.net/projects/dnt/
- Download: http://dnt.dnteam.org/cgi-bin/downloads.py - Download: http://dnt.dnteam.org/cgi-bin/downloads.py
- State: beta, inactive since 2016 - State: beta, inactive since 2016
- Keywords: single player - Keywords: SP
- Code: https://sourceforge.net/p/dnt/code/ci/master/tree/ (git) - Code: https://sourceforge.net/p/dnt/code/ci/master/tree/ (git)
- Language(s): C++ - Language(s): C++
- License: GPL-3.0 - License: GPL-3.0

View File

@ -6,7 +6,7 @@ _FreedroidRPG is an open source role playing game._
- Wikipedia: https://de.wikipedia.org/wiki/FreedroidRPG (German) - Wikipedia: https://de.wikipedia.org/wiki/FreedroidRPG (German)
- Download: http://www.freedroid.org/download/ - Download: http://www.freedroid.org/download/
- State: mature - State: mature
- Keywords: single player, isometric - Keywords: SP, isometric
- Code: https://gitlab.com/freedroid/freedroid-src - Code: https://gitlab.com/freedroid/freedroid-src
- Language(s): C - Language(s): C
- License: GPL-2.0 - License: GPL-2.0

View File

@ -5,7 +5,7 @@ _Multiplayer online adventure game with an old school feel._
- Home: https://stendhalgame.org/ - Home: https://stendhalgame.org/
- Download: see home - Download: see home
- State: mature - State: mature
- Keywords: multi player, server - Keywords: MP, server
- Code: https://sourceforge.net/p/arianne/stendhal/ci/master/tree/ - Code: https://sourceforge.net/p/arianne/stendhal/ci/master/tree/
- Language(s): Java - Language(s): Java
- License: GPL-2.0 - License: GPL-2.0

View File

@ -1,6 +1,6 @@
# FreeRails # FreeRails
_Real time multi player strategy game where players compete to build the most powerful railroad empire._ _Real time MP strategy game where players compete to build the most powerful railroad empire._
- Home: http://freerails.sourceforge.net/ - Home: http://freerails.sourceforge.net/
- Download: https://sourceforge.net/projects/freerails/files/jfreerails/ - Download: https://sourceforge.net/projects/freerails/files/jfreerails/

View File

@ -4,7 +4,7 @@ _A 2D real time strategy Mega-Lo-Mania-like god game._
- Home: http://gigalomania.sourceforge.net/ - Home: http://gigalomania.sourceforge.net/
- State: beta, mature (inactive since) - State: beta, mature (inactive since)
- Keywords: single player, multi player, RTS, TBS (if none, remove the line) - Keywords: SP, MP, RTS, TBS (if none, remove the line)
- Code: https://sourceforge.net/p/gigalomania/code/ci/master/tree/ - Code: https://sourceforge.net/p/gigalomania/code/ci/master/tree/
- Language(s): C++ - Language(s): C++
- License: GPL-2.0 - License: GPL-2.0

View File

@ -4,7 +4,7 @@ _One-button real-time strategy game._
- Home: http://paxbritannica.henk.ca/ - Home: http://paxbritannica.henk.ca/
- State: mature - State: mature
- Keywords: single player, multi player, RTS, TBS (if none, remove the line) - Keywords: SP, MP, RTS, TBS (if none, remove the line)
- Code: https://github.com/henkboom/pax-britannica - Code: https://github.com/henkboom/pax-britannica
- Language(s): Lua, C - Language(s): Lua, C
- License: MIT - License: MIT