Any way to convert legacy (.txt) logs into something useful? |
Author: |
Message: |
ian_hawdon
Junior Member
Posts: 16
34 / /
Joined: Jun 2010
|
O.P. RE: Any way to convert legacy (.txt) logs into something useful?
Right, I've had a play with the script, there are a few bugs (for example, if an emoticon was used in a display name, the script can't find email addresses).
I have changed how the output is laid out, this makes Pidgin display the log correctly, but sadly, due to my lack of Java knowledge, I don't know how to make the file name show the date of the conversation, rather than the date of conversion.
Here is the patch that needs to be applied to the Java source XP1 attached:
code: --- Original.Main.java 2010-10-02 20:10:14.000000000 +0100
+++ Main.java 2010-10-03 12:18:12.084575152 +0100
@@ -253,7 +253,7 @@
//File aFile = new File(fFileName);
- strOutput += "<html><head><title>Conversation with " + strArrayParticipants[1][0] + " at " + dfYearMonthDayTime.format(dateSessionStart) + " on " + strArrayParticipants[0][0] + " (msn)</title></head><body><h3>Conversation with " + strArrayParticipants[1][0] + " at " + dfYearMonthDayTime.format(dateSessionStart) + " on " + strArrayParticipants[0][0] + " (msn)</h3>";
+ strOutput += "<html><head><title>Conversation with " + strArrayParticipants[1][1] + " at " + dfYearMonthDayTime.format(dateSessionStart) + " on " + strArrayParticipants[0][1] + " (msn)</title></head><body><h3>Conversation with " + strArrayParticipants[1][1] + " at " + dfYearMonthDayTime.format(dateSessionStart) + " on " + strArrayParticipants[0][1] + " (msn)</h3>" + "\n";
if (alistContactTimestamp.size() == alistContactName.size() && alistContactTimestamp.size() == alistContactMessage.size()) // If contact timestamp, name, and message are all matching
{
@@ -261,11 +261,11 @@
{
if (strArrayParticipants[0][0].contains(alistContactName.get(i))) // local user
{
- strOutput += "<font color=\"#16569E\"><font size=\"2\">" + dfTimestamp.format(alistContactTimestamp.get(i)) + "</font> <b>" + alistContactName.get(i) + ":</b></font> <font sml=\"MSN\">" + alistContactMessage.get(i) + "</font><br/>";
+ strOutput += "<font color=\"#16569E\"><font size=\"2\">(" + dfTimestamp.format(alistContactTimestamp.get(i)) + ")</font> <b>" + alistContactName.get(i) + ":</b></font> <font sml=\"MSN\">" + alistContactMessage.get(i) + "</font><br/>" + "\n";
}
else
{
- strOutput += "<font color=\"#A82F2F\"><font size=\"2\">" + dfTimestamp.format(alistContactTimestamp.get(i)) + "</font> <b>" + alistContactName.get(i) + ":</b></font> <font sml=\"MSN\"><span style=\"font-family: High Tower Text;\"><strong><span style=\"color: #ff0000;\">" + alistContactMessage.get(i) + "</span></strong></span></font><br/>";
+ strOutput += "<font color=\"#A82F2F\"><font size=\"2\">(" + dfTimestamp.format(alistContactTimestamp.get(i)) + ")</font> <b>" + alistContactName.get(i) + ":</b></font> <font sml=\"MSN\"><span style=\"font-family: High Tower Text;\"><strong><span style=\"color: #ff0000;\">" + alistContactMessage.get(i) + "</span></strong></span></font><br/>" + "\n";
}
}
@@ -535,10 +535,10 @@
private static void writeTextFile(String strFilename, String strFileContent)
{
// Date and Time
- DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh.mm.ss aa");
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd.HHmmss");
Date currentDateTime = new Date();
- strFilename = "Table " + dateFormat.format(currentDateTime) + ".html";
+ strFilename = "" + dateFormat.format(currentDateTime) + ".html";
Writer writerTextFile = null;
|
|
10-03-2010 11:20 AM |
|
|
XP1
Junior Member
Posts: 28
Joined: Nov 2004
|
RE: RE: Any way to convert legacy (.txt) logs into something useful?
quote: Originally posted by ian_hawdon
Right, I've had a play with the script, there are a few bugs (for example, if an emoticon was used in a display name, the script can't find email addresses).
Ok, I will have to detect a specific valid email address instead of just parentheses: ( ).
quote: Originally posted by ian_hawdon
I have changed how the output is laid out, this makes Pidgin display the log correctly, but sadly, due to my lack of Java knowledge, I don't know how to make the file name show the date of the conversation, rather than the date of conversion.
I am aware that it is the current date, which is not what you want. That section of code was from an older program.
quote: Originally posted by ian_hawdon
Here is the patch that needs to be applied to the Java source XP1 attached:
code: ...
What software do you use to apply this kind of patch?
|
|
10-03-2010 12:57 PM |
|
|
ian_hawdon
Junior Member
Posts: 16
34 / /
Joined: Jun 2010
|
O.P. RE: RE: RE: Any way to convert legacy (.txt) logs into something useful?
quote: Originally posted by XP1
What software do you use to apply this kind of patch?
Ah, yeah, sorry, Linux user here
you'll need Patch, from here:
code: http://gnuwin32.sourceforge.net/packages/patch.htm
copy the patch code into a file called "Main.patch" and save it in the same directory as Main.java
and run from command prompt:
code: Patch Main.java < Main.patch
You can either add patch to your path, so it can be run form any folder, or just copy the patch.exe file to the same directory as your source code and run the command above
This post was edited on 10-03-2010 at 01:09 PM by ian_hawdon.
|
|
10-03-2010 01:08 PM |
|
|
ian_hawdon
Junior Member
Posts: 16
34 / /
Joined: Jun 2010
|
O.P. RE: Any way to convert legacy (.txt) logs into something useful?
oh, and another bug I've stumbled upon: If the conversation wraps onto another line:
code: [13:36:11] WANT A STABL: sorry about that (doing work on my phone
line!)
Then the script gets confused and crashes. So, possibly something in there needs to say if a line starts with " " then append to the line above.
I'm impressed with your script so far though
|
|
10-03-2010 03:47 PM |
|
|
XP1
Junior Member
Posts: 28
Joined: Nov 2004
|
RE: RE: Any way to convert legacy (.txt) logs into something useful?
quote: Originally posted by ian_hawdon
oh, and another bug I've stumbled upon: If the conversation wraps onto another line:
code: [13:36:11] WANT A STABL: sorry about that (doing work on my phone
line!)
Then the script gets confused and crashes. So, possibly something in there needs to say if a line starts with " " then append to the line above.
I'm impressed with your script so far though
A major change in version 1.01 is that I added file input. You can run through command line using the JAR file (...\dist\):
code: java -jar "Messenger Plus! Legacy Chatlog.jar" SampleChatlog.txt
Can you give me an example of status change in both legacy and HTML?
How do you want me to handle the extra message lines? Do you want them to appear on a new line in HTML (<br>), or do you want them to be re-attached to the message so they become just a single line?
Attachment: Messenger Plus! Legacy Chatlog 1.01.zip (34.74 KB)
This file has been downloaded 140 time(s).
|
|
10-03-2010 05:20 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: Any way to convert legacy (.txt) logs into something useful?
PS: The reason why something like this hasn't been done before (at least not recently*) is that there are many many things you need to take into consideration when you want to convert a Plus! TXT log. As you have noticed, it is not as straitforward as one might think.
Apart from the few things/bugs you've already encountered, there are quite a lot more things which this script will probably 'crash' upon. And many of those things depend on user's settings at the time the log was created (also meaning it is very hard to get those settings so that the script is configured properly). Making it very hard to make an universal converter for stuff like this. That is: it is relativly easy to make a personal converter for one user, but it will probably not work for another user as-is.
* IIRC there once was a TXT converter posted on the forums though, many many years ago. But I'm not 100% sure of this.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
10-03-2010 05:26 PM |
|
|
XP1
Junior Member
Posts: 28
Joined: Nov 2004
|
RE: RE: Any way to convert legacy (.txt) logs into something useful?
quote: Originally posted by CookieRevised
PS: The reason why something like this hasn't been done before (at least not recently*) is that there are many many things you need to take into consideration when you want to convert a Plus! TXT log. As you have noticed, it is not as straitforward as one might think.
Apart from the few things/bugs you've already encountered, there are quite a lot more things which this script will probably 'crash' upon. And many of those things depend on user's settings at the time the log was created (also meaning it is very hard to get those settings so that the script is configured properly). Making it very hard to make an universal converter for stuff like this. That is: it is relativly easy to make a personal converter for one user, but it will probably not work for another user as-is.
You're right. I was able to Google search for Messenger Plus! text chat logs (for research), and I have found a couple chat logs that people had posted publicly.
For example, one chat log had " 8 มกราคม 2548" for its "Session Start" in the header. What kind of date is that? I have no idea.
(Looks like the forums converted the characters to HTML code literally. You'll have to paste them into an HTML file or click on the Google search result for the date to view them.)
If someone donates some more examples or posts unexpected and expected results, maybe I could make it work better.
quote: Originally posted by CookieRevised
* IIRC there once was a TXT converter posted on the forums though, many many years ago. But I'm not 100% sure of this.
I searched but didn't find any. If it exists, it would be cool if someone knows where it is.
|
|
10-05-2010 01:41 AM |
|
|
XP1
Junior Member
Posts: 28
Joined: Nov 2004
|
RE: Any way to convert legacy (.txt) logs into something useful?
Contact names should work with Unicode characters.
Are you interested in multiple contacts? The non-local users appear in brown color, though. Should there be other colors? Also, should the title have to be changed to include contacts > 2?
Try this one: 1.02.
It works with single-line and multiline messages, as well as status and action alerts.
Unless you're human, there's not really a way (for a computer) to know the difference between intended linebreak and unintended linebreak, so I just treat all multiline messages as linebreaks (HTML <br>) instead of losing them.
Unintended linebreak:
code: tell me (call me on my home phone
line)!
Intended linebreak:
code: Check this cool website out:
1) google.com
and this website is the same:
2) google.com
WOW!
:O:O:O:():):):):)
Do you want status alerts to look like "SCREEN NAME STATUS.", with the status in uppercase? Like "Joe OUT TO LUNCH." or "Joe out to lunch." (with or without punctuation?)? "Joe OFFLINE" or "Joe offline" (with or without punctuation?)?
Check out "SampleChatlog (4).txt" for how it currently outputs status changes.
Some additional actions I know, which it can output to HTML:
code: [22:01:21] You have failed to receive file "LOL.lol" from LOL.
[16:50:14] You have successfully received C:\Documents and
Settings\LOL\My Documents\My Received Files\LOL.lol from LO
L.
[16:49:42] Cancel(Alt+Q)
[16:50:14] Open(Alt+P)
Are there others?
Attachment: Messenger Plus! Legacy Chatlog 1.02.zip (42.01 KB)
This file has been downloaded 160 time(s).
|
|
10-05-2010 10:53 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: Any way to convert legacy (.txt) logs into something useful?
quote: Originally posted by XP1
Are there others?
oh yes, I don't have a list of all of them, but there are many more (winks, webcam, video, files, sounds, .... have all messages for when you recieved, declined, failed, etc... and that is just from the top of my head)
PS: and they are, of course, all language dependant (the same goes for the datetime field btw, this also depends on the OS's local iirc).
This post was edited on 10-06-2010 at 09:08 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
10-06-2010 09:06 AM |
|
|
ian_hawdon
Junior Member
Posts: 16
34 / /
Joined: Jun 2010
|
O.P. RE: Any way to convert legacy (.txt) logs into something useful?
Although I haven't tried converting one yet, I have a few conversations where someone changes their screen name during a conversation.
Do you need any examples of this happening?
I have to say, XP1, you're doing a great job, I really need to start looking into programming beyond VB!
|
|
10-07-2010 01:11 AM |
|
|
Pages: (4):
« First
«
1
2
[ 3 ]
4
»
Last »
|
|
|