Commit Graph

283 Commits

Author SHA1 Message Date
Lucio Andrés Illanes Albornoz
523d91ff89 MiRCART.py:MiRCART._parseAsChar(): derive rectangle & line coordinates and outCur{X,Y} offset from outImgFontSize[{0,1}].
MiRCART.py:MiRCART.__init__(): initialise outImgFontSize and add underline area offset.
MiRCART.py:MiRCART.__init__(): derive outCurY offset from outImgFontSize[1].
2018-01-03 03:52:41 +01:00
Lucio Andrés Illanes Albornoz
e182f0ffa9 {IrcMiRCARTBot,MiRCART}.py: differentiate private class member functions. 2018-01-03 03:33:57 +01:00
Lucio Andrés Illanes Albornoz
9896108028 IrcMiRCARTBot.py:IrcMiRCARTBot: replace print() w/ _log() calls.
IrcMiRCARTBot.py:IrcMiRCARTBot._log(): log message w/ timestamp.
2018-01-03 03:28:05 +01:00
Lucio Andrés Illanes Albornoz
c32d749675 IrcClient.py: split from IrcMiRCARTBot.py.
IrcMiRCARTBot.py: renamed from pngbot.py, importing IrcClient.IrcClient.
MiRCART.py: renamed from mirc2png.py.
README.md: updated.
2018-01-03 02:33:12 +01:00
Lucio Andrés Illanes Albornoz
98eae4257c pngbot.py:IrcBot.clientNextTimeout: moved from IrcMiRCARTBot.
pngbot.py:IrcBot.connect(): close() & return False given timeout and True given success.
pngbot.py:IrcBot.readline(): honour clientNextTimeout and return "" given timer expiry.
pngbot.py:IrcBot.sendline(): ignore clientNextTimeout.
pngbot.py:IrcMiRCARTBot.connect(): honour & pass IrcBot.connect() return value.
pngbot.py:IrcMiRCARTBot.dispatch{Join,Kick,Timer}(): (re)set clientNextTimeout to time.time() + 15 seconds.
pngbot.py:IrcMiRCARTBot.dispatch(): dispatch expired timers prior to calling readline() & honour "" return value.
pngbot.py:main(): honour IrcMiRCARTBot.connect() return value & delay reconnection by 15 seconds.
2018-01-03 02:24:58 +01:00
Lucio Andrés Illanes Albornoz
3a207fc53c pngbot.py:IrcBot.connect(): set socket non-blocking, ignore BlockingIOError, and select() for writability & optionally specified timeout.
pngbot.py:IrcBot.readline(): replace settimeout()/socket.timeout-based logic w/ select() for readability & optionally specified timeout.
pngbot.py:IrcBot.sendline(): select() for writability & optionally specified timeout and send() full buffer until failure.
pngbot.py:IrcMiRCARTBot.dispatch(): dispatch expired timers prior to calling readline().
pngbot.py:main(): default (maximum) connect timeout to 15 seconds.
2018-01-03 01:43:41 +01:00
Lucio Andrés Illanes Albornoz
09a7995a50 mirc2png.py:MiRCART.parseAsChar(): implement ^V (reverse) by swapping {background,foreground} colours. 2018-01-03 01:25:46 +01:00
Lucio Andrés Illanes Albornoz
532806176c pngbot.py:IrcBot.readline(): correctly catch socket.timeout exception. 2018-01-03 00:57:55 +01:00
Lucio Andrés Illanes Albornoz
ebd2ce9393 pngbot.py:IrcMiRCARTBot.dispatch353(): skip empty nick specs. 2018-01-03 00:53:42 +01:00
Lucio Andrés Illanes Albornoz
a0db56a530 pngbot.py:IrcBot.readline(): add optional timeout parameter.
pngbot.py:IrcMiRCARTBot.clientChannelRejoin{,TimerNext}: added to support delayed rejoin-on-kick logic.
pngbot.py:IrcMiRCARTBot.dispatchJoin(): reset clientChannelRejoin{,TimerNext} on successful (re)join to clientChannel.
pngbot.py:IrcMiRCARTBot.dispatchKick(): set clientChannelRejoin{,TimerNext} on kick from clientChannel to time.time() + 15 (seconds.)
pngbot.py:IrcMiRCARTBot.dispatchTimer(): (re)join clientChannel and set clientChannelRejoin{,TimerNext} to time.time() + 15 (seconds.)
pngbot.py:IrcMiRCARTBot.dispatch(): call readline() w/ timeout delta given clientChannelRejoinTimerNext.
2018-01-03 00:49:02 +01:00
Lucio Andrés Illanes Albornoz
936bfb6c86 pngbot.py:IrcMiRCARTBot.dispatchKick(): rejoin channel on kick. 2018-01-03 00:13:02 +01:00
Lucio Andrés Illanes Albornoz
c6aa3f9ad9 pngbot.py:IrcBot.readline(): correctly parse messages w/o a prefix. 2018-01-03 00:05:46 +01:00
Lucio Andrés Illanes Albornoz
90d9d146f1 README.md: update usage information. 2018-01-02 23:45:01 +01:00
Lucio Andrés Illanes Albornoz
95c950d2ee pngbot.py:IrcMiRCARTBot.dispatch353(): fix indentation. 2018-01-02 23:39:38 +01:00
Lucio Andrés Illanes Albornoz
8f29ba4e16 pngbot.py:IrcMiRCARTBot.dispatch353(): correctly print channel name. 2018-01-02 23:38:32 +01:00
Lucio Andrés Illanes Albornoz
f4218e8ae1 pngbot.py:IrcMiRCARTBot.dispatch{001,353,MODE,None,PING,PRIVMSG}(): split from dispatch(). 2018-01-02 23:35:01 +01:00
Lucio Andrés Illanes Albornoz
28e5b9b958 pngbot.py:IrcMiRCARTBot.dispatch(): ignore `!pngbot' requests from unauthorised (non-opped) nicks.
pngbot.py:IrcMiRCARTBot.dispatch(): add status (stdout) messages.
pngbot.py:IrcMiRCARTBot.dispatch(): always use lower-case channel name in status (stdout) messages.
2018-01-02 23:23:30 +01:00
Lucio Andrés Illanes Albornoz
993e986ec0 pngbot.py:IrcMiRCARTBot.clientChannelOps: added to track nicks authorised to use `!pngbot'.
pngbot.py:IrcMiRCARTBot.dispatch(): sync clientChannelOps w/ 353 (RPL_NAMREPLY) and (channel) MODE messages.
2018-01-02 23:12:26 +01:00
Lucio Andrés Illanes Albornoz
75e8e5fdf0 pngbot.py:IrcMiRCARTBot.uploadToImgur(): split from dispatch().
pngbot.py:IrcMiRCARTBot.dispatch(): only os.remove() if target file exists.
2018-01-02 22:40:46 +01:00
Lucio Andrés Illanes Albornoz
4556f8b238 pngbot.py: set +x bit. 2018-01-02 22:25:00 +01:00
Lucio Andrés Illanes Albornoz
3b29343e15 mirc2png.py:MiRCART.__init__(): move defaults from main(). 2018-01-02 22:24:21 +01:00
Lucio Andrés Illanes Albornoz
4f56b9c783 pngbot.py: splits main into class IrcMiRCARTBot.
pngbot.py:IrcBot.close(): only close() clientSocket if non-None.
pngbot.py:IrcMiRCARTBot.connect(): correctly zero-initialise clientLastMessage.
pngbot.py:IrcMiRCARTBot.dispatch(): fix imgurResponseHttp.status_code reference.
2018-01-02 22:20:20 +01:00
Lucio Andrés Illanes Albornoz
4c5755d2fc pngbot.py: rate-limit `!pngbot' processing to once (1) each 45 seconds. 2018-01-02 22:02:36 +01:00
Lucio Andrés Illanes Albornoz
e091920bda pngbot.py: handle HTTP status codes differing from 200.
pngbot.py: update IRC message text.
2018-01-02 21:57:21 +01:00
Lucio Andrés Illanes Albornoz
b94d3afdb5 pngbot.py: convert to lower case when comparing channel names. 2018-01-02 21:54:02 +01:00
Lucio Andrés Illanes Albornoz
5f4aa470b9 README.md: add pngbot.py prerequisites.
pngbot.py: initial commit (requires python3-{json,requests,urllib3}.)
2018-01-02 20:51:32 +01:00
Lucio Andrés Illanes Albornoz
93946c3bc9 mirc2png.py: fix class declaration & commenting style. 2018-01-02 20:51:06 +01:00
Lucio Andrés Illanes Albornoz
89e244890c .gitignore: ignore __pycache__/. 2018-01-02 20:50:40 +01:00
Lucio Andrés Illanes Albornoz
1c664f26e0 .gitignore: added to repository. 2018-01-02 19:16:09 +01:00
Lucio Andrés Illanes Albornoz
2d397ad4cf README.md: added to repository. 2018-01-02 17:03:15 +01:00
Lucio Andrés Illanes Albornoz
734cc19333 DejaVuSansMono.ttf: added to repository for convenience.
mirc2png.py:main(): default fontFilePath to `DejaVuSansMono.ttf'.
2018-01-02 16:59:35 +01:00
Lucio Andrés Illanes Albornoz
abaa92b53d mirc2png.py:parseAsChar(): implement underline (^_.)
mirc2png.py:__init__(): increment self.outCurY by correct row height.
2018-01-02 16:54:39 +01:00
Lucio Andrés Illanes Albornoz
2ea89a0559 Initial commit. 2018-01-02 16:19:07 +01:00