Rename Python script
authorLanius Trolling <lanius@laniustrolling.dev>
Sat, 27 Jan 2024 14:15:55 +0000 (09:15 -0500)
committerLanius Trolling <lanius@laniustrolling.dev>
Sat, 27 Jan 2024 14:17:49 +0000 (09:17 -0500)
stuff/fix_quotes.py [new file with mode: 0644]
stuff/fixquotes.py [deleted file]

diff --git a/stuff/fix_quotes.py b/stuff/fix_quotes.py
new file mode 100644 (file)
index 0000000..e4e379f
--- /dev/null
@@ -0,0 +1,26 @@
+import json
+import re
+
+quote_pattern = re.compile(r"^\"(.*)\" \- (.*?)\|(.*?)\@(.*?)$")
+
+quote_list = []
+
+with open("../test/quotes.json", mode="r", encoding="utf-8") as quotes_json_file:
+       quote_list.extend(json.load(quotes_json_file))
+
+with open("../test/quotes.txt", mode="r", encoding="utf-8") as quotes_file:
+       for quote in quotes_file:
+               quote = quote.rstrip()
+               match = quote_pattern.fullmatch(quote)
+               
+               text, author, portrait, link = match.groups()
+               quote_dict = {
+                       "quote": text,
+                       "author": author,
+                       "portrait": "portrait-" + portrait.lower().replace(" ", "-").replace("'", ""),
+                       "link": link.removeprefix("https://mechyrdia.info/lore/")
+               }
+               quote_list.append(quote_dict)
+
+with open("../test/quotes.json", mode="w", encoding="utf-8") as quotes_json_file:
+       json.dump(quote_list, quotes_json_file, indent="\t")
diff --git a/stuff/fixquotes.py b/stuff/fixquotes.py
deleted file mode 100644 (file)
index e4e379f..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-import json
-import re
-
-quote_pattern = re.compile(r"^\"(.*)\" \- (.*?)\|(.*?)\@(.*?)$")
-
-quote_list = []
-
-with open("../test/quotes.json", mode="r", encoding="utf-8") as quotes_json_file:
-       quote_list.extend(json.load(quotes_json_file))
-
-with open("../test/quotes.txt", mode="r", encoding="utf-8") as quotes_file:
-       for quote in quotes_file:
-               quote = quote.rstrip()
-               match = quote_pattern.fullmatch(quote)
-               
-               text, author, portrait, link = match.groups()
-               quote_dict = {
-                       "quote": text,
-                       "author": author,
-                       "portrait": "portrait-" + portrait.lower().replace(" ", "-").replace("'", ""),
-                       "link": link.removeprefix("https://mechyrdia.info/lore/")
-               }
-               quote_list.append(quote_dict)
-
-with open("../test/quotes.json", mode="w", encoding="utf-8") as quotes_json_file:
-       json.dump(quote_list, quotes_json_file, indent="\t")