Advertisement
Fredison

LOG MUNCHER 1.4.81

Apr 3rd, 2017
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 33.35 KB | None | 0 0
  1. # coding: utf-8
  2.  
  3. #
  4. # "I'm Metal Digger Locus, and this is my favorite log-editing script!" -Metal Digger Locus
  5. #
  6. #______                    ______  ___                   ______              
  7. #___  / _____________ _    ___   |/  /___  _________________  /______________
  8. #__  /  _  __ \_  __ `/    __  /|_/ /_  / / /_  __ \  ___/_  __ \  _ \_  ___/
  9. #_  /___/ /_/ /  /_/ /     _  /  / / / /_/ /_  / / / /__ _  / / /  __/  /    
  10. #/_____/\____/_\__, /      /_/  /_/  \__,_/ /_/ /_/\___/ /_/ /_/\___//_/     1.4.81
  11. #             /____/                                                        
  12.  
  13. # LOG MUNCHER is a script meant to automate 90% of MUSH log editing.
  14. # 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.
  15. # LOG MUNCHER will also take care of minor tasks for you, like format italics and organize your participants list!
  16. # LOG MUNCHER is currently compatible with logs from Dream Chasers, Mega Man MUSH and Battle Fantasia.
  17.  
  18. ####### INSTRUCTION MANUAL #######
  19.  
  20. # -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:
  21. #   For DC: &pot_spoof me=1
  22. #   For M3: &config`setting`pot_spoof me=1
  23. #   Unfortunately, logs taken before you turned this setting on can't be parsed by Log Muncher. :(
  24. # -Have Python on your computer! (https://www.python.org/downloads/) I did this in 3.7.2 though earlier versions may still work.
  25. # -Copy-paste ALL of this text into a Python script file (You can call it whatever, so long as it has the ".py" extension)
  26. # -Put the script file in some folder
  27. # -Create a folder named "Raw Logs" and a folder named "Edited Logs" in the same directory as the script file
  28. # -Put the logs you want to clean into the Raw Logs folder
  29. # -Look down at the "Options Menu" section just below, and make sure everything is to your liking!
  30. # -~* BE SURE TO SET THE CORRECT MUSH VARIABLE, JUST BELOW *~
  31. # -Run the script and LET THE MAGIC HAPPEN
  32. # -Hopefully nothing explodes! Tell me if it does.
  33.  
  34.  
  35. ####### THE OPTIONS MENU #######
  36. # SAILOR CERI SAYS: Please do NOT remove this part! The script won't run if you do!
  37.  
  38. mush = "DC"           # Which game are these logs for? DC = Dream Chasers MUSH, M3 = Mega Man MUSH, BF = Battle Fantasia MUSH
  39. displaydesc = 1       # Will display the room desc at the beginning of your log. Set to 0 to turn off. Might miss some formats.
  40. replaceitalics = 1    # Replaces slashes with double apostrophes (the wiki code for italics!)
  41. stopwikiweirdness = 1 # Replaces some characters (<, >, * and ~) with things the wiki isn't allergic to.
  42. maxlength = 120       # The maximum length, in characters, for comsys/radio messages before they wrap around
  43. blurayediting = 1     # Will include in the log lines containing words in the customizable list below, to help editing.
  44. bluraylist = ["bluray", "blu-ray", "blue-ray", "blue ray", "fix it in post"]  # Feel free to add your own!
  45. bluraywarning = 1     # If set to 1, will put a BIG NOTE at the beginning of the log telling you to check for bluray edits.
  46. #minushours = ???
  47.  
  48. # SAILOR CERI REITERATES: Please do NOT remove this part! The script won't run if you do!
  49.  
  50.  
  51. import re
  52. import os
  53. import textwrap
  54. import sys
  55. import time
  56.  
  57. logsedited = 0
  58. logsleftalone = 0
  59.  
  60. logging = 0
  61. isthisapose = 0  #0 = not a pose, 1 = pose body, 2 = nospoof header
  62. sortoflogging = 0
  63. startpose = 0
  64.  
  65. nospoof = re.compile("(?<=^<Pose Tracker> )(.*)(?= has posed\.$)")
  66.  
  67. if mush == "DC":
  68.     whitelist = ["<* CHALLENGE -", " |Dungeon Ability: ", "< Challenge Information: >", "=Dungeon Condition: ",
  69.                  "< Results -"]
  70.     comsysprefixes = ["GS: ", "DG: ", "DC: "]
  71.     radiolist = []
  72.     banlist = ["+=======", "========", "--------", "..................", \
  73.                "This world is Pueblo ", "Logging to file ", "Logging Started: ", \
  74.                "[OOC] ", "[BBS] ", "[JOBS] ", "[WATCH] ", "[GRID] ", "[FLIP] ", "[HELP] ", "MAIL: ", "[FCLIST] ", "[FINGER] ", \
  75.                "(New BB Message (", "<GROUP BB> ", "+vote: ", "+Vote: ", "+votes: ", " +pot/soundtrack:", \
  76.                "<Guest> ", "<Public> ", "<Ask-Staff> ", "<Discussion> ", "<Entertainment> ", "<RP Finder> ", "<Spoilers> ", \
  77.                "<Big Scene>", "<O-", \
  78.                "You will no longer hear messages on channel ", "You will now hear messages on channel ", \
  79.                "--- Disconnected", "--- Connected", \
  80.                "You paged ", "From afar, ", "From afar (to ", "Long distance to ", \
  81.                "You start your posting to Board #", "Player Name          On For   Idle  Doing", \
  82.                "Huh? (Type ", "I don't see that here.", \
  83.                "DG: That's not a valid party leader.", "DG: You've already acted for this"]
  84.     banlist_nonprefix = [" pages: ", " has connected.\n", " has disconnected.\n", " has partially disconnected.\n",
  85.                          " has reconnected.\n", " heads over from ", " heads over to ", " has left.\n", " has arrived.\n",
  86.                          " just looked at you.\n", "'s last pose:"]
  87.     comsys_narcissism = [" fully healed ", "party information reset", "Exhaustion reset", \
  88.                         "You've readied your Tool", "You use your Tool", \
  89.                         "DG: You pass the challenge,", "DG: You fail the challenge,", \
  90.                         "GS: Freeattacks wiped from your current mode.", " has been added to slot ",
  91.                         " Please provide a more specific Tool.", "DG: You can't load that many tools!",
  92.                         "DG: You've unloaded your Tool,", "DG: You've already acted for this turn.",
  93.                         "DG: You don't have a party leader right now!",
  94.                         "You must use a Basic Action that matches the Challenge's Dungeon Ability.",
  95.                         "You have created a party! Your Digger status has been reset!",
  96.                         "Not everyone in the party has acted yet.",
  97.                         " has joined your party!",
  98.                         " has created a party! To join, type +party/reset and then type +party/join "]
  99. elif mush == "M3":
  100.     whitelist = ["hey there, I hope you're enjoying LOG MUNCHER! this is a placeholder message"]
  101.     comsysprefixes = ["COMBAT:"]
  102.     radiolist = ["<Radio: A - ", "<Radio: B - ", "<Radio: C - ", "<Radio: D - ", \
  103.                  "<Radio: E - ", "<Radio: F - ", "<Radio: G - ", "<Radio: H - ", \
  104.                  "<Radio> You intercept a transmission to ", \
  105.                  "<Live> ", "<Radio> Tightbeam "] #Add the rest of the alphabet soup yourself if you play an interceptor!
  106.     banlist = ["_______", "========", "--------", \
  107.                "This world is Pueblo ", "Logging to file ", "Logging Started: ", \
  108.                "[OOC] ", "MAIL: ", "SAVE: ", "WF: ", "GAME: ", "CHAT: ", \
  109.                "(New BB Message", "(New BB message ", "+vote: ", \
  110.                "<Guests> ", "<Public> ", "<Discussions> ", "<Q-Spoilers> ", "<Fandom> ", \
  111.                "<O-", "<Munchkinery> ", "<NC-X-17+> ", "<RP!> ", "<Hard Nerd> ", "<Altchars>", \
  112.                "<B-Music> ", "<ElseMUSH> ", "<Staff Hotline> ", "<Tech> ", "<Workouts> ", \
  113.                "You will no longer hear messages on channel ", "You will now hear messages on channel ", \
  114.                "--- Disconnected", "--- Connected", "There's no place like home...", \
  115.                "You paged ", "From afar, ", "From afar (to ", "Long distance to ", \
  116.                "You start your posting to Board #", "Player Name          On For   Idle  Doing", \
  117.                "Huh?  (Type ", "I don't see that here.", "Your description has been changed to ", \
  118.                "You have earned ", "P1 WINS.", "You are out of +cookies for the week.", "You hand ", \
  119.                "Type their full name to +cookie someone.", \
  120.                "You don't have the Buster ability."]
  121.     banlist_nonprefix = [" pages: ", " has connected.\n", "has disconnected.\n", " has partially disconnected.\n",
  122.                       " has reconnected.\n", " heads over from ", " heads over to ", " has left.\n", " has arrived.\n",
  123.                       " just looked at you."
  124.                       " flips a coin in the air and it comes down ", " has been set as your armor ",
  125.                       " hands you a cookie for a job well done!"]
  126.     comsys_narcissism = [" has reset their systems to full.", " has been added to slot ",
  127.                          " has been added to your queue.",
  128.                          "You take more damage due to your system weaknesses.",
  129.                          "You take less damage due to your system weaknesses.",
  130.                          " points of damage taken!", " life energy left!", "COMBAT: Your attack has been added to ",
  131.                          "You have set yourself to be automatically grabby-handed by a weapon copy user.",
  132.                          "You do not appear to have an armor in the a slot.",
  133.                          " weapon energy available!", " weapon energy to you.", " You have healed ",
  134.                          " to your current status effects.", " You do not have any general attacks setup yet.",
  135.                          " has been set on your ", "Data doesn't like it when people try to skip in line at the buffet."]
  136. elif mush is "BF":
  137.     whitelist = ["hey there, I hope you're enjoying LOG MUNCHER! this is a placeholder message"]
  138.     comsysprefixes = ["COMBAT: ", "BEAMWAR: ", "OOC: ", "DICE: ", "COIN FLIP: ",]
  139.     radiolist = ["<I-"]
  140.     banlist = ["*+*+*+*+*+", ".********", "|********", ".*+*+*+*+*", "'***********", "==========", "-------------", \
  141.                "This world is Pueblo ", "Logging to file ", "Logging Started: ", \
  142.                "[OOC] ", "+help", "ALERT: ", "MAIL: ", "+watchfor: ", "GAME: ", \
  143.                "There are no unread postings on the Global Bulletin Board.", "Your bbpost has been discarded.",
  144.                "Text added to bbpost.", "+vote: ", "+sparkle: ", "+finger: ", "+queue: ", "+soundtrack: ", "+freeattack/set: ", \
  145.                "+freeattack/wipe: ", "+heal/boss: ", \
  146.                "<Guests> ", "<Public> ", "<Ask-Staff> ", "<Discussion> ", "<Entertainment> ", "<LFRP> ", \
  147.                "<Spoilers> ", "<Cooking>", "<Characters>", "<Fitness>", "<O-DF>", "<O-Infinity>", "<O-Ends>", "<O-MA>", \
  148.                "<O-Tuners>", "<O-Juuban>", "<O-Ohtori>", \
  149.                "You will no longer hear messages on channel ", "You will now hear messages on channel ",  "Logging to file", \
  150.                "You can't do that.", "--- Connected", \
  151.                "You paged ", "From afar, ", "From afar (to ", "Long distance to ", \
  152.                "You start your posting to Board #", "Player Name          On For   Idle", \
  153.                "Huh? (Type ", "I don't see that here.", \
  154.                "ALERT: You are now able"]
  155.     banlist_nonprefix = [" has cancelled their", " could match more than one player."," doesn't have an incoming attack",
  156.                          "has not concluded their actions.  Reactions are not yet available.\n", " pages: ", " has connected.\n",
  157.                          "has disconnected.\n", " has partially disconnected.\n", " just looked at you.",
  158.                          " has reconnected.\n", " heads over from ", " heads over to ", " has left.\n", " has arrived.\n",]
  159.     comsys_narcissism = [" fully healed ", " has gone to Tokyo with +tokyo.", "COMBAT: Your next attack will not",
  160.                          "COMBAT: Player not found.", "COMBAT: You can only attack people in the same room as you.",
  161.                          "COMBAT: You can't", "COMBAT: No one by that name", "COMBAT: Your combo will",
  162.                          "COMBAT: You haven't started a combo", "COMBAT: You can only", "COMBAT: Player not found.",
  163.                          "COMBAT: You've found a bug.", "COMBAT: You must use",
  164.                          "COMBAT: You are already in a BEAMWAR, and may only be in one at a time.",
  165.                          "COMBAT: Without the barrier flag, only a ",
  166.                          "COMBAT: The entered attack name could match more than one available attack.",
  167.                          "COMBAT: Unrecognized attack.  Please check for typos in the attack name entered.",
  168.                          "COMBAT: You cannot use an attack with a TEAM flag with +counter.  Please see +help +combo.",
  169.                          "COMBAT: You cannot use an attack with the Item Grab flag with +counter.  Please see +help Items.",
  170.                          "COMBAT: You don't have",
  171.                          "COMBAT: Your next attack will not KO your opponent(s) (unless +accept is used).",
  172.                          "COMBAT: Please use +accept ", "COMBAT: You cannot ", "COMBAT: You don't have",
  173.                          " has finished attacking."]
  174.  
  175. if blurayediting == 1:
  176.     whitelist.extend(bluraylist)
  177.  
  178. log = []
  179. cast = []
  180. logdate = ""
  181. location = ""
  182. roomdesc = []
  183.  
  184.  
  185. if mush == "DC":
  186.     usualheader = "====<* "
  187.     locationban = "==<* Inn of the Last Home *>=="
  188.     quietroom   = "==<* Big Bridge *>=="
  189.     roomevidence = "------< Players >------"
  190. elif mush == "M3":
  191.     usualheader = "======="
  192.     locationban = "OOC Lounge"
  193.     quietroom   = "Quiet Room"
  194.     roomevidence = "--- Contents ---"
  195. elif mush is "BF":
  196.     usualheader = "+*+*+*+ "
  197.     locationban = "OOC Lounge - The Great Cake"
  198.     quietroom   = "Quiet Room - Parfait of Silence"
  199.     roomevidence = "+*+*+* Players +*+*+*"
  200.  
  201. mightbelocation = ""
  202. mightberoomdesc = []
  203.  
  204. thisisnowaresultsscreen = 0
  205. bluraycount = 0
  206.  
  207. poses = []
  208. previousline = ""
  209. previousroomline = ""
  210.  
  211. print(" ")
  212. print("WELCOME TO...")
  213. print(" ")
  214. print("______                    ______  ___                   ______")
  215. print("___  / _____________ _    ___   |/  /___  _________________  /______________")
  216. print("__  /  _  __ \_  __ `/    __  /|_/ /_  / / /_  __ \ ___/_  __ \ _ \_  ___/")
  217. print("_  /___/ /_/ /  /_/ /     _  /  / / / /_/ /_  / / / /__ _  / / /  __/  /")
  218. print("/_____/\____/_\__, /      /_/  /_/  \__,_/ /_/ /_/\___/ /_/ /_/\___//_/")
  219. print("             /____/")
  220. print(" ")
  221. print(" (!) Don't forget to double-check your munched logs before posting! MUNCHERCORP")
  222. print("     will NOT be held responsible if your embarrassing pages end up on the wiki.")
  223. print(" ")
  224. print("\"I'm Metal Digger Locus, and this is my favorite log-editing script!\"")
  225. print("                                            - Metal Digger Locus")
  226. print(" ")
  227.  
  228. try:
  229.     for log in os.listdir("./Raw Logs/"):
  230.  
  231.         if os.path.isfile("./Edited Logs/" + log):
  232.             logsleftalone += 1
  233.         else:
  234.             print("Now editing: " + log)
  235.             try:
  236.                 with open ("./Raw Logs/" + log, 'rt') as in_file:
  237.                     loglastedited = os.path.getmtime("./Raw Logs/" + log)
  238.                     logdate = time.strftime("%B %d, %Y", time.gmtime(loglastedited - 54000))
  239.                    
  240.                     for line in in_file:
  241.                         for banitem in banlist:
  242.                             if line.startswith(banitem):
  243.                                 if (thisisnowaresultsscreen == 1):
  244.                                     break
  245.                                 if usualheader in line and locationban not in line and quietroom not in line:
  246.                                     mightbelocation = line
  247.                                     sortoflogging = 1
  248.                                 elif sortoflogging == 1 and roomevidence in line:
  249.                                     location = mightbelocation
  250.                                     roomdesc = mightberoomdesc
  251.                                     sortoflogging = 0
  252.                                     mightberoomdesc = []
  253.                                 else:
  254.                                     sortoflogging = 0
  255.                                     mightberoomdesc = []
  256.                                 logging = 0
  257.                                 if isthisapose == 1 and mush == "DC":
  258.                                     poses.append("</poem>\n")
  259.                                 isthisapose = 0
  260.                                 break
  261.                         for ughitem in banlist_nonprefix:
  262.                             if ughitem in line:
  263.                                 if isthisapose == 1 and mush == "DC":
  264.                                     poses.append("</poem>\n")
  265.                                 logging = 0
  266.                                 isthisapose = 0
  267.                                 sortoflogging = 0
  268.                                 mightberoomdesc = []
  269.                                 break
  270.                         if nospoof.search(line):
  271.                             if mush == "DC":
  272.                                 if not "[[Character :: " + line[15:-12] + "]]" in cast:
  273.                                     cast.append("[[Character :: " + line[15:-12] + "]]")
  274.                             elif mush == "M3":
  275.                                 if "]" in line:
  276.                                     if not line[15:-16] in cast:
  277.                                         cast.append(line[15:-16])
  278.                                 else:
  279.                                     if not line[15:-12] in cast:
  280.                                         cast.append(line[15:-12])
  281.                             elif mush is "BF":
  282.                                 if not "[[" + line[15:line.find(" [") - len(line)] + "]]" in cast:
  283.                                     cast.append("[[" + line[15:line.find(" [") - len(line)] + "]]")
  284.                             logging = 1
  285.                             startpose = 1
  286.                         for whiteitem in whitelist:
  287.                             if whiteitem in line:
  288.                                 if isthisapose == 1 and mush == "DC":
  289.                                     poses.append("</poem>\n")
  290.                                 isthisapose = 0
  291.                                 logging = 1
  292.                                 sortoflogging = 0
  293.                                 mightberoomdesc = []
  294.                                 if blurayediting == 1:
  295.                                     for blueitem in bluraylist:
  296.                                         if blueitem in line:
  297.                                             bluraycount += 1
  298.                         for prefix in comsysprefixes:
  299.                             if line.startswith(prefix):
  300.                                 if isthisapose == 1 and mush == "DC":
  301.                                     poses.append("</poem>\n")
  302.                                 isthisapose = 0
  303.                                 logging = 1
  304.                                 sortoflogging = 0
  305.                                 mightberoomdesc = []
  306.                                 for myitem in comsys_narcissism:
  307.                                     if myitem in line:
  308.                                         logging = 0
  309.                                         break
  310.                         for radiotype in radiolist:
  311.                             if line.startswith(radiotype):
  312.                                 if isthisapose == 1 and mush == "DC":
  313.                                     poses.append("</poem>\n")
  314.                                 isthisapose = 0
  315.                                 logging = 1
  316.                                 sortoflogging = 0
  317.                                 mightberoomdesc = []
  318.  
  319.                         if logging == 1:
  320.                             if ("<* CHALLENGE -" in line):
  321.                                 if not previousline.isspace():
  322.                                     poses.append("\n")
  323.                                 poses.append(" " + previousroomline)
  324.                             elif ("< Results -" in line):
  325.                                 if not previousline.isspace():
  326.                                     poses.append("\n")
  327.                                 poses.append(" " + previousroomline)
  328.                                 thisisnowaresultsscreen = 1
  329.                             elif ("===< Dream Chasers >===" in line):
  330.                                 thisisnowaresultsscreen = 0
  331.                             elif (nospoof.search(line) != None):
  332.                                 if isthisapose == 1 and mush == "DC":
  333.                                     poses.append("</poem>\n")
  334.                                 isthisapose = 2
  335.                             else:
  336.                                 for prefix in comsysprefixes:
  337.                                     if line.startswith(prefix):
  338.                                         if not previousline.startswith(prefix) and not previousline.isspace():
  339.                                             if isthisapose == 1 and mush == "DC":
  340.                                                 poses.append("</poem>\n")
  341.                                             poses.append("\n")
  342.                                             isthisapose = 0
  343.                                 for radiotype in radiolist:
  344.                                     if line.startswith(radiotype):
  345.                                         if not previousline.startswith(radiotype) and not previousline.isspace():
  346.                                             if isthisapose == 1 and mush == "DC":
  347.                                                 poses.append("</poem>\n")
  348.                                             poses.append("\n")
  349.                                             isthisapose = 0                                            
  350.                             if isthisapose == 0:
  351.                                 if len(line) > maxlength:
  352.                                     for subline in textwrap.wrap(line, maxlength):
  353.                                         poses.append(" " + subline + "\n")
  354.                                 else:
  355.                                     poses.append(" " + line)
  356.                             elif isthisapose == 2:
  357.                                 if not previousline.isspace():
  358.                                     poses.append("\n")
  359.                                 if mush == "M3":
  360.                                     poses.append("\n")
  361.                                 poses.append(" " + line)
  362.                                 isthisapose = 1
  363.                             elif isthisapose == 1:
  364.                                 if line.startswith("<SoundTracker> "):
  365.                                     line = " " + line
  366.                                     poses.append(line)
  367.                                 else:
  368.                                     if replaceitalics == 1 and line.count("/"):
  369.                                         if not (line.count("/") % 2):
  370.                                             line = line.replace("/", "''")
  371.                                     if stopwikiweirdness == 1:
  372.                                         line = line.replace("*", "&#42;")
  373.                                         line = line.replace("<", "&lt;")
  374.                                         line = line.replace(">", "&gt;")
  375.                                         line = line.replace("\t", "    ")
  376.                                         line = line.replace("~~~", "<nowiki>~~~</nowiki>")
  377.                                    
  378.                                     if startpose == 1:
  379.                                         if mush == "DC":
  380.                                             poses.append("<poem>" + line)
  381.                                         startpose = 0
  382.                                     else:
  383.                                         poses.append(line)
  384.                             previousline = line
  385.                         if sortoflogging == 1:
  386.                             if line != previousroomline:
  387.                                 mightberoomdesc.append(line)
  388.                             previousroomline = line
  389.  
  390.                     try:
  391.                         with open ("./Edited Logs/" + log, 'wt') as out_file:
  392.                             if bluraywarning and bluraycount:
  393.                                 out_file.write("\n<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
  394.                                 if bluraycount == 1:
  395.                                     out_file.write("Check your log for bluray editing! " + str(bluraycount) + " mark was detected!\n")
  396.                                 else:
  397.                                     out_file.write("Check your log for bluray editing! " + str(bluraycount) + " marks were detected!\n")
  398.                                 out_file.write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->\n\n")
  399.                             if mush == "DC":
  400.                                 out_file.write("*'''Log: " + log[:-4] + "'''\n" + \
  401.                                                 "*'''Cast:''' ")
  402.                                 out_file.write(', '.join(cast))
  403.                                 out_file.write("\n*'''Where:''' " + location.rstrip(" *>=\n").lstrip("=<* ") + "\n" + \
  404.                                               "*'''Date:''' " + logdate + "\n" + \
  405.                                               "*'''Summary''': ''<Summarize!>''\n\n" + \
  406.                                               "----\n")
  407.                                 if displaydesc == 1:
  408.                                     out_file.write("\n")
  409.                                     for liney in roomdesc:
  410.                                         out_file.write(" " + liney)
  411.                                         if liney.startswith("BGM: "):
  412.                                             break
  413.                             elif mush == "M3":
  414.                                 out_file.write("{{Infobox Log\n" + \
  415.                                                "|title=" + log[:-4] + "\n" + \
  416.                                                "|recap=\n" + \
  417.                                                "|rldate=" + logdate + "\n" \
  418.                                                "|icdate=YYYY-MM-DD\n" + \
  419.                                                "|storyarc=\n" + \
  420.                                                "|scenetype=\n" + \
  421.                                                "|participants=")
  422.                                 out_file.write(', '.join(cast))
  423.                                 out_file.write("\n|location=" + location.rstrip(" =\n").lstrip("= ") + "\n}}\n\n")
  424.  
  425.                                 if displaydesc == 1:
  426.                                     out_file.write("\n")
  427.                                     for liney in roomdesc:
  428.                                         out_file.write(" " + liney)
  429.                             elif mush is "BF":
  430.                                 out_file.write('{|class="toccolours" cellspacing="2"\n' + \
  431.                                                "|-\n" + \
  432.                                                '! style="background:#CC6699; border: 2px #CC0033 solid; font-size: 110%;" align="center" colspan="2" | ' + \
  433.                                                "'''Title: " + log[:-4] + "'''" + "\n" + \
  434.                                                "|-\n" + \
  435.                                                "|'''Summary''':<br>\n" + \
  436.                                                "''<The summary>''\n" + \
  437.                                                "|-\n" + \
  438.                                                "|'''Who''':<br>\n")
  439.                                 out_file.write(', '.join(cast))
  440.                                 out_file.write("\n" + \
  441.                                                "|-\n" + \
  442.                                                "|'''Where:'''<br>\n")
  443.                                 out_file.write(location.rstrip(" +*\n").lstrip("*+ ") + "\n}}\n\n")
  444.                                 out_file.write("|-\n" + \
  445.                                                "|'''OOC - IC Date:'''<br>\n")
  446.                                 if logdate:
  447.                                     out_file.write(logdate + " - <IC Date>\n")
  448.                                 else:
  449.                                     out_file.write("<OOC Date> - <IC Date>\n")
  450.                                 out_file.write("|-\n" + \
  451.                                                "|}\n")
  452.                                 if displaydesc is 1:
  453.                                     out_file.write("\n")
  454.                                     for liney in roomdesc:
  455.                                         out_file.write(" " + liney)
  456.                                         if "*+*+* Players +*+*" in liney:
  457.                                             break
  458.  
  459.                             for linex in poses:
  460.                                 out_file.write(linex)
  461.  
  462.                             #Timestamps obtained from https://www.epochconverter.com/
  463.                             if mush == "DC":
  464.                                 print(loglastedited)
  465.                                 print(loglastedited - 54000)
  466.                                 if (loglastedited - 54000) < 1503273600:      #End of Act 1: August 20th, 2017 (or thereabouts)
  467.                                     out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 1]]\n[[Category:Chapter 1, Act 1]]")
  468.                                 elif (loglastedited - 54000) < 1520272800:    #End of Act 2: March 4th, 2018
  469.                                     out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 1]]\n[[Category:Chapter 1, Act 2]]")
  470.                                 elif (loglastedited - 54000) < 1535907600:    #End of Act 3: September 1st, 2018
  471.                                     out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 1]]\n[[Category:Chapter 1, Act 3]]")
  472.                                 elif (loglastedited - 54000) < 1545588000:    #End of Act 4: December 22nd, 2018
  473.                                     out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 1]]\n[[Category:Chapter 1, Act 4]]")
  474.                                 elif (loglastedited - 54000) < 1553277600:    #End of Chapter 1: March 14th, 2019
  475.                                     out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 1]]\n[[Category:Chapter 1, Epilogue]]")
  476.                                 else:
  477.                                     out_file.write("\n[[Category:Logs]]\n[[Category:Chapter 2]]\n[[Category:Chapter 2, Act 1]]")
  478.                             elif mush == "M3":
  479.                                 pass
  480.                             elif mush is "BF":
  481.                                 out_file.write("\n[[Category:Logs]]\n")
  482.  
  483.                             if bluraycount:
  484.                                 print("  Bluray marks detected: " + str(bluraycount))
  485.  
  486.                             logsedited += 1
  487.                             poses = []
  488.                             cast = []
  489.                             logdate = ""
  490.                             location = ""
  491.                             roomdesc = []
  492.                             bluraycount = 0
  493.                            
  494.                     except FileNotFoundError:
  495.                         print("Can't create write file? Maybe there's no Edited Logs folder.")
  496.  
  497.             except FileNotFoundError:
  498.                 print("File not found. Hm.")
  499.        
  500. except FileNotFoundError:
  501.     print("No files found in Raw Logs folder, or no Raw Logs folder found, probably.")
  502.  
  503. print("Logs left alone: " + str(logsleftalone))
  504. print("Logs edited: " + str(logsedited))
  505. print(" ")
  506. input("Thank you for using LOG MUNCHER! Press Enter to exit.")
  507.  
  508.  
  509. ####### F.A.Q. #######
  510.  
  511. # Q. I found a bug! LOG MUNCHER isn't eating something it should probably eat!
  512. # A. Look if it's not in Known Issues first, and if not, @mail Rosaline on Dream Chasers!
  513. #    It would be very helpful if you could supply me with the raw, SPECIFIC text that seems to cause a problem.
  514. #
  515. # Q. I wish friendly, hungry cybersaur LOG MUNCHER had this feature!
  516. # A. @mail or page me and I'll consider adding it!
  517. #
  518. # Q. I know some code. Can I adapt LOG MUNCHER to do a thing, such as work on a currently unsupported MU*?
  519. # A. Sure! LOG MUNCHER is open source. If you give me your code, I might even use it to improve the official LOG MUNCHER.
  520. #    (Just don't mind the mess!)
  521.  
  522.  
  523. ####### KNOWN ISSUES #######
  524.  
  525. # -Pre-scene OOC lounge chatter will be kept in if it involves comsys tomfoolery
  526. #    STATUS: Fixable but low-priority, since this comes up rarely and the edit is usually very simple
  527. # -Some messages that will NOT ALWAYS be filtered out, and must be edited out manually:
  528. #       -people moving from one room to another
  529. #          STATUS: Potentially unfixable :(
  530. #       -people's descs
  531. #          STATUS: Potentially unfixable :(
  532. #       -some clients' connect message if you reconnect mid-scene
  533. #          STATUS: This latter one is fixable, but you'll need to tell me what your connect message is!
  534. # -Some messages that will sometimes MISTAKENLY be filtered out, and must be edited back in:
  535. #       -Pose paragraphs starting with "From afar" (confused with a page message)
  536. #       -Pose paragraphs including the sentence "heads over to" (confused with someone moving to another room)
  537. #          STATUS: Trying to figure out a solution to both, whatever it is will likely not be perfect.
  538. # -Digger results readouts that break the buffer cause OOC messages to remain in
  539. #    STATUS: The bug is potentially unfixable on my end, and more dependent on the MUSH's side.
  540. # -Editing several logs at once will sometimes fuse them. What the heck!
  541. #    STATUS: Can't reproduce. More data needed!
  542. # -The Muncher window won't stay open for some people.
  543. #    STATUS: Can't reproduce. More data needed!
  544. #
  545. # --> DO tell me if the script forgets to eat something not covered here/eats the wrong thing.
  546. #     If possible, send me the specific message.
  547. #
  548. # Thank you for using LOG MUNCHER!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement