Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- #
- # "I'm Metal Digger Locus, and this is my favorite log-editing script!" -Metal Digger Locus
- #
- #______ ______ ___ ______
- #___ / _____________ _ ___ |/ /___ _________________ /______________
- #__ / _ __ \_ __ `/ __ /|_/ /_ / / /_ __ \ ___/_ __ \ _ \_ ___/
- #_ /___/ /_/ / /_/ / _ / / / / /_/ /_ / / / /__ _ / / / __/ /
- #/_____/\____/_\__, / /_/ /_/ \__,_/ /_/ /_/\___/ /_/ /_/\___//_/ 1.4.3
- # /____/
- # LOG MUNCHER is a script meant to automate 90% of MUSH log editing.
- # LOG MUNCHER is hungry for text but will leave it alone if it looks like it might be a pose, radio or a log-worthy comsys message.
- # LOG MUNCHER will also take care of minor tasks for you, like format italics and organize your participants list!
- # LOG MUNCHER is currently compatible with logs from Dream Chasers, Mega Man MUSH and Battle Fantasia; it is in alpha for SRTMOO
- # DCMUSH UPDATE VERSION - Edited by DCMUSH staff (permission to configure graciously given by the code's original creator, Rosaline@DC) and Fureasei!
- ####### INSTRUCTION MANUAL #######
- # -Make sure you have pot_spoof on! If you don't, or if you're not sure, you can turn it on by entering these commands:
- # For DC: &pot_spoof me=1
- # For M3: &config`setting`pot_spoof me=1
- # Unfortunately, logs taken before you turned this setting on can't be parsed by Log Muncher. :(
- # -Have Python on your computer! (https://www.python.org/downloads/) I did this in 3.7.2 though earlier versions may still work.
- # -Copy-paste ALL of this text into a Python script file (You can call it whatever, so long as it has the ".py" extension)
- # -Put the script file in some folder
- # -Create a folder named "Raw Logs" and a folder named "Edited Logs" in the same directory as the script file
- # -Put the logs you want to clean into the Raw Logs folder
- # -Look down at the "Options Menu" section just below, and make sure everything is to your liking!
- # -~* BE SURE TO SET THE CORRECT MUSH VARIABLE, JUST BELOW *~
- # -Run the script and LET THE MAGIC HAPPEN
- # -Hopefully nothing explodes! Tell me if it does.
- ####### THE OPTIONS MENU #######
- # SAILOR CERI SAYS: Please do NOT remove this part! The script won't run if you do!
- mush = "DC" # Which game are these logs for? DC = Dream Chasers MUSH, M3 = Mega Man MUSH, BF = Battle Fantasia MUSH, SRTMOO = Super Robot Taisen MOO
- displaydesc = 1 # Will display the room desc at the beginning of your log. Set to 0 to turn off. Might miss some formats.
- replaceitalics = 1 # Replaces slashes with double apostrophes (the wiki code for italics!)
- stopwikiweirdness = 1 # Replaces some characters (<, >, * and ~) with things the wiki isn't allergic to.
- maxlength = 120 # The maximum length, in characters, for comsys/radio messages before they wrap around
- blurayediting = 1 # Will include in the log lines containing words in the customizable list below, to help editing.
- bluraylist = ["bluray", "blu-ray", "blue-ray", "blue ray", "fix it in post"] # Feel free to add your own!
- bluraywarning = 1 # If set to 1, will put a BIG NOTE at the beginning of the log telling you to check for bluray edits.
- #minushours = ???
- # SAILOR CERI REITERATES: Please do NOT remove this part! The script won't run if you do!
- import re
- import os
- import textwrap
- import sys
- import time
- logsedited = 0
- logsleftalone = 0
- logging = 0
- isthisapose = 0 #0 = not a pose, 1 = pose body, 2 = nospoof header
- sortoflogging = 0
- startpose = 0
- nospoof = re.compile(r"(?<=^<Pose Tracker>)(.*)(?= has posed\.$)")
- SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
- os.chdir(SCRIPT_DIR)
- print("Hi. My current folder is ",os.getcwd())
- nospoof = re.compile(r"(?<=^<Pose Tracker>)(.*)(?= has posed\.$)")
- if mush == "DC":
- whitelist = ["=< CHALLENGE -", "<* CHALLENGE -", " |Dungeon Ability: ", "-< Challenge", "= Dungeon Conditions:", "| QUICK TIME EVENT!!!|",
- "=< Results -", "<* Results -", "< Party >"]
- comsysprefixes = ["GS: ", "DG: ", "DC: ", "QTE!!! Challenge Result:"]
- radiolist = []
- banlist = ["+=======", "========", "--------", "..................", "===== +health", "===== +scenesys", "===== +stats:" \
- "This world is Pueblo ", "Logging to file ", "Logging Started: ", \
- "[OOC] ", "[BBS] ", "[JOBS] ", "[WATCH] ", "[GRID] ", "[FLIP] ", "[HELP] ", "MAIL: ", "[FCLIST] ", "[FINGER] ", \
- "(New BB Message (", "<GROUP BB> ", "+vote: ", "+Vote: ", "+votes: ", " +pot/soundtrack:", \
- "<Guest> ", "<Public> ", "<Ask-Staff> ", "<Discussion> ", "<Entertainment> ", "<RP Finder> ", "<Spoilers> ", "<Support> ", \
- "<Big Scene> ", "<Characters> ", "<O-", \
- "You will no longer hear messages on channel ", "You will now hear messages on channel ", \
- "--- Disconnected", "--- Connected", \
- "You paged ", "From afar, ", "From afar (to ", "Long distance to ", \
- "You start your posting to Board #", "Player Name On For Idle Doing", \
- "Huh? (Type ", "I don't see that here.", \
- "= +stats", "BSYS:", "= +health", "= +buckets", "= +attacks", "= Libra:", "= Pokemon Box For", "= Specialties for"]
- banlist_nonprefix = [" pages: ", " has connected.\n", " has disconnected.\n", " has partially disconnected.\n",
- " has reconnected.\n", " heads over from ", " heads over to ", " has left.\n", " has arrived.\n",
- " just looked at you.\n", "'s last pose:"]
- comsys_narcissism = [" fully healed ", "party information reset", "Exhaustion reset", \
- "You've readied your Tool", "You use your Tool", \
- "DG: You pass the challenge,", "DG: You fail the challenge,", \
- "GS: Freeattacks wiped from your current mode.", " has been added to slot ",
- " Please provide a more specific Tool.", "DG: You can't load that many tools!",
- "DG: You've unloaded your Tool,", "DG: You've already acted for this turn.",
- "DG: You don't have a party leader right now!", "DG: That's not a valid party leader.",
- "You must use a Basic Action that matches the Challenge's Dungeon Ability.",
- "You have created a party! Your Digger status has been reset!",
- "Not everyone in the party has acted yet.",
- " has joined your party!",
- " has created a party! To join, type +party/reset and then type +party/join "]
- elif mush == "M3":
- whitelist = ["hey there, I hope you're enjoying LOG MUNCHER! this is a placeholder message"]
- comsysprefixes = ["COMBAT:"]
- radiolist = ["<Radio: A - ", "<Radio: B - ", "<Radio: C - ", "<Radio: D - ", \
- "<Radio: E - ", "<Radio: F - ", "<Radio: G - ", "<Radio: H - ", \
- "<Radio> You intercept a transmission to ", \
- "<Live> ", "<Radio> Tightbeam "] #Add the rest of the alphabet soup yourself if you play an interceptor!
- banlist = ["_______", "========", "--------", \
- "This world is Pueblo ", "Logging to file ", "Logging Started: ", \
- "[OOC] ", "MAIL: ", "SAVE: ", "WF: ", "GAME: ", "CHAT: ", \
- "(New BB Message", "(New BB message ", "+vote: ", \
- "<Guests> ", "<Public> ", "<Discussions> ", "<Q-Spoilers> ", "<Fandom> ", \
- "<O-", "<Munchkinery> ", "<NC-X-17+> ", "<RP!> ", "<Hard Nerd> ", "<Altchars>", \
- "<B-Music> ", "<ElseMUSH> ", "<Staff Hotline> ", "<Tech> ", "<Workouts> ", \
- "You will no longer hear messages on channel ", "You will now hear messages on channel ", \
- "--- Disconnected", "--- Connected", "There's no place like home...", \
- "You paged ", "From afar, ", "From afar (to ", "Long distance to ", \
- "You start your posting to Board #", "Player Name On For Idle Doing", \
- "Huh? (Type ", "I don't see that here.", "Your description has been changed to ", \
- "You have earned ", "P1 WINS.", "You are out of +cookies for the week.", "You hand ", \
- "Type their full name to +cookie someone.", \
- "You don't have the Buster ability."]
- banlist_nonprefix = [" pages: ", " has connected.\n", "has disconnected.\n", " has partially disconnected.\n",
- " has reconnected.\n", " heads over from ", " heads over to ", " has left.\n", " has arrived.\n",
- " just looked at you."
- " flips a coin in the air and it comes down ", " has been set as your armor ",
- " hands you a cookie for a job well done!"]
- comsys_narcissism = [" has reset their systems to full.", " has been added to slot ",
- " has been added to your queue.",
- "You take more damage due to your system weaknesses.",
- "You take less damage due to your system weaknesses.",
- " points of damage taken!", " life energy left!", "COMBAT: Your attack has been added to ",
- "You have set yourself to be automatically grabby-handed by a weapon copy user.",
- "You do not appear to have an armor in the a slot.",
- " weapon energy available!", " weapon energy to you.", " You have healed ",
- " to your current status effects.", " You do not have any general attacks setup yet.",
- " has been set on your ", "Data doesn't like it when people try to skip in line at the buffet."]
- elif mush == "BF":
- whitelist = ["hey there, I hope you're enjoying LOG MUNCHER! this is a placeholder message"]
- comsysprefixes = ["COMBAT: ", "BEAMWAR: ", "OOC: ", "DICE: ", "COIN FLIP: ",]
- radiolist = ["<I-"]
- banlist = ["*+*+*+*+*+", ".********", "|********", ".*+*+*+*+*", "'***********", "==========", "-------------", \
- "This world is Pueblo ", "Logging to file ", "Logging Started: ", \
- "[OOC] ", "+help", "ALERT: ", "MAIL: ", "+watchfor: ", "GAME: ", \
- "There are no unread postings on the Global Bulletin Board.", "Your bbpost has been discarded.",
- "Text added to bbpost.", "+vote: ", "+sparkle: ", "+finger: ", "+queue: ", "+soundtrack: ", "+freeattack/set: ", \
- "+freeattack/wipe: ", "+heal/boss: ", \
- "<Guests> ", "<Public> ", "<Ask-Staff> ", "<Discussion> ", "<Entertainment> ", "<LFRP> ", \
- "<Spoilers> ", "<Cooking>", "<Characters>", "<Fitness>", "<O-DF>", "<O-Infinity>", "<O-Ends>", "<O-MA>", \
- "<O-Tuners>", "<O-Juuban>", "<O-Ohtori>", \
- "You will no longer hear messages on channel ", "You will now hear messages on channel ", "Logging to file", \
- "You can't do that.", "--- Connected", \
- "You paged ", "From afar, ", "From afar (to ", "Long distance to ", \
- "You start your posting to Board #", "Player Name On For Idle", \
- "Huh? (Type ", "I don't see that here.", \
- "ALERT: You are now able"]
- banlist_nonprefix = [" has cancelled their", " could match more than one player."," doesn't have an incoming attack",
- "has not concluded their actions. Reactions are not yet available.\n", " pages: ", " has connected.\n",
- "has disconnected.\n", " has partially disconnected.\n", " just looked at you.",
- " has reconnected.\n", " heads over from ", " heads over to ", " has left.\n", " has arrived.\n",]
- comsys_narcissism = [" fully healed ", " has gone to Tokyo with +tokyo.", "COMBAT: Your next attack will not",
- "COMBAT: Player not found.", "COMBAT: You can only attack people in the same room as you.",
- "COMBAT: You can't", "COMBAT: No one by that name", "COMBAT: Your combo will",
- "COMBAT: You haven't started a combo", "COMBAT: You can only", "COMBAT: Player not found.",
- "COMBAT: You've found a bug.", "COMBAT: You must use",
- "COMBAT: You are already in a BEAMWAR, and may only be in one at a time.",
- "COMBAT: Without the barrier flag, only a ",
- "COMBAT: The entered attack name could match more than one available attack.",
- "COMBAT: Unrecognized attack. Please check for typos in the attack name entered.",
- "COMBAT: You cannot use an attack with a TEAM flag with +counter. Please see +help +combo.",
- "COMBAT: You cannot use an attack with the Item Grab flag with +counter. Please see +help Items.",
- "COMBAT: You don't have",
- "COMBAT: Your next attack will not KO your opponent(s) (unless +accept is used).",
- "COMBAT: Please use +accept ", "COMBAT: You cannot ", "COMBAT: You don't have",
- " has finished attacking."]
- elif mush == "SRTMOO":
- whitelist = ["< FLASHPOINT CHALLENGE: ", "< TITLE: ", "< DIFFICULTY: ", "< TENSION: ", "< Round "]
- comsysprefixes = ["KTS: ", "FPS: ", "FPT: "]
- radiolist = ["[P-", "[T-", "[VERTEX] "]
- banlist = ["=---------", "==============================", "+-----", "=-------------[", "/--------------", "\\--------------", \
- "This world is Pueblo ", "Logging to file ", "Logging Started: ", \
- "[OOC] ", "[Public] ", "[Guest] ", "[Ask Staff] ", "[Spoilers] ", "[RP-Seeking] ", "[Entertainment] ", "[Support] ", \
- "[Big-Scene] ", "[Characters] ", "[Leadership] ", "[Debug] ", "[Coordination] ", "[O-", "From afar, ","You paged ", \
- "Long distance to ", "BBSYS: ", "SCENESYS: ", "CHANSYS: ", "You are empty-handed.", "I don't understand that.", \
- "You are now gagging ", "You are no longer gagging ", "Now gagging all channels.", "All channels ungagged.", \
- "Player name Connected Idle time Location", "You have new mail ", \
- "Type `help mail' for info on reading it."]
- banlist_nonprefix = [" has disconnected.\n", " has partially disconnected.\n", " has reconnected.\n", " has connected.\n",
- " have disconnected.\n", " have partially disconnected.\n", " have reconnected.\n", " have connected.\n",
- " just looked at you.", " heads over from ", " heads over to ", " has left.\n", " has paged you with,",
- ") has paged ", " teleports in.\n", " teleports out.\n", " is now set observer.\n"]
- comsys_narcissism = ["KTS: Weapon: ", "KTS: EN Regen activates. ", "KTS: SP Regen activates. ", "KTS: Your unit's HP stands at ",
- "KTS: Your EN is now ", "KTS: You're out of the fight.", " has changed loadout.", " has completed their actions for the round.",
- " has placed a bucket with capacity ", " has cleared their bucket.", "'s bucket!\n", " has left\n",
- " has created party for Flashpoint #", "FPT: The party led by ", "FPT: Round Complete!",
- "FPT: +flash/draw to start a new round!", "FPT: Drawing Card ", "'s party!\n",
- "Physical,Melee", "Physical,Ranged", "Beam,Melee", "Beam,Ranged", "Force,Melee", "Force,Ranged",
- "Magic,Melee", "Magic,Ranged", "Melee,Passive", "Ranged,Passive"]
- if blurayediting == 1:
- whitelist.extend(bluraylist)
- log = []
- cast = []
- logdate = ""
- location = ""
- roomdesc = []
- if mush == "DC":
- usualheader = "====<* "
- locationban = "==<* Inn of the Last Home *>=="
- quietroom = "==<* Big Bridge *>=="
- roomevidence = "------< Players >------"
- elif mush == "M3":
- usualheader = "======="
- locationban = "OOC Lounge"
- quietroom = "Quiet Room"
- roomevidence = "--- Contents ---"
- elif mush == "BF":
- usualheader = "+*+*+*+ "
- locationban = "OOC Lounge - The Great Cake"
- quietroom = "Quiet Room - Parfait of Silence"
- roomevidence = "+*+*+* Players +*+*+*"
- elif mush == "SRTMOO":
- usualheader = "--------< "
- locationban = "Inexplicable Vending Machine Corner"
- quietroom = "Medbay"
- roomevidence = "------< Players >------"
- mightbelocation = ""
- mightberoomdesc = []
- thisisnowaresultsscreen = 0
- bluraycount = 0
- poses = []
- previousline = ""
- previousroomline = ""
- print(" ")
- print("WELCOME TO...")
- print(" ")
- print(r"______ ______ ___ ______")
- print(r"___ / _____________ _ ___ |/ /___ _________________ /______________")
- print(r"__ / _ __ \_ __ `/ __ /|_/ /_ / / /_ __ \ ___/_ __ \ _ \_ ___/")
- print(r"_ /___/ /_/ / /_/ / _ / / / / /_/ /_ / / / /__ _ / / / __/ /")
- print(r"/_____/\____/_\__, / /_/ /_/ \__,_/ /_/ /_/\___/ /_/ /_/\___//_/")
- print(r" /____/")
- print(" ")
- print(" (!) Don't forget to double-check your munched logs before posting! MUNCHERCORP")
- print(" will NOT be held responsible if your embarrassing pages end up on the wiki.")
- print(" ")
- print("\"I'm Metal Digger Locus, and this is my favorite log-editing script!\"")
- print(" - Metal Digger Locus")
- print(" ")
- try:
- for log in os.listdir("./Raw Logs/"):
- if os.path.isfile("./Edited Logs/" + log):
- logsleftalone += 1
- else:
- print("Now editing: " + log)
- try:
- with open ("./Raw Logs/" + log, 'rt') as in_file:
- loglastedited = os.path.getmtime("./Raw Logs/" + log)
- logdate = time.strftime("%B %d, %Y", time.gmtime(loglastedited - 54000))
- for line in in_file:
- for banitem in banlist:
- if line.startswith(banitem):
- if (thisisnowaresultsscreen == 1):
- break
- if usualheader in line and locationban not in line and quietroom not in line:
- mightbelocation = line
- sortoflogging = 1
- elif sortoflogging == 1 and roomevidence in line:
- location = mightbelocation
- roomdesc = mightberoomdesc
- sortoflogging = 0
- mightberoomdesc = []
- else:
- sortoflogging = 0
- mightberoomdesc = []
- logging = 0
- if isthisapose == 1 and mush == "DC":
- poses.append("</poem>\n")
- elif isthisapose == 1 and mush == "SRTMOO":
- poses.append("</poem>\n")
- isthisapose = 0
- break
- for ughitem in banlist_nonprefix:
- if ughitem in line:
- if isthisapose == 1 and mush == "DC":
- poses.append("</poem>\n")
- elif isthisapose == 1 and mush == "SRTMOO":
- poses.append("</poem>\n")
- logging = 0
- isthisapose = 0
- sortoflogging = 0
- mightberoomdesc = []
- break
- if nospoof.search(line):
- if mush == "DC":
- if not "[[Character :: " + line[15:-12] + "]]" in cast:
- cast.append("[[Character :: " + line[15:-12] + "]]")
- elif mush == "M3":
- if "]" in line:
- if not line[15:-16] in cast:
- cast.append(line[15:-16])
- else:
- if not line[15:-12] in cast:
- cast.append(line[15:-12])
- elif mush == "BF":
- if not "[[" + line[15:line.find(" [") - len(line)] + "]]" in cast:
- cast.append("[[" + line[15:line.find(" [") - len(line)] + "]]")
- elif mush == "SRTMOO":
- if not "[[Character :: " + line[15:-12] + "]]" in cast:
- cast.append("[[Character :: " + line[15:-12] + "]]")
- logging = 1
- startpose = 1
- for whiteitem in whitelist:
- if whiteitem in line:
- if isthisapose == 1 and mush == "DC":
- poses.append("</poem>\n")
- elif isthisapose == 1 and mush == "SRTMOO":
- poses.append("</poem>\n")
- isthisapose = 0
- logging = 1
- sortoflogging = 0
- mightberoomdesc = []
- if blurayediting == 1:
- for blueitem in bluraylist:
- if blueitem in line:
- bluraycount += 1
- for prefix in comsysprefixes:
- if line.startswith(prefix):
- if isthisapose == 1 and mush == "DC":
- poses.append("</poem>\n")
- elif isthisapose == 1 and mush == "SRTMOO":
- poses.append("</poem>\n")
- isthisapose = 0
- logging = 1
- sortoflogging = 0
- mightberoomdesc = []
- for myitem in comsys_narcissism:
- if myitem in line:
- logging = 0
- break
- for radiotype in radiolist:
- if line.startswith(radiotype):
- if isthisapose == 1 and mush == "DC":
- poses.append("</poem>\n")
- elif isthisapose == 1 and mush == "SRTMOO":
- poses.append("</poem>\n")
- isthisapose = 0
- logging = 1
- sortoflogging = 0
- mightberoomdesc = []
- if logging == 1:
- if ("<* CHALLENGE -" in line or "< FLASHPOINT CHALLENGE: " in line):
- if not previousline.isspace():
- poses.append("\n")
- poses.append(" " + previousroomline)
- elif ("< Results -" in line):
- if not previousline.isspace():
- poses.append("\n")
- poses.append(" " + previousroomline)
- thisisnowaresultsscreen = 1
- elif ("= Digger 2.0 =" in line):
- thisisnowaresultsscreen = 0
- elif (nospoof.search(line) != None):
- if isthisapose == 1 and mush == "DC":
- poses.append("</poem>\n")
- elif isthisapose == 1 and mush == "SRTMOO":
- poses.append("</poem>\n")
- isthisapose = 2
- else:
- for prefix in comsysprefixes:
- if line.startswith(prefix):
- if not previousline.startswith(prefix) and not previousline.isspace():
- if isthisapose == 1 and mush == "DC":
- poses.append("</poem>\n")
- elif isthisapose == 1 and mush == "SRTMOO":
- poses.append("</poem>\n")
- poses.append("\n")
- isthisapose = 0
- for radiotype in radiolist:
- if line.startswith(radiotype):
- if not previousline.startswith(radiotype) and not previousline.isspace():
- if isthisapose == 1 and mush == "DC":
- poses.append("</poem>\n")
- elif isthisapose == 1 and mush == "SRTMOO":
- poses.append("</poem>\n")
- poses.append("\n")
- isthisapose = 0
- if isthisapose == 0:
- if len(line) > maxlength:
- for subline in textwrap.wrap(line, maxlength):
- poses.append(" " + subline + "\n")
- else:
- poses.append(" " + line)
- elif isthisapose == 2:
- if not previousline.isspace():
- poses.append("\n")
- if mush == "M3":
- poses.append("\n")
- poses.append(" " + line)
- isthisapose = 1
- elif isthisapose == 1:
- if line.startswith("<SoundTracker> "):
- line = " " + line
- poses.append(line)
- else:
- if replaceitalics == 1 and line.count("/"):
- if not (line.count("/") % 2):
- line = line.replace("/", "''")
- if stopwikiweirdness == 1:
- line = line.replace("*", "*")
- line = line.replace("<", "<")
- line = line.replace(">", ">")
- line = line.replace("\t", " ")
- line = line.replace("~~~", "<nowiki>~~~</nowiki>")
- if startpose == 1:
- if mush == "DC":
- poses.append("<poem>" + line)
- elif mush == "SRTMOO":
- poses.append("<poem>" + line)
- startpose = 0
- else:
- poses.append(line)
- previousline = line
- if sortoflogging == 1:
- if line != previousroomline:
- mightberoomdesc.append(line)
- previousroomline = line
- try:
- with open ("./Edited Logs/" + log, 'wt') as out_file:
- if bluraywarning and bluraycount:
- out_file.write("\n<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
- if bluraycount == 1:
- out_file.write("Check your log for bluray editing! " + str(bluraycount) + " mark was detected!\n")
- else:
- out_file.write("Check your log for bluray editing! " + str(bluraycount) + " marks were detected!\n")
- out_file.write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->\n\n")
- if mush == "DC":
- out_file.write("*'''Log: " + log[:-4] + "'''\n" + \
- "*'''Cast:''' ")
- out_file.write(', '.join(cast))
- out_file.write("\n*'''Where:''' " + location.rstrip(" *>=\n").lstrip("=<* ") + "\n" + \
- "*'''Date:''' " + logdate + "\n" + \
- "*'''Summary''': ''<Summarize!>''\n\n" + \
- "----\n")
- if displaydesc == 1:
- out_file.write("\n")
- for liney in roomdesc:
- out_file.write(" " + liney)
- if liney.startswith("BGM: "):
- break
- elif mush == "M3":
- out_file.write("{{Infobox Log\n" + \
- "|title=" + log[:-4] + "\n" + \
- "|recap=\n" + \
- "|rldate=" + logdate + "\n" \
- "|icdate=YYYY-MM-DD\n" + \
- "|storyarc=\n" + \
- "|scenetype=\n" + \
- "|participants=")
- out_file.write(', '.join(cast))
- out_file.write("\n|location=" + location.rstrip(" =\n").lstrip("= ") + "\n}}\n\n")
- if displaydesc == 1:
- out_file.write("\n")
- for liney in roomdesc:
- out_file.write(" " + liney)
- elif mush == "BF":
- out_file.write('{|class="toccolours" cellspacing="2"\n' + \
- "|-\n" + \
- '! style="background:#CC6699; border: 2px #CC0033 solid; font-size: 110%;" align="center" colspan="2" | ' + \
- "'''Title: " + log[:-4] + "'''" + "\n" + \
- "|-\n" + \
- "|'''Summary''':<br>\n" + \
- "''<The summary>''\n" + \
- "|-\n" + \
- "|'''Who''':<br>\n")
- out_file.write(', '.join(cast))
- out_file.write("\n" + \
- "|-\n" + \
- "|'''Where:'''<br>\n")
- out_file.write(location.rstrip(" +*\n").lstrip("*+ ") + "\n}}\n\n")
- out_file.write("|-\n" + \
- "|'''OOC - IC Date:'''<br>\n")
- if logdate:
- out_file.write(logdate + " - <IC Date>\n")
- else:
- out_file.write("<OOC Date> - <IC Date>\n")
- out_file.write("|-\n" + \
- "|}\n")
- if displaydesc == 1:
- out_file.write("\n")
- for liney in roomdesc:
- out_file.write(" " + liney)
- if "*+*+* Players +*+*" in liney:
- break
- elif mush == "SRTMOO":
- out_file.write("*'''Log: " + log[:-4] + "'''\n" + \
- "*'''Cast:''' ")
- out_file.write(', '.join(cast))
- out_file.write("\n*'''Where:''' \n" + \
- "*'''OOC - IC Date:''' \n" + \
- "*'''Summary''': ''<Summarize!>''\n\n" + \
- "----\n")
- if displaydesc == 1:
- out_file.write("\n")
- for liney in roomdesc:
- out_file.write(" " + liney)
- if liney.startswith("BGM: "):
- break
- for linex in poses:
- out_file.write(linex)
- #Timestamps obtained from https://www.epochconverter.com/
- if mush == "DC":
- if (loglastedited - 54000) < 1503273600: #End of Chapter 1 Act 1: August 20th, 2017 (or thereabouts)
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 1]]\n[[Category:Chapter 1, Act 1]]")
- elif (loglastedited - 54000) < 1520272800: #End of Chapter 1 Act 2: March 4th, 2018
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 1]]\n[[Category:Chapter 1, Act 2]]")
- elif (loglastedited - 54000) < 1535907600: #End of Chapter 1 Act 3: September 1st, 2018
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 1]]\n[[Category:Chapter 1, Act 3]]")
- elif (loglastedited - 54000) < 1545588000: #End of Chapter 1 Act 4: December 22nd, 2018
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 1]]\n[[Category:Chapter 1, Act 4]]")
- elif (loglastedited - 54000) < 1553277600: #End of Chapter 1: March 14th, 2019
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 1]]\n[[Category:Chapter 1, Epilogue]]")
- elif (loglastedited - 54000) < 1571082593: #End of Chapter 2 Act 1: October 13th, 2019
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 2]]\n[[Category:Chapter 2, Act 1]]")
- elif (loglastedited - 54000) < 1601292630: #End of Chapter 2 Act 2: September 28th, 2020
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 2]]\n[[Category:Chapter 2, Act 2]]")
- elif (loglastedited - 54000) < 1627790400: #End of Chapter 2 Act 3: July 31st, 2021
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 2]]\n[[Category:Chapter 2, Act 3]]")
- elif (loglastedited - 54000) < 1682253030: #End of Chapter 2 Act 4: April 22nd, 2023
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 2]]\n[[Category:Chapter 2, Act 4]]")
- elif (loglastedited - 54000) < 1702817999: #End of Chapter 2: December 17th, 2023
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 2]]\n[[Category:Chapter 2, Epilogue]]")
- else:
- out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 3]]\n[[Category:Chapter 3, Act 1]]")
- elif mush == "M3":
- pass
- elif mush == "BF":
- out_file.write("\n[[Category:Logs]]\n")
- elif mush == "SRTMOO":
- if (loglastedited - 54000) < 1656288000: #End of Phase 1 Turn 1: August 26th, 2022 (or thereabouts)
- out_file.write("\n[[Category:Logs]]\n[[Category:Phase 1]]\n[[Category:Phase 1, Turn 1]]")
- elif (loglastedited - 54000) < 1675818000: #End of Phase 1 Turn 2: February 7th, 2023 (or thereabouts)
- out_file.write("\n[[Category:Logs]]\n[[Category:Phase 1]]\n[[Category:Phase 1, Turn 2]]")
- elif (loglastedited - 54000) < 1704067200: #End of Phase 1 Turn 3: December 31st, 2023
- out_file.write("\n[[Category:Logs]]\n[[Category:Phase 1]]\n[[Category:Phase 1, Turn 3]]")
- elif (loglastedited - 54000) < 1713744000: #End of Phase 1 Special Disc: April 21st, 2024
- out_file.write("\n[[Category:Logs]]\n[[Category:Phase 1]]\n[[Category:Phase 1 Special Disc]]")
- else:
- out_file.write("\n[[Category:Logs]]\n[[Category:Phase 2]]\n[[Category:Phase 2, Turn 1]]")
- if bluraycount:
- print(" Bluray marks detected: " + str(bluraycount))
- logsedited += 1
- poses = []
- cast = []
- logdate = ""
- location = ""
- roomdesc = []
- bluraycount = 0
- except FileNotFoundError:
- print("Can't create write file? Maybe there's no Edited Logs folder.")
- except FileNotFoundError:
- print("File not found. Hm.")
- except FileNotFoundError:
- print("No files found in Raw Logs folder, or no Raw Logs folder found, probably.")
- print("Logs left alone: " + str(logsleftalone))
- print("Logs edited: " + str(logsedited))
- print(" ")
- input("Thank you for using LOG MUNCHER! Press Enter to exit.")
- ####### F.A.Q. #######
- # Q. I found a bug! LOG MUNCHER isn't eating something it should probably eat!
- # A. Look if it's not in Known Issues first, and if not, contact staff -- we'll see if we can tweak something or contact Rosaline's player about it.
- # It would be very helpful if you could supply us with the raw, SPECIFIC text that seems to cause a problem. The appbox or a pastebin link would be best!
- #
- # Q. I wish friendly, hungry cybersaur LOG MUNCHER had this feature!
- # A. @mail or page us and we'll see what we can do! Rosaline's player graciously gave us permission to edit but staff only knows enough Python to get by -- but it could be a good learning opportunity!
- #
- # Q. I know some code. Can I adapt LOG MUNCHER to do a thing, such as work on a currently unsupported MU*?
- # A. Sure! LOG MUNCHER is open source. If you give us your code, we might even use it to improve the official LOG MUNCHER.
- # (Just don't mind the mess!)
- ####### KNOWN ISSUES #######
- # -Pre-scene OOC lounge chatter will be kept in if it involves comsys tomfoolery
- # STATUS: Fixable but low-priority, since this comes up rarely and the edit is usually very simple
- # -Some messages that will NOT ALWAYS be filtered out, and must be edited out manually:
- # -people moving from one room to another
- # STATUS: Potentially unfixable :(
- # -people's descs
- # STATUS: Potentially unfixable :(
- # -some clients' connect message if you reconnect mid-scene
- # STATUS: This latter one is fixable, but you'll need to tell me what your connect message is!
- # -Some messages that will sometimes MISTAKENLY be filtered out, and must be edited back in:
- # -Pose paragraphs starting with "From afar" (confused with a page message)
- # -Pose paragraphs including the sentence "heads over to" (confused with someone moving to another room)
- # STATUS: Trying to figure out a solution to both, whatever it is will likely not be perfect.
- # -Digger results readouts that break the buffer cause OOC messages to remain in
- # STATUS: The bug is potentially unfixable on my end, and more dependent on the MUSH's side.
- # -Editing several logs at once will sometimes fuse them. What the heck!
- # STATUS: Can't reproduce. More data needed!
- # -The Muncher window won't stay open for some people.
- # STATUS: Can't reproduce. More data needed!
- #
- # --> DO tell me if the script forgets to eat something not covered here/eats the wrong thing.
- # If possible, send me the specific message.
- #
- # Thank you for using LOG MUNCHER!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement