diff options
Diffstat (limited to 'wiki-to-help/mwlib_mods/custom_nfo.py')
-rw-r--r-- | wiki-to-help/mwlib_mods/custom_nfo.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/wiki-to-help/mwlib_mods/custom_nfo.py b/wiki-to-help/mwlib_mods/custom_nfo.py new file mode 100644 index 0000000000..9d60fe6c8e --- /dev/null +++ b/wiki-to-help/mwlib_mods/custom_nfo.py @@ -0,0 +1,19 @@ +""" +Enable looking for a custom nfo.json and siteinfo.json + +Author: Timo Richter +""" +import mwlib.cdbwiki +class WikiDB(mwlib.cdbwiki.WikiDB): + def __init__(self, dir, prefix='wiki', lang="en"): + try: + super(WikiDB,self).__init__(dir,prefix,lang) + except(RuntimeError): + print("Warning: "+"could not get siteinfo for language %r" % (lang,)) + print("Please set up a custom siteinfo and nfo.") + self.nfo = self.get_data("nfo") or self.nfo + self.siteinfo = self.get_data("siteinfo") or self.siteinfo + +def apply(): + mwlib.cdbwiki.WikiDB=WikiDB + |