Browse Source

Started on lb4convert command.

master
Gisle Aune 7 years ago
parent
commit
3a01739eb7
  1. 55
      cmd/lb4convert/2016-12-28_201003477_#RedrockAgency.txt
  2. 98
      cmd/lb4convert/logfile.go
  3. 46
      cmd/lb4convert/logfile_test.go
  4. 16
      cmd/lb4convert/main.go

55
cmd/lb4convert/2016-12-28_201003477_#RedrockAgency.txt

@ -0,0 +1,55 @@
ACTION Va`ynna_Atana 20:10:03 NPC Ehanis_Tioran :arrives at the Agency's office the afternoon after the Respite incident she fortunately was not a part of. It did, however, mean that chances to speak with Jason will be fewer for a while, so she had to do it now. She looks around the lobby to see if anyone is around in it or the hallway. She's wearing her navy-blue jacket over a dark-red shirt and black jeans, which is insufficient for the winter weather
DATE 2016-12-28 20:10:03
ACTION Va`ynna_Atana 20:10:03 NPC Ehanis_Tioran :outside. After being instructed by Fergus, she hangs up her jacket and makes her way down to his office door and just stands there for a moment. A few moments pass before she hits the door interface.
ACTION Jason_Wolfe 20:16:35 NPC Dante :is stood in his office. His door is open and he's mounting his Revenant back in place. He's still dressed in his hardsuit, though his helmet and gauntlets are on his desk. "My Lord. Ser Atana is requesting an audience with you." Fergus' voice chirps over the intercom. As he locks his Revenant into place on the mounting brackets, Jason gives a glance upwards, "Old Atana or young Atana?" he asks, though given the occurrances
ACTION Jason_Wolfe 20:16:35 NPC Dante :of the day, he suspects the latter. "Va'ynna Atana, my Lord." the VI responds. Jason gives a nod, "Send her in." he instructs as he returns to the seat behind the desk. As the door slides open he gestures towards the chair opposite of him. "Hey V..." he greets, "Guessing news about what happened today found its way to you by now, huh?"
TEXT +Dante 20:16:53 PC :((Retcon*))
ACTION Jason_Wolfe 20:17:08 NPC Dante :is stood in his office mounting his Revenant back in place. He's still dressed in his hardsuit, though his helmet and gauntlets are on his desk. "My Lord. Ser Atana is requesting an audience with you." Fergus' voice chirps over the intercom. As he locks his Revenant into place on the mounting brackets, Jason gives a glance upwards, "Old Atana or young Atana?" he asks, though given the occurrances of the day, he suspects the
ACTION Jason_Wolfe 20:17:08 NPC Dante :latter. "Va'ynna Atana, my Lord." the VI responds. Jason gives a nod, "Send her in." he instructs as he returns to the seat behind the desk. As the door slides open he gestures towards the chair opposite of him. "Hey V..." he greets, "Guessing news about what happened today found its way to you by now, huh?"
ACTION Va`ynna_Atana 20:27:48 NPC Ehanis_Tioran :steps inside and sits down on the seat indicated by him. "Yeah, it has," she says. "It's terrible, but I'm glad that... everyone's safe in the end." She knew the basics of what happened, and who was hurt, but that's about it as far as Va'ynna is informed.
ACTION Jason_Wolfe 20:38:34 NPC Dante :gives a short nod and lets out a long sigh. "Aylena is gonna be fine. Guessing this is gonna put more work on you for a while, though... Sorry about that, V." he says. "Guess it had something to do with some lawsuit of Aylena's. We're gonna be bumping up the Respite's security for the next month or so until it's all taken care of." he explains, hoping to alleviate any worries Va'ynna might have while avoiding divulging too
ACTION Jason_Wolfe 20:38:34 NPC Dante :much information about their client's business. "But yeah... Everyone is safe." he agrees, silently grateful that Va'ynna hadn't been around for the firefight after everything she's already been through.
ACTION Va`ynna_Atana 20:47:30 NPC Ehanis_Tioran :looks down for a moment, a sigh escaping her. "Mhm," she hums. "That's... what I expected the moment I got the mssage from her. At least... I don't have to bother Victoria or Uvena to walk with me four trips every day, though."
ACTION Jason_Wolfe 20:51:26 NPC Dante :frowns. "I assume everything has been going alright since.... all that?" he asks, "With everything that's been going on I guess we haven't really sat down and talked about it... How are you doing?"
ACTION Va`ynna_Atana 20:56:35 NPC Ehanis_Tioran :shakes her head, taking a few seconds before she starts speaking. "I.... I feel... pathetic, Jason," she says, some moisture forming under her eyes as she averts her eyes. "I felt unsafe... even walking from the taxi to the door." She takes a deep breath and adds, "I don't want to be a... burden like that."
ACTION Jason_Wolfe 21:08:45 NPC Dante :winces as Va'ynna speaks, suddenly feeling very guilty for not having spoke to her sooner. "V-..." he says softly, "...Nobody thinks you're a burden. What you went through was-..." he trails off, letting out a deep sigh as he struggles to find the words. "...You didn't deserve that. Nobody deserves that, least of all you. You've been through a lot. That sort of shit would shake up anyone, V..." he says, resting his
ACTION Jason_Wolfe 21:08:46 NPC Dante :hands on his desk.
ACTION Va`ynna_Atana 21:19:36 NPC Ehanis_Tioran :gives a faint nod, but a tear does streak down her cheek. "Doesn't mean I... I don't... feel I am," she murmurs. "I want to feel... useful, that... I get and give back equally. I... I wish I could put this behind me and... don't worry, but... she is still out there."
ACTION Jason_Wolfe 21:36:06 NPC Dante :furrows his brow and shakes his head. "That's bullshit, V." he says plainly, "I'm sorry but-... come on. You are useful. Just because you don't snap into action the moment the bullets start flying doesn't mean you don't 'give back' in your own way." He leans forward, looking her in the eyes as best as he can from his position, "You're kind. You're caring. And you mix a mean drink." he says, giving a lopsided smirk, "I
ACTION Jason_Wolfe 21:36:06 NPC Dante :couldn't ask for a better friend."
ACTION Va`ynna_Atana 21:47:35 NPC Ehanis_Tioran :looks up, watching his expression carefully while he speaks. It doesn't make sense to her, no matter how many ways it's told by Victoria, her mother, or Jason. She doesn't appear to be convinced, however. "I.... Really?" she asks in a low voice as she wipes under her eyes with the back of her index finger. "I... just... I just... I depend so much on everyone around me."
ACTION Jason_Wolfe 22:00:34 NPC Dante :gives a quick shake of his head, "So? We care about you, V. You should be able to depend on us. Besides, it's a two way street. I mean, shit, look at the position you're in now. Aylena is out of commission and the Respite would probably crumble if it wasn't for you always carrying it on your shoulders. You do more than you give yourself credit for. The truth is you just also happen to have as much bad luck as the rest of
ACTION Jason_Wolfe 22:00:34 NPC Dante :us." he assures her with a humorless snort, "But that luck has to turn around eventually. For all of us. And trust me, V, you're going to put this whole ordeal behind you. It's just gonna take time."
ACTION Va`ynna_Atana 22:16:28 NPC Ehanis_Tioran :sighs, but it takes a few moments for her to say anything. Her expression doesn't change much, the guilt and sadness still present despite his reassurances – reassurances not too dissimilar to Victoria's at the core. "Crumble faster," she corrects. "I... I want to believe what you're saying, what Victoria said, but I... I felt...." She trails off and shakes her head, not wanting to repeat herself again.
ACTION Va`ynna_Atana 22:16:28 NPC Ehanis_Tioran :"You're not Aylena, nor the Respite. What I'm doing there doesn't... help you."
ACTION Jason_Wolfe's 22:31:47 NPC Dante :smirk fades away and his gaze lowers to the desk as he falls silent for a few moments. "Of course it does, V..." he finally says. His gaze rises to meet hers and he gives a sheepish shrug, "Linda and I-... We're going to-..." he stammers before just unceremoniously dropping the big news, "...She's pregnant." he says. "This place? Aite? Freedom Falls? This is going to be where our child grows up, V. The Terminus is filled
ACTION Jason_Wolfe's 22:31:48 NPC Dante :with people who know how to fire a gun. That's nothing to be proud of. And if I'm being honest? That terrifies me. Ever since Linda told me the news, I can't help but wonder what sort of people our son or daughter is going to grow up with as role models. Who is going to influence their life?" His smirk slowly returns as he looks Va'ynna over and another shrug follows, "And then I think of you. And the people like you.
ACTION Jason_Wolfe's 22:31:48 NPC Dante :And it calms me down." He gives a sigh as he shifts in his seat, "Aite has enough people like me, V... It's people like you that make Freedom Falls a place worth living in. Alright? You've gotta stop being so damn hard on yourself, because I sure as hell know this place wouldn't be the same without you."
ACTION Va`ynna_Atana 22:44:27 NPC Ehanis_Tioran :listens intently to what he says, identifying well with his fears. A smile did show up for a moment at the news about Vasquez' pregnancy, though. The asari is about to respond to the news when Jason continues, and she's taken aback as the topic shifts to her. She does tear up a bit more, the emotions too strong for her to handle. "That's.... I haven't thought about that," she says. "Even if... what you say
ACTION Va`ynna_Atana 22:44:27 NPC Ehanis_Tioran :isn't far from... what Victoria told me." She sighs. "And... that's wonderful news," she says. "I think you'll be a... great father, Jason."
ACTION Jason_Wolfe 22:57:05 NPC Dante :gives a long, drawn-out sigh. "I'd be lying if I said it didn't scare the fuck out of me." he admits with a snicker, "But-... but it feels right, you know?" He waves the topic off, realizing they're veering, "Anyway, that's a topic for another day, V." he adds dismissively. "For now, I just want you to know that I haven't given up on getting to the bottom of what happened to you and finding that asari. I just-... hit a
ACTION Jason_Wolfe 22:57:05 NPC Dante :wall. Just aliases and dead ends. I did manage to come across another asari looking for her, though. Seems our 'friend' is connected to a murder in Raelos and has some people hot on her heels. The asari couldn't tell me a whole lot aside from that she was here looking for someone who may have witnessed the incident on Raelos." He furrows his brow as he tries to recall what he was told, "Human woman named Natalie. In her
ACTION Jason_Wolfe 22:57:05 NPC Dante :late 20's. Guess she's supposed to be here on Aite. Sounded like she was a merc. So, for now, unless this 'Natalie' surfaces, all I can really do is hope the asari manages to dig something up and reaches out to me."
ACTION Va`ynna_Atana 23:11:03 NPC Ehanis_Tioran :looks down for a moment. "Wenera," she guesses aloud. "She... hugged me after I... delievered her food once, said she... knew what happened, but... she didn't tell me much-..." She suddenly pauses and looks back up, as if she had just realized something. "Actually, she... was with a human woman when she checked out... a few days before you came back."
ACTION Jason_Wolfe 23:30:29 NPC Dante :furrows his brow. "Well, shit... Maybe she found her." he says, "I haven't heard from Wenera since I spoke to her at the Respite. Maybe I should shoot a message her way and see if she's been able to uncover any solid leads." he thinks aloud.
ACTION Va`ynna_Atana 23:40:21 NPC Ehanis_Tioran :tilts her head. "Murder? I... I don't think she... wanted to kill me, though," she says with a frown, "because... well, they had the chance to do that." After a few seconds of silence, a smile does show up. "Thank you," she says. "It... would make me feel so much safer if you... find out why and stopped it."
ACTION Jason_Wolfe 23:53:21 NPC Dante :gives a shrug of his shoulders. "I don't really know the whole story, V. Or how it connects to you, for that matter. Whoever Wenera was working for didn't seem to want her to give out much information. But I promise you I'll get to the bottom of this, alright? In the mean time, just stay safe. If Vicky and Uvena are ever too busy to get you to work, you know Jasper is always around with the shuttle. All you have to do is
ACTION Jason_Wolfe 23:53:22 NPC Dante :ask." After a moment he adds pointedly for clarification, "And it is not a burden. It's just a ride to work."
ACTION Va`ynna_Atana 00:05:58 NPC Ehanis_Tioran :raises an eyebrow. "The... Kodiak shuttle? That's... that's... too much," she says, but a smile does show up. "Victoria... she don't know how to say 'no'... even if she did have too much to do." That's barely an exaggeration. "Anyway, I... I'd like to know if you... learn something new. I... don't even know who to look out for."
ACTION Jason_Wolfe 00:09:39 NPC Dante :snickers at the comments about Victoria before nodding to the statement that follows. "You got it, V. As soon as I know something, you'll know something. I've got a few pictures of the asari that I can pass your way if you want..." he continues, leaning forward and taking his terminal out of sleep mode, "...I'm not sure how useful they'll be, but it couldn't hurt, right?"
ACTION Va`ynna_Atana 00:20:09 NPC Ehanis_Tioran :nods. "I... could get D'Inea or... Mercier to get the VI to set off an alarm if she... shows up," she says, "but... that's useless if she... sends other people in her stead again." She frowns and looks down as her mind plays back the kidnapping before she lost conciousness.
ACTION Jason_Wolfe 00:29:59 NPC Dante :pokes at his terminal a few more times to send the photos of Sala Piros to Va'ynna's omni-tool. Once done, he glances back to Va'ynna. "We're gonna get her, V." he says sternly as he sees her mood souring again, "And if she does decide to send someone else to do her dirty work for her again, we're going to be there to stop them. Don't get too deep inside your own head about all this, alright? We're going to figure it out."
ACTION Jason_Wolfe 00:29:59 NPC Dante :While there's obviously no assurance that this is the way things would play out if Piros tried again, it's clear by his tone that he intends to do everything possible to keep Va'ynna safe.
ACTION Va`ynna_Atana 00:42:00 NPC Ehanis_Tioran :nods as she looks over the omni-tool message, but her frown is still there. "I.... Thank you," she says, a tear trickling down her cheek. "I'll try... but I can't forget what happened, how... easily she restrained me, what... what she did. The cold room. The gunshots." She takes a deep breath. "Sorry, that's... not helping."
ACTION Jason_Wolfe's 00:52:46 NPC Dante :gaze lowers to his desk as the asari recounts the ordeal and bites down on his frustration with himself over coming up empty handed on Piros thus far. His synthetic hand clenches into a fist atop his desk as he listens to Va'ynna. Piros was going to regret the day she let Jason get ahold of her. He gives a slow, understanding nod as. "I get it, V..." he says, "...You don't just 'get over' that sort of shit. It takes
ACTION Jason_Wolfe's 00:52:46 NPC Dante :time..." He gives an awkward shrug as he looks back to her, "And if you ever want to-... you know... talk about it or anything..." he offers, reaching up to scratch at the back of his head. While it's not exactly the sort of thing Jason is good at or comfortable with, it is a sincere offer.
ACTION Va`ynna_Atana 01:06:11 NPC Ehanis_Tioran :shakes her head after a few moments pass, as she considers his offer. It would be good for her to allow someone else to really understand it as she does, Va'ynna knows, but.... "No, no, that's... not a memory I want to share," she says. "Even if it... could help me, I... I don't feel anyone deserve to... experience it. Not... even verbally."
ACTION Jason_Wolfe's 01:11:53 NPC Dante :frown deepens. He knows all too well that it's never a good idea to keep stuff bottled up. It always finds ways of bubbling to the surface. At the same time, you can't force someone to talk if they don't want to. "If you change your mind, you know where to find me, V. Day or night. Just give me a call." He forces a smirk back into place for her sake, "Alright?"
ACTION Va`ynna_Atana 01:15:27 NPC Ehanis_Tioran :gives a slight nod. "I'll... think about it," she says, looking up at him. "I'm going to... need all the hours of the... night I can get now, though, so... don't worry about me waking you up." A brief smile shows up after she finishes speaking.
ACTION Jason_Wolfe's 01:27:12 NPC Dante :smirk growns a little more genuine and he gives a nod. "No kidding. Once Aylena is able to come back to the Respite? You need to talk to her about a vacation." he says with a quick snicker, "And a raise!" He looks across his desk at the asari and begins drumming his fingertips against the top of his desk. "I'm sorry I haven't been around much lately, V. There's just been-..." he sucks some air into his cheeks and forces
ACTION Jason_Wolfe's 01:27:12 NPC Dante :it out, "...a lot going on. You know, between getting married, getting stranded on a deserted planet, and dealing with crazy trigger-happy asari, there's not much time for a social life." he jokes. "But I'm taking a little time off from field work to finish piecing the rest of this wedding together with Linda, so I'm planning on coming and bothering you down at the Respite a whoooole lot more from now on." he says,
ACTION Jason_Wolfe's 01:27:12 NPC Dante :making it sound more like a threat than a statement.
ACTION Va`ynna_Atana 01:44:14 NPC Ehanis_Tioran :smiles as well, happy to change the topic. "I don't know what to do with myself if I had... entire days off," she says. "Maybe I'll come here to bother you... in retaliation to your plan." She doesn't mention anything about the idea of a raise. "I... will ask for a day or two off to help you with your wedding, though."
ACTION Jason_Wolfe 01:47:21 NPC Dante :gives another nod, smirk still persisting. "Sounds like a plan, V. Me and Linda can use all the help we can get at this point."
TAG +Ehanis_Tioran :Skipping Work
TITLE +Ehanis_Tioran :Va'ynna finally speaking with Jason about the kidnapping (Skipping Work)

98
cmd/lb4convert/logfile.go

@ -0,0 +1,98 @@
package main
import (
"io/ioutil"
"log"
"os"
"strings"
"time"
)
// LogFile contains the meta-data and entries
// of a lobgot3 file.
type LogFile struct {
Path string
Channel string
Time time.Time
Title string
Tag string
Entries []LogEntry
}
// LogEntry represents one line in a log-file
type LogEntry struct {
Type string
Time time.Time
Nick string
Text string
}
// NewLogFile creates a new logfile, but it doesn't
// load it.
func NewLogFile(path string) *LogFile {
split := strings.Split(path, "/")
name := strings.Replace(split[len(split)-1], ".txt", "", 1)
tokens := strings.Split(name, "_")
channel := tokens[len(tokens)-1]
parsedTime, err := time.Parse("2006-01-02 150405", strings.Join(tokens[0:2], " ")[:17])
if err != nil {
log.Fatalf("Failed to parse filename %s:\n\t%s", path, err)
}
logFile := new(LogFile)
logFile.Path = path
logFile.Channel = channel
logFile.Time = parsedTime
return logFile
}
// Load loads the file and populates the remaining data
func (logFile *LogFile) Load() {
file, err := os.Open(logFile.Path)
if err != nil {
log.Fatalf("Failed to open file %s:\n\t%s", logFile.Path, err)
}
data, err := ioutil.ReadAll(file)
if err != nil || len(data) == 0 {
log.Fatalf("Failed to read file %s:\n\t%s", logFile.Path, err)
}
rootDate := logFile.Time.Format("2006-01-02")
lines := strings.Split(string(data), "\n")
for _, line := range lines {
split := strings.Split(line, " :")
tokens := strings.Split(split[0], " ")
text := ""
if len(split) > 1 {
text = split[1]
}
switch tokens[0] {
case "ACTION", "TEXT":
{
parsedTime, _ := time.Parse("2006-01-02 15:04:05", rootDate+" "+tokens[2])
entry := LogEntry{Nick: tokens[1], Text: text, Type: tokens[0], Time: parsedTime}
// Handle midnights
if entry.Time.Before(logFile.Time) {
entry.Time = entry.Time.Add(time.Hour * 24)
}
logFile.Entries = append(logFile.Entries, entry)
}
case "TITLE":
{
logFile.Title = text
}
case "TAG":
{
logFile.Tag = text
}
}
}
}

46
cmd/lb4convert/logfile_test.go

@ -0,0 +1,46 @@
package main
import (
"testing"
"time"
)
func TestLogFile(t *testing.T) {
logFile := NewLogFile("./2016-12-28_201003477_#RedrockAgency.txt")
// Check Data gathered from filename
expectedTime, _ := time.Parse(time.RFC3339, "2016-12-28T20:10:03Z")
assertEqual(t, "logFile.Channel", logFile.Channel, "#RedrockAgency")
assertEqual(t, "logFile.Time", logFile.Time, expectedTime)
if t.Failed() {
return
}
// Load logfile
start := time.Now()
logFile.Load()
t.Logf("Logfile took %s to load", time.Since(start))
// Check logfile
assertEqual(t, "len(logFile.Entries)", len(logFile.Entries), 52)
assertEqual(t, "logFile.Title", logFile.Title, "Va'ynna finally speaking with Jason about the kidnapping (Skipping Work)")
assertEqual(t, "logFile.Tag", logFile.Tag, "Skipping Work")
if t.Failed() {
return
}
// Check LogEntry
expectedTime, _ = time.Parse(time.RFC3339, "2016-12-28T20:47:30Z")
entry := logFile.Entries[10]
assertEqual(t, "entry.Type", entry.Type, "ACTION")
assertEqual(t, "entry.Nick", entry.Nick, "Va`ynna_Atana")
assertEqual(t, "entry.Text", entry.Text, "looks down for a moment, a sigh escaping her. \"Mhm,\" she hums. \"That's... what I expected the moment I got the mssage from her. At least... I don't have to bother Victoria or Uvena to walk with me four trips every day, though.\"")
assertEqual(t, "entry.Time", entry.Time, expectedTime)
}
func assertEqual(t *testing.T, label string, a, b interface{}) {
if a != b {
t.Errorf("assertEquals (%s): \n\tGot: %+v\n\tExpected: %+v", label, a, b)
t.Fail()
}
}

16
cmd/lb4convert/main.go

@ -0,0 +1,16 @@
package main
import (
"flag"
_ "github.com/go-sql-driver/mysql"
)
var flagUser = flag.String("user", "logbot4", "MySQL user")
var flagPassword = flag.String("password", "logbot4", "MySQL password")
var flagDatabase = flag.String("database", "logbot4", "MySQL database")
var flagFile = flag.String("file", "logbot4", "The logbot3 file to convert")
func main() {
flag.Parse()
}
Loading…
Cancel
Save