added wikipedia links to inspirations

This commit is contained in:
Trilarion 2021-01-13 14:52:30 +01:00
parent c6997c8a7a
commit 6ef1a1f243
12 changed files with 421 additions and 61 deletions

View File

@ -23,6 +23,8 @@ https://github.com/septag/rizz
https://github.com/EvilPudding/candle https://github.com/EvilPudding/candle
https://github.com/TorqueGameEngines/Torque3D https://github.com/TorqueGameEngines/Torque3D
https://github.com/polymonster/pmtech https://github.com/polymonster/pmtech
https://en.wikipedia.org/wiki/Black_Shades (open source)
https://en.wikipedia.org/wiki/Category:Open-source_video_games (all of them)
http://icculus.org/ http://icculus.org/
http://icculus.org/asciiroth/ http://icculus.org/asciiroth/
http://icculus.org/avp/ http://icculus.org/avp/

View File

@ -53,6 +53,7 @@ Listing:
# TODO tooltip of supported systems # TODO tooltip of supported systems
# TODO improve or send feedback? # TODO improve or send feedback?
# TODO link dependencies # TODO link dependencies
# TODO top 50 list from Github via their stars with download links (add to entries)
import os import os
import shutil import shutil

View File

@ -7,6 +7,7 @@ stored Git repositories.
# TODO split devs with multiple gh or sf accounts (unlikely), start with most (like name Adam) - naming convention @01 etc. # TODO split devs with multiple gh or sf accounts (unlikely), start with most (like name Adam) - naming convention @01 etc.
# TODO check for devs without contact after gitlab/bitbucket/.. # TODO check for devs without contact after gitlab/bitbucket/..
# TODO gitlab/bitbucket import # TODO gitlab/bitbucket import
# TODO wikipedia search for all with more than 3 games
import time import time
from utils import osg, osg_ui from utils import osg, osg_ui

View File

@ -7,7 +7,7 @@ Sorts the entries in the contents files of each sub folder alphabetically.
""" """
# TODO check for within an entry for similar dev names # TODO check for within an entry for similar dev names
# TODO wikipedia (media search) # TODO wikipedia (media search) for popular ones at least
# TODO google search (for homepages or media entries) for popular ones at least # TODO google search (for homepages or media entries) for popular ones at least
import os import os

View File

@ -2,12 +2,11 @@
Maintenance of inspirations.md and synchronization with the inspirations in the entries. Maintenance of inspirations.md and synchronization with the inspirations in the entries.
""" """
# TODO wikipedia search and match
# TODO mark those that are contained in the database
# TODO search fandom # TODO search fandom
# TODO which inspirations have wikipedia entries with open source games category by aren't included
import time import time
from utils import osg, osg_ui, osg_wikipedia from utils import osg, osg_ui, osg_wikipedia, constants as c
valid_duplicates = ('Age of Empires', 'ARMA', 'Catacomb', 'Civilization', 'Company of Heroes', 'Descent', 'Duke Nukem', 'Dungeon Keeper', valid_duplicates = ('Age of Empires', 'ARMA', 'Catacomb', 'Civilization', 'Company of Heroes', 'Descent', 'Duke Nukem', 'Dungeon Keeper',
'Final Fantasy', 'Heroes of Might and Magic', 'Jazz Jackrabbit', 'Marathon', 'Master of Orion', 'Quake', 'Final Fantasy', 'Heroes of Might and Magic', 'Jazz Jackrabbit', 'Marathon', 'Master of Orion', 'Quake',
@ -80,30 +79,59 @@ class InspirationMaintainer:
print('inspirations not yet loaded') print('inspirations not yet loaded')
return return
for inspiration in self.inspirations.values(): for inspiration in self.inspirations.values():
if 'Included' in inspiration:
continue
if 'Media' in inspiration and any(('https://en.wikipedia.org/wiki/' in x for x in inspiration['Media'])): if 'Media' in inspiration and any(('https://en.wikipedia.org/wiki/' in x for x in inspiration['Media'])):
continue continue
name = inspiration['Name'] name = inspiration['Name']
# search in wikipedia # search in wikipedia
results = osg_wikipedia.search(inspiration['Name']) results = osg_wikipedia.search(inspiration['Name'])
# throw out all (disambiguation) pages # throw out all (disambiguation) pages
results = [r for r in results if not any(x in r for x in ('disambiguation', 'film'))] results = [r for r in results if not any(x in r for x in ('disambiguation', 'film'))]
# the simple ones # throw out those too dissimilar
results = [r for r in results if 'video game' in r] results = [r for r in results if osg.name_similarity(str.casefold(inspiration['Name']), str.casefold(r)) > 0.6]
if len(results) == 1 and 'series' not in name:
# get pages for the remaining
pages = osg_wikipedia.pages(results) pages = osg_wikipedia.pages(results)
page = pages[0]
url = page.url # throw out those that are no video games
# add url to Media field pages = [page for page in pages if any('video games' in category for category in page.categories)]
# sort by similarity to title and only keep highest
pages.sort(key=lambda page: osg.name_similarity(str.casefold(name), str.casefold(page.title)))
pages = pages[:min(1, len(pages))]
# if there is still one left, use it
if pages:
url = pages[0].url
inspiration['Media'] = inspiration.get('Media', []) + [url] inspiration['Media'] = inspiration.get('Media', []) + [url]
print('{} : {}'.format(name, url)) print('{} : {}'.format(name, url))
def update_included_entries(self):
if not self.inspirations:
# check for name similarity print('inspirations not yet loaded')
# results = [r for r in results if any(x in r for x in ('video game', 'series')) or osg.name_similarity(str.casefold(inspiration['Name']), str.casefold(r)) > 0.8] return
# results = [r for r in results if any(x in r for x in ('video game', 'series'))] if not self.entries:
# print('{}: {}'.format(inspiration['Name'], results)) print('entries not yet loaded')
return
# get all entry names
entry_names = [entry['Title'] for entry in self.entries]
# loop over all inspirations
for inspiration in self.inspirations.values():
name = inspiration['Name']
included = name in entry_names and name not in inspiration['Inspired entries']
if included:
if 'Included' not in inspiration:
print('{} is included but was not marked as such'.format(name))
for field in c.optional_inspiration_fields:
if field in inspiration:
del inspiration[field]
inspiration['Included'] = 'Yes'
elif 'Included' in inspiration:
print('{} was marked as included but is not anymore'.format(name))
del inspiration['Included']
def update_inspired_entries(self): def update_inspired_entries(self):
if not self.inspirations: if not self.inspirations:
@ -142,6 +170,7 @@ if __name__ == "__main__":
'Check for orphans': m.check_for_orphans, 'Check for orphans': m.check_for_orphans,
'Check for inspirations not listed': m.check_for_missing_inspirations_in_entries, 'Check for inspirations not listed': m.check_for_missing_inspirations_in_entries,
'Check for wikipedia links': m.check_for_wikipedia_links, 'Check for wikipedia links': m.check_for_wikipedia_links,
'Update included entries': m.update_included_entries,
'Update inspirations from entries': m.update_inspired_entries, 'Update inspirations from entries': m.update_inspired_entries,
'Read entries': m.read_entries 'Read entries': m.read_entries
} }

View File

@ -205,6 +205,6 @@ url_developer_fields = ('Home',)
# inspiration/original game information (in the file all fields will be capitalized) # inspiration/original game information (in the file all fields will be capitalized)
essential_inspiration_fields = ('Name', 'Inspired entries') essential_inspiration_fields = ('Name', 'Inspired entries')
optional_inspiration_fields = ('Media',) optional_inspiration_fields = ('Media','Included')
valid_inspiration_fields = essential_inspiration_fields + optional_inspiration_fields valid_inspiration_fields = essential_inspiration_fields + optional_inspiration_fields
url_inspiration_fields = ('Media',) url_inspiration_fields = ('Media',)

View File

@ -20,6 +20,9 @@ def search(search_term, results=3):
def pages(titles): def pages(titles):
pages = [] pages = []
for title in titles: for title in titles:
try:
page = wikipedia.page(title, auto_suggest=False) page = wikipedia.page(title, auto_suggest=False)
except wikipedia.exceptions.DisambiguationError:
continue # here we silently eat the exception
pages.append(page) pages.append(page)
return pages return pages

View File

@ -1,7 +1,7 @@
# Bt Builder # Bt Builder
- Home: http://identicalsoftware.com/btbuilder/ - Home: http://identicalsoftware.com/btbuilder/
- Inspiration: Bard's Tale Contruction Set - Inspiration: The Bard's Tale Construction Set
- State: beta - State: beta
- Keyword: remake, tool - Keyword: remake, tool
- Code repository: https://github.com/dulsi/btbuilder.git (@created 2012, @stars 26, @forks 4) - Code repository: https://github.com/dulsi/btbuilder.git (@created 2012, @stars 26, @forks 4)

View File

@ -1,7 +1,7 @@
# Cannonball # Cannonball
- Home: https://github.com/djyt/cannonball/wiki, http://reassembler.blogspot.com/ - Home: https://github.com/djyt/cannonball/wiki, http://reassembler.blogspot.com/
- Inspiration: Outrun - Inspiration: Out Run
- State: beta - State: beta
- Download: https://github.com/djyt/cannonball/wiki#downloads - Download: https://github.com/djyt/cannonball/wiki#downloads
- Keyword: action, remake, content commercial - Keyword: action, remake, content commercial

View File

@ -1,7 +1,7 @@
# Labyrinth of Worlds # Labyrinth of Worlds
- Home: http://low.sourceforge.net/index.php, https://sourceforge.net/projects/low/ - Home: http://low.sourceforge.net/index.php, https://sourceforge.net/projects/low/
- Inspiration: Ultima Underworld 2: Labyrinth of Worlds - Inspiration: Ultima Underworld II: Labyrinth of Worlds
- State: beta, inactive since 2010 - State: beta, inactive since 2010
- Download: https://sourceforge.net/projects/low/files - Download: https://sourceforge.net/projects/low/files
- Keyword: role playing - Keyword: role playing

View File

@ -1,7 +1,7 @@
# UnderworldExporter # UnderworldExporter
- Home: https://github.com/hankmorgan/UnderworldExporter - Home: https://github.com/hankmorgan/UnderworldExporter
- Inspiration: Ultima Underworld, Ultima Underworld II: Labyrinth of Worlds - Inspiration: Ultima Underworld 1, Ultima Underworld II: Labyrinth of Worlds
- State: mature - State: mature
- Keyword: remake, role playing, content commercial + original required - Keyword: remake, role playing, content commercial + original required
- Code repository: https://github.com/hankmorgan/UnderworldExporter.git (@created 2014, @stars 204, @forks 16) - Code repository: https://github.com/hankmorgan/UnderworldExporter.git (@created 2014, @stars 204, @forks 16)

File diff suppressed because it is too large Load Diff