Adding #eidolon-face tag. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 63bc8267b89f072496ff9b935b420bfa6f961856 | |
parent b88a487b93a248efa8a8c0079b328192de563607 | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Tue, 11 Apr 2023 22:23:26 +0200 | |
Adding #eidolon-face tag. | |
Diffstat: | |
M modules/hashtags/hashtags.txt | 1 + | |
M wikipediagame | 16 +++++++++++++++- | |
2 files changed, 16 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/modules/hashtags/hashtags.txt b/modules/hashtags/hashtags.txt | |
@@ -6068,6 +6068,7 @@ | |
#egyptian-pyramid-scheme gophers://bitreich.org/9/memecache/egyptian-pyramid-s… | |
#ehehe gophers://bitreich.org/I/memecache/ehehe.png | |
#eidolon gophers://bitreich.org/I/memecache/eidolon.png | |
+#eidolon-face gophers://bitreich.org/I/memecache/eidolon-face.jpg | |
#eigengrau gophers://bitreich.org/I/memecache/eigengrau.jpg | |
#eileen gophers://bitreich.org/9/memecache/eileen.mkv | |
#einstein-elevator gophers://bitreich.org/9/memecache/einstein-elevator.mkv | |
diff --git a/wikipediagame b/wikipediagame | |
@@ -9,6 +9,7 @@ import sys | |
import getopt | |
import wikipedia as w | |
import json | |
+import random | |
from difflib import SequenceMatcher | |
def usage(app): | |
@@ -26,6 +27,7 @@ def main(args): | |
basepath = "/home/annna/bin/modules/wikipediagame" | |
printsummary = 0 | |
newtitle = 0 | |
+ title = None | |
for o, a in opts: | |
if o == "-h": | |
@@ -41,7 +43,19 @@ def main(args): | |
cmd = largs[0] | |
if cmd == "init": | |
- title = str(w.random()) | |
+ if len(largs) > 1: | |
+ searchresults = w.search(largs[1]) | |
+ while len(searchresults) > 0: | |
+ title = random.choice(searchresults) | |
+ try: | |
+ summary = w.summary(title) | |
+ break | |
+ except w.exceptions.DisambiguationError: | |
+ searchresults.remove(title) | |
+ continue | |
+ | |
+ if title == None: | |
+ title = str(w.random()) | |
if os.path.exists(hintpath): | |
os.remove(hintpath) | |
if os.path.exists(titlepath): |