https://github.com/amaurycarrade/chatloghighlighter
A simple chat log highlighter
https://github.com/amaurycarrade/chatloghighlighter
Last synced: about 1 month ago
JSON representation
A simple chat log highlighter
- Host: GitHub
- URL: https://github.com/amaurycarrade/chatloghighlighter
- Owner: AmauryCarrade
- License: other
- Created: 2015-08-24T23:00:01.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-26T23:37:08.000Z (almost 9 years ago)
- Last Synced: 2025-01-30T18:38:38.831Z (3 months ago)
- Language: Python
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple chat log highlighter
I used to highlight chat logs by hand before, to share them on a dedicated topic of a community's forum.
I wrote this tool to do that automatically. With unit tests because why not?
### Features
- highlights chat log, with a random color per user (the colors can be changed);
- removes bot prefixes if you are, as example, in a channel with a bot reporting the chat of a Minecraft server with PurpleIRC;
- removes the dates and times, or highlights them in the color of your choice (default gray);
- puts action texts (`/me`) in italic, or not;
- extracts nicks prefixes (like `%` or `@`, you can set your own prefixes), highlighting them in a different color (except if disabled) and the nicknames with and without with the same one;
- generates HTML or BBCode (other formats can be added too).### Example
```python
from chat_highlighter import ChatHighlighter# Chat log from http://bash.org/?4281 (a bit modified to serve the demo)
log = """
get up
get on up
get up
get on up
<@phxl|paper> and DANCE
* nmp3bot dances :D-<
* nmp3bot dances :D|-<
* nmp3bot dances :D/-<
* phxl|paper dances :D\-<
<[HB]HatfulOfHollow> i'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
"""h = ChatHighlighter(output_format = "bbcode")
print(h.highlight(log))# Output
"""
<[color=green]Zybl0re[/color]> get up
<[color=green]Zybl0re[/color]> get on up
<[color=green]Zybl0re[/color]> get up
<[color=green]Zybl0re[/color]> get on up
<[color=gray]@[/color][color=blue]phxl|paper[/color]> and DANCE
[i]* [color=lime]nmp3bot[/color] dances :D-<[/i]
[i]* [color=lime]nmp3bot[/color] dances :D|-<[/i]
[i]* [color=lime]nmp3bot[/color] dances :D/-<[/i]
[i]* [color=blue]phxl|paper[/color] dances :D\-<[/i]
<[color=purple][HB]HatfulOfHollow[/color]> i'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
"""
```See options directly inside the `chat_highlighter.py` file (documented there).
### Licence
This small piece of work is published under the CeCILL-B licence (see `LICENCE` file).