From 82d01ababdeda101f3bff706034ff5e20f2d8935 Mon Sep 17 00:00:00 2001 From: liriel Date: Sat, 4 Feb 2017 17:37:09 +0000 Subject: [PATCH 01/23] Add Trackers plugin --- __init__.py | 43 +++++++++++++ __init__.pyc | Bin 0 -> 670 bytes config.py | 37 ++++++++++++ config.pyc | Bin 0 -> 1146 bytes plugin.py | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++ plugin.pyc | Bin 0 -> 6182 bytes test.py | 18 ++++++ 7 files changed, 265 insertions(+) create mode 100644 __init__.py create mode 100644 __init__.pyc create mode 100644 config.py create mode 100644 config.pyc create mode 100644 plugin.py create mode 100644 plugin.pyc create mode 100644 test.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..35030aa --- /dev/null +++ b/__init__.py @@ -0,0 +1,43 @@ +### +# Copyright (c) 2016, Liriel +# All rights reserved. +# +# +### + +""" +Add a description of the plugin (to be presented to the user inside the wizard) +here. This should describe *what* the plugin does. +""" + +import supybot +import supybot.world as world + +# Use this for the version of this plugin. You may wish to put a CVS keyword +# in here if you're keeping the plugin in CVS or some similar system. +__version__ = "" + +# XXX Replace this with an appropriate author or supybot.Author instance. +__author__ = 'liriel' + +# This is a dictionary mapping supybot.Author instances to lists of +# contributions. +__contributors__ = {} + +# This is a url where the most recent plugin package can be downloaded. +__url__ = '' # 'http://supybot.com/Members/yourname/ServerStatus/download' + +import config +import plugin +reload(plugin) # In case we're being reloaded. +# Add more reloads here if you add third-party modules and want them to be +# reloaded when this plugin is reloaded. Don't forget to import them as well! + +if world.testing: + import test + +Class = plugin.Class +configure = config.configure + + +# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/__init__.pyc b/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d954c49e91b65d4adc95335bc669639d91043833 GIT binary patch literal 670 zcmYjNJ#X7E5IucFu@pP*+=-)`!9w?06HuKY+p z8Hx{5ibhCutyLo_GYIo2s7EpCsZ)d4kP&-U799?RQn2>n$)Oc$a7tp(C-uFt@=ejB z#jOy#UOC}*EJKMD1*il*6YEV?y+wqwe-0R)Z$VuaSZ`!?P$l_(RPO~KQ OoB1*-(mYzndGrF5f~b!G literal 0 HcmV?d00001 diff --git a/config.py b/config.py new file mode 100644 index 0000000..61bf6b4 --- /dev/null +++ b/config.py @@ -0,0 +1,37 @@ +### +# Copyright (c) 2014, SpiderDave +# All rights reserved. +# +# +### + +import supybot.conf as conf +import supybot.registry as registry +import os +try: + from supybot.i18n import PluginInternationalization, internationalizeDocstring +except: + PluginInternationalization, internationalizeDocstring = lambda x:x, lambda x:x + +#The plugin name will be based on the plugin's folder. +PluginName=os.path.dirname( __file__ ).split(os.sep)[-1] + +_ = PluginInternationalization(PluginName) + +def configure(advanced): + # This will be called by supybot to configure this module. advanced is + # a bool that specifies whether the user identified himself as an advanced + # user or not. You should effect your configuration by manipulating the + # registry as appropriate. + from supybot.questions import expect, anything, something, yn + conf.registerPlugin(PluginName, True) + +P = conf.registerPlugin(PluginName) +P.__name__ = PluginName + +# This is where your configuration variables (if any) should go. For example: +# conf.registerGlobalValue(PluginName, 'someConfigVariableName', +# registry.Boolean(False, """Help for someConfigVariableName.""")) + + +# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/config.pyc b/config.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b21fdebbc3de51620790f5fd9cb6af04ad0a5c49 GIT binary patch literal 1146 zcmcIiO>fgc5S_K1&!$ZS0@NHh^yE_w7sLT7B+7wHRJjo#Uo6+2CL8Rv@vf@|kyH6e z{4;(4%&Zfj5=XGS<9Tn_vomkT{k}hZ{N&}k6t<5`-&eHsH!>N$0&;+rfJp4111lFI zcLzO)JXlXHbRh3Q(S@iBMGvALi1%s=LWstopDT01n|+z-kYe z8L>}yA4U6sUBG?D(E(&02Z_djbo6k?PuRf;#P>Ma3%^5&%OCX2e1}{!C3BuP3#r~J zgSASGELD=r&(<+VeEjYPo|UOKwN#5#(C%)%CSQAGz5rdr?93+v)-{Z8TFj(=LnbIN zlSz;jWsu8SVjfhryiN=Tm!;9c8DceGmd#>mg34y7gL$2#AF=`*EKt??PCaya49t|q^72{{V_wLT6dPvEqrudH)vbhW|CbeD#h$?k^hVKTwL3U zrp5;Z>;ORLSorq|nGsXly7^pa)j0fvZA+}%HvR&vU8(QDB0qx#4M>* z)K^J!ON#I)#POBPF^;K|ba$0YW4M1Bt8kCLb`ax`)eTusi_f=za*#Owt(5it^{5tQ d*5r7~x$1{x#$qf+!WC0mkKAKt_@e_@L0Hy!{ literal 0 HcmV?d00001 diff --git a/plugin.py b/plugin.py new file mode 100644 index 0000000..d036504 --- /dev/null +++ b/plugin.py @@ -0,0 +1,167 @@ +# -*- coding: utf-8 -*- + +### +# by liriel +### + +import supybot.plugins as plugins +from supybot.commands import * +import supybot.ircutils as ircutils +import supybot.callbacks as callbacks +import requests +import json +import sys + +class WebParser(): + """Contains functions for getting and parsing web data""" + + def getWebData(self, irc, url): + headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} + try: + content = requests.get(url, headers=headers) + return content.json() + except: + irc.reply("Error: Couldn't connect to "+url) + sys.exit() + + def prepareStatusString(self, site_name, status, status_headers, breakpoints, line_headers): + # Specify look and feel + status_states = ["Down","Up","Iffy"] + status_symbols = ["Ⓧ","✓","◯"] + status_colours = [chr(3)+"04",chr(3)+"03",chr(3)+"07"] + + # Prepare output status message + outStr = [line_headers[0]] + count = 0 + line = 0 + for element in status: + count = count + 1 + i = int(element) + + outStr[line] = outStr[line]+status_colours[i]+status_symbols[i]+" "+status_headers[count - 1 ]+" "+status_states[i] + + # Split output at breakpoints + if count in breakpoints: + line = line + 1 + outStr.extend([line_headers[line]]) + # don't append "|" if end of line + elif count != len(status): + outStr[line] = outStr[line]+chr(15)+" | " + return outStr + +class Trackers(callbacks.Plugin): + """Contains commands for checking server status of various trackers.""" + threaded = True + def btnStatus(self, irc, msg, args, all): + """[all] + + Check the status of BTN site, tracker, and irc. Append " all" to get detailed information. + """ + url = "https://btn.trackerstatus.info/api/status/" + site_name = "BTN" + + content = WebParser().getWebData(irc,url) + + if all != "all": + if (int(content["TrackerHTTP"]) + int(content["TrackerHTTPS"])) == 2: + tracker_status = 1 + elif (int(content["TrackerHTTP"]) + int(content["TrackerHTTPS"])) == 1: + tracker_status = 2 + else: + tracker_status = 0 + + status = [content["Website"], content["IRC"], tracker_status] + status_headers = [site_name+" Site","IRC","Tracker"] + breakpoints = [0] + line_headers = [""] + + else: + status = [content["Website"], content["IRC"], content["TrackerHTTP"], content["TrackerHTTPS"], content["CableGuy"], content["Barney"]] + status_headers = ["Site","IRC","Tracker","Tracker SSL","IRC Id","IRC Announce"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + btn = wrap(btnStatus, [optional("something")]) + + def pthStatus(self, irc, msg, args, all): + """ + Check the status of PTH site, tracker, and irc. + """ + url = "http://pth.trackerstatus.info/api/status/" + site_name = "PTH" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["IRC"], content["TrackerHTTP"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","IRC","Tracker","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + pth = wrap(pthStatus, [optional("something")]) + + def ptpStatus(self, irc, msg, args, all): + """ + Check the status of PTP site, tracker, and irc. + """ + url = "https://ptp.trackerstatus.info/api/status/" + site_name = "PTP" + + content = WebParser().getWebData(irc,url) + + if all != "all": + status = [content["Website"], content["TrackerHTTP"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"]] + status_headers = [site_name+" Site","Tracker","IRC","IRC Announce","IRC ID","Image Host"] + breakpoints = [0] + line_headers = [""] + else: + status = ([content["Website"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"], + content["TrackerHTTPAddresses"]["51.255.35.82"], + content["TrackerHTTPAddresses"]["164.132.54.181"],content["TrackerHTTPAddresses"]["164.132.54.182"],content["TrackerHTTPAddresses"]["192.99.58.220"], + content["IRCPersona"], content["IRCPalme"], content["IRCSaraband"]]) + status_headers = ([site_name+" Site","IRC Announce","IRC ID","Image Host", + "51.255.35.82","164.132.54.181","164.132.54.182","192.99.58.220", + "Persona","Palme","Saraband"]) + breakpoints = [4,8] + line_headers = ["Services: ", "Trackers: ", "IRC: "] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers,breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + ptp = wrap(ptpStatus, [optional("something")]) + + def ggnStatus(self, irc, msg, args, all): + """ + Check the status of PTP site, tracker, and irc. + """ + url = "https://ggn.trackerstatus.info/api/status/" + site_name = "GGn" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"]] + status_headers = [site_name+" Site","Tracker","IRC","IRC Announce","IRC ID","Image Host"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers,breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + ggn = wrap(ggnStatus, [optional("something")]) + +Class = Trackers + + diff --git a/plugin.pyc b/plugin.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7531ae4a3cdea09273f6c0bcfd1f65da1cee4e8e GIT binary patch literal 6182 zcmds5%WfOj89qZwlqiytZP}p}JMP$NYTB?#iL!iA)3mk}*n%BF7%H&Cz#vAPBXXqS z%y`bBZ50%{aDV~@TC~WbUGxRA>Y`ot0lMg_kI)Bb7kz;C`~SmR94A!)1qC8;&i#J= z@B99l^uG!-SO595Cr#1+OC$aX9`zdp9)6YxgxIr0-QsLY1SzrIuSko%2~nRIw3`%r z8Bxy+vQwfyHAqj3`t%^374@v}(!xXSg!oK|S3-PJpAp`qkQuR;6T6ryGpxu9nHTi} zt)y0(#;W{(<8QNMA*m_2spJj2-c!dyMCzb-EP>_enhD#v0GAWKWy1<=-DwQqVx;7V|%W4o78y{&jj_yqdr04 zV;lIT#LdIBICxiRKF1#BPm5k!yt1sr3DKJndnr1B+T-w&uq>-*i9M_gH7QYiWeH28 z#U!<`LQ6cs$=6CW)u!4-_)+vzKM35)N_o*PJy}}%q5a4YyDx43=IxtT?7MLsNF2;V zUsqO^ZSA7aOHH$!41uJcxv1SpTw3@U{DyF@#1zd*tnd`@Ox6thmJY1(6YoKz>^b)zzf2hc=>0tl=Y{75{G%w zLupGf+)fcO`o$1Mb2mXZMe((sDpv-XGHQ3 z8iL2p(Ri>~tcXU%ipWZz?bATG87v0*{j^9>VkV}&%~EO6o5Pf5Xmr5uF>F&poAHv%6$OnEXhYbp&KGYSE7#l?$batZPOGV8nh`Nd5X``;L>4X8(jJjAh z?S)2X6v#k!2%fZY|69SrJVuTIRX33}J^`!-L`WRKEGtrT)|_=cU9d9vFIY2HKDC<8 zBQB;+S?^i~&%_1|KFdaf;niq#BCi`rWQkfD4KHdo8V;S5^8*BKbMJZOxKQf z?dKr-sH<$<=f853h>T8#E`$l~0A~e4I|LD>h|PfNS4Po5H4rEif>=OtX-5BF37Vi9 z>}vtg?`I}CQv?U@r$kaG0tC5*%Y*tiHlE_fKPTp-#vsyZrbG;$1+5{PVRj>?1i7F- z2dZHzq#`7y1ra9*tiXx92K2G#J)M(X5H)KyjECqIT8nnVD>MjV{yHZ8>(0_qI1}BC2bHi@e7E3N*7!&H&iWzGP#7OC-$@ zHQST$bpq+xeh4S0e0OQI=@OI3{k` zlFnHwqd`i9304J%90Oi#N40onH)$#78r9SE&H@EA8xy=X$ZD7qbKa&(;!Wo~1@BOB zk%IRSjQH*t{TNa*+@#^{TgWJ$W|CO%Oe$}E-^$XH%A|_cJkt5}qIDK=HgzF&-ZB~p zH&M4iAj}RVTXZDM4u3)7zq12il{T;f(8sWrF}W#V4H$u+!Wb`tJAiOPT~1I1(s>3j zN(_>70~!L?066G5z#D-r&tQW$ohQf{e`o+UxJ3XPAPBDsUJ--s3-K7RukjtL73}D1 zV79gW;Ok&U*tvq9gdIR9*6pJ}2Ln14^l}y{xQ;-R)WS@+qa=Z*4~#X@Crvqd;~O4o z{9PaZ>JTf=66(KV<0JcDXS_L8wAy637&CmbdFLhtBXb`*L2T|0*^P6Xf;ZUt|H-Iv z#>S{W#k$mK1Y*J%^%ZMjXuw00B}B5x{^EZVv|kO>?2UFyh1150Au6N{#){#6R zqcsgyW0VXMwwz@;eAhdHov+Y5p;7$1KmCp?jk^U ziEi&3LAUiypc@ygSjR_0-Ig(9h905L;O|G2`Tzlw-bTl5$p;bMT#pVieqrX0HuW4~ zPLp|#3E^GOOQcfxky)-Rm8&Z&<>i&~?JB=yF5SF=H}YzE1<~!LuNGAm`N&Ims^vR( z$}6|a)#@TU)F6&6utF5NER~dX18_I#5;8S6ad+Sqvak*s((X(vQrAHfpB!JGN_bB- zIF5c(s#Tk_{hd&jx?|{7`@2Icv7wciHqTnwr1 z+iD%j$Gm?(G(!0Xv^w0ri%(b%u??2Jcy8BH8Aa)-PZc4xPf zu4MYqZG6x0r01*-s$L{+%vDiLZwzk0elWaC=f~6}jR30bY>YCo^Kg*CvKURH;P|{; zhh*Re9^Ni}gveOgOJ`Hrc{~>=HnWmjqsf(5-S_}s1IzsnfXs-4G<}vD)DPaH^>`uP ztGe39=bCA>9A+35{b8GU8QQ@oMa5Dw%sF&I4pF8veEHz_m@WPe$-CgUkF~&6hI_t^ g)8ci%Z@#^JKnqdyd2 Date: Sat, 4 Feb 2017 17:41:30 +0000 Subject: [PATCH 02/23] Remove pyc files --- __init__.pyc | Bin 670 -> 0 bytes config.pyc | Bin 1146 -> 0 bytes plugin.pyc | Bin 6182 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 __init__.pyc delete mode 100644 config.pyc delete mode 100644 plugin.pyc diff --git a/__init__.pyc b/__init__.pyc deleted file mode 100644 index d954c49e91b65d4adc95335bc669639d91043833..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 670 zcmYjNJ#X7E5IucFu@pP*+=-)`!9w?06HuKY+p z8Hx{5ibhCutyLo_GYIo2s7EpCsZ)d4kP&-U799?RQn2>n$)Oc$a7tp(C-uFt@=ejB z#jOy#UOC}*EJKMD1*il*6YEV?y+wqwe-0R)Z$VuaSZ`!?P$l_(RPO~KQ OoB1*-(mYzndGrF5f~b!G diff --git a/config.pyc b/config.pyc deleted file mode 100644 index b21fdebbc3de51620790f5fd9cb6af04ad0a5c49..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1146 zcmcIiO>fgc5S_K1&!$ZS0@NHh^yE_w7sLT7B+7wHRJjo#Uo6+2CL8Rv@vf@|kyH6e z{4;(4%&Zfj5=XGS<9Tn_vomkT{k}hZ{N&}k6t<5`-&eHsH!>N$0&;+rfJp4111lFI zcLzO)JXlXHbRh3Q(S@iBMGvALi1%s=LWstopDT01n|+z-kYe z8L>}yA4U6sUBG?D(E(&02Z_djbo6k?PuRf;#P>Ma3%^5&%OCX2e1}{!C3BuP3#r~J zgSASGELD=r&(<+VeEjYPo|UOKwN#5#(C%)%CSQAGz5rdr?93+v)-{Z8TFj(=LnbIN zlSz;jWsu8SVjfhryiN=Tm!;9c8DceGmd#>mg34y7gL$2#AF=`*EKt??PCaya49t|q^72{{V_wLT6dPvEqrudH)vbhW|CbeD#h$?k^hVKTwL3U zrp5;Z>;ORLSorq|nGsXly7^pa)j0fvZA+}%HvR&vU8(QDB0qx#4M>* z)K^J!ON#I)#POBPF^;K|ba$0YW4M1Bt8kCLb`ax`)eTusi_f=za*#Owt(5it^{5tQ d*5r7~x$1{x#$qf+!WC0mkKAKt_@e_@L0Hy!{ diff --git a/plugin.pyc b/plugin.pyc deleted file mode 100644 index 7531ae4a3cdea09273f6c0bcfd1f65da1cee4e8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6182 zcmds5%WfOj89qZwlqiytZP}p}JMP$NYTB?#iL!iA)3mk}*n%BF7%H&Cz#vAPBXXqS z%y`bBZ50%{aDV~@TC~WbUGxRA>Y`ot0lMg_kI)Bb7kz;C`~SmR94A!)1qC8;&i#J= z@B99l^uG!-SO595Cr#1+OC$aX9`zdp9)6YxgxIr0-QsLY1SzrIuSko%2~nRIw3`%r z8Bxy+vQwfyHAqj3`t%^374@v}(!xXSg!oK|S3-PJpAp`qkQuR;6T6ryGpxu9nHTi} zt)y0(#;W{(<8QNMA*m_2spJj2-c!dyMCzb-EP>_enhD#v0GAWKWy1<=-DwQqVx;7V|%W4o78y{&jj_yqdr04 zV;lIT#LdIBICxiRKF1#BPm5k!yt1sr3DKJndnr1B+T-w&uq>-*i9M_gH7QYiWeH28 z#U!<`LQ6cs$=6CW)u!4-_)+vzKM35)N_o*PJy}}%q5a4YyDx43=IxtT?7MLsNF2;V zUsqO^ZSA7aOHH$!41uJcxv1SpTw3@U{DyF@#1zd*tnd`@Ox6thmJY1(6YoKz>^b)zzf2hc=>0tl=Y{75{G%w zLupGf+)fcO`o$1Mb2mXZMe((sDpv-XGHQ3 z8iL2p(Ri>~tcXU%ipWZz?bATG87v0*{j^9>VkV}&%~EO6o5Pf5Xmr5uF>F&poAHv%6$OnEXhYbp&KGYSE7#l?$batZPOGV8nh`Nd5X``;L>4X8(jJjAh z?S)2X6v#k!2%fZY|69SrJVuTIRX33}J^`!-L`WRKEGtrT)|_=cU9d9vFIY2HKDC<8 zBQB;+S?^i~&%_1|KFdaf;niq#BCi`rWQkfD4KHdo8V;S5^8*BKbMJZOxKQf z?dKr-sH<$<=f853h>T8#E`$l~0A~e4I|LD>h|PfNS4Po5H4rEif>=OtX-5BF37Vi9 z>}vtg?`I}CQv?U@r$kaG0tC5*%Y*tiHlE_fKPTp-#vsyZrbG;$1+5{PVRj>?1i7F- z2dZHzq#`7y1ra9*tiXx92K2G#J)M(X5H)KyjECqIT8nnVD>MjV{yHZ8>(0_qI1}BC2bHi@e7E3N*7!&H&iWzGP#7OC-$@ zHQST$bpq+xeh4S0e0OQI=@OI3{k` zlFnHwqd`i9304J%90Oi#N40onH)$#78r9SE&H@EA8xy=X$ZD7qbKa&(;!Wo~1@BOB zk%IRSjQH*t{TNa*+@#^{TgWJ$W|CO%Oe$}E-^$XH%A|_cJkt5}qIDK=HgzF&-ZB~p zH&M4iAj}RVTXZDM4u3)7zq12il{T;f(8sWrF}W#V4H$u+!Wb`tJAiOPT~1I1(s>3j zN(_>70~!L?066G5z#D-r&tQW$ohQf{e`o+UxJ3XPAPBDsUJ--s3-K7RukjtL73}D1 zV79gW;Ok&U*tvq9gdIR9*6pJ}2Ln14^l}y{xQ;-R)WS@+qa=Z*4~#X@Crvqd;~O4o z{9PaZ>JTf=66(KV<0JcDXS_L8wAy637&CmbdFLhtBXb`*L2T|0*^P6Xf;ZUt|H-Iv z#>S{W#k$mK1Y*J%^%ZMjXuw00B}B5x{^EZVv|kO>?2UFyh1150Au6N{#){#6R zqcsgyW0VXMwwz@;eAhdHov+Y5p;7$1KmCp?jk^U ziEi&3LAUiypc@ygSjR_0-Ig(9h905L;O|G2`Tzlw-bTl5$p;bMT#pVieqrX0HuW4~ zPLp|#3E^GOOQcfxky)-Rm8&Z&<>i&~?JB=yF5SF=H}YzE1<~!LuNGAm`N&Ims^vR( z$}6|a)#@TU)F6&6utF5NER~dX18_I#5;8S6ad+Sqvak*s((X(vQrAHfpB!JGN_bB- zIF5c(s#Tk_{hd&jx?|{7`@2Icv7wciHqTnwr1 z+iD%j$Gm?(G(!0Xv^w0ri%(b%u??2Jcy8BH8Aa)-PZc4xPf zu4MYqZG6x0r01*-s$L{+%vDiLZwzk0elWaC=f~6}jR30bY>YCo^Kg*CvKURH;P|{; zhh*Re9^Ni}gveOgOJ`Hrc{~>=HnWmjqsf(5-S_}s1IzsnfXs-4G<}vD)DPaH^>`uP ztGe39=bCA>9A+35{b8GU8QQ@oMa5Dw%sF&I4pF8veEHz_m@WPe$-CgUkF~&6hI_t^ g)8ci%Z@#^JKnqdyd2 Date: Sat, 4 Feb 2017 18:35:01 +0000 Subject: [PATCH 03/23] Updated copyright notices --- __init__.py | 4 ++-- config.py | 1 + plugin.py | 6 ++++-- test.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/__init__.py b/__init__.py index 35030aa..65986fb 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,5 @@ ### -# Copyright (c) 2016, Liriel +# Copyright (c) 2016 Ormanya # All rights reserved. # # @@ -18,7 +18,7 @@ import supybot.world as world __version__ = "" # XXX Replace this with an appropriate author or supybot.Author instance. -__author__ = 'liriel' +__author__ = 'ormanya' # This is a dictionary mapping supybot.Author instances to lists of # contributions. diff --git a/config.py b/config.py index 61bf6b4..5f7b316 100644 --- a/config.py +++ b/config.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2014, SpiderDave +# Copyright (c) 2016-2017 Ormanya # All rights reserved. # # diff --git a/plugin.py b/plugin.py index d036504..4d51f94 100644 --- a/plugin.py +++ b/plugin.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- - ### -# by liriel +# Copyright (c) 2016-2017 Ormanya +# All rights reserved. +# +# ### import supybot.plugins as plugins diff --git a/test.py b/test.py index 8e819bc..a4b9afd 100644 --- a/test.py +++ b/test.py @@ -1,5 +1,5 @@ ### -# Copyright (c) 2016, liriel +# Copyright (c) 2016-2017 Ormanya # All rights reserved. # # From 9ec0e024e525f176afdec170e5f5feab75b8bba7 Mon Sep 17 00:00:00 2001 From: liriel Date: Fri, 23 Jun 2017 22:29:41 +0000 Subject: [PATCH 04/23] Added ar, mtv, nwcd. Renamed pth to red. Changed display order of attributes. --- plugin.py | 84 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 10 deletions(-) diff --git a/plugin.py b/plugin.py index 4d51f94..1f92559 100644 --- a/plugin.py +++ b/plugin.py @@ -78,8 +78,8 @@ class Trackers(callbacks.Plugin): line_headers = [""] else: - status = [content["Website"], content["IRC"], content["TrackerHTTP"], content["TrackerHTTPS"], content["CableGuy"], content["Barney"]] - status_headers = ["Site","IRC","Tracker","Tracker SSL","IRC Id","IRC Announce"] + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"]] + status_headers = ["Site","Tracker","Tracker SSL","IRC","IRC Id","IRC Announce"] breakpoints = [0] line_headers = [""] @@ -90,17 +90,17 @@ class Trackers(callbacks.Plugin): btn = wrap(btnStatus, [optional("something")]) - def pthStatus(self, irc, msg, args, all): + def redStatus(self, irc, msg, args, all): """ Check the status of PTH site, tracker, and irc. """ - url = "http://pth.trackerstatus.info/api/status/" - site_name = "PTH" + url = "http://red.trackerstatus.info/api/status/" + site_name = "RED" content = WebParser().getWebData(irc,url) - status = [content["Website"], content["IRC"], content["TrackerHTTP"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] - status_headers = [site_name+" Site","IRC","Tracker","IRC Announce","IRC ID"] + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] breakpoints = [0] line_headers = [""] @@ -109,7 +109,50 @@ class Trackers(callbacks.Plugin): for i in range(0, len(outStr)): irc.reply(outStr[i]) - pth = wrap(pthStatus, [optional("something")]) + red = wrap(redStatus, [optional("something")]) + + def mtvStatus(self, irc, msg, args, all): + """ + Check the status of PTH site, tracker, and irc. + """ + url = "http://mtv.trackerstatus.info/api/status/" + site_name = "MTV" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + mtv = wrap(mtvStatus, [optional("something")]) + + def nwcdStatus(self, irc, msg, args, all): + """ + Check the status of PTH site, tracker, and irc. + """ + url = "http://nwcd.trackerstatus.info/api/status/" + site_name = "NWCD" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID","Image Host"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + nwcd = wrap(nwcdStatus, [optional("something")]) + def ptpStatus(self, irc, msg, args, all): """ @@ -152,8 +195,8 @@ class Trackers(callbacks.Plugin): content = WebParser().getWebData(irc,url) - status = [content["Website"], content["TrackerHTTP"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"]] - status_headers = [site_name+" Site","Tracker","IRC","IRC Announce","IRC ID","Image Host"] + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"]] + status_headers = [site_name+" Site","Tracker","TrackerSSL","IRC","IRC Announce","IRC ID","Image Host"] breakpoints = [0] line_headers = [""] @@ -164,6 +207,27 @@ class Trackers(callbacks.Plugin): ggn = wrap(ggnStatus, [optional("something")]) + def arStatus(self, irc, msg, args, all): + """ + Check the status of PTH site, tracker, and irc. + """ + url = "http://ar.trackerstatus.info/api/status/" + site_name = "AR" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + ar = wrap(arStatus, [optional("something")]) + Class = Trackers From 9fcffee9b5c81228eeefccd8e5c186a9ee2393ca Mon Sep 17 00:00:00 2001 From: liriel Date: Wed, 28 Jun 2017 04:31:27 +0000 Subject: [PATCH 05/23] Added AHD --- plugin.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/plugin.py b/plugin.py index 1f92559..7af1058 100644 --- a/plugin.py +++ b/plugin.py @@ -13,6 +13,7 @@ import supybot.callbacks as callbacks import requests import json import sys +import re class WebParser(): """Contains functions for getting and parsing web data""" @@ -228,6 +229,44 @@ class Trackers(callbacks.Plugin): ar = wrap(arStatus, [optional("something")]) + def ahdStatus(self, irc, msg, args, all): + """ + Check the status of PTH site, tracker, and irc. + """ + + # This function is different than the others because it scrapes HTML rather than use an api site + url = "https://status.awesome-hd.me" + site_name = "AHD" + + # Get web page content + headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} + try: + content = requests.get(url, headers=headers) + except: + irc.reply("Error: Couldn't connect to "+url) + sys.exit() + + # Extract statuses + status_txt = re.search(r'.*Site.*2x\ (.*)".*\n.*2x\ (.*)".*\n.*2x\ (.*)".*\n.*2x\ (.*)".*\n', content.text) + status = [] + for i in range(0,5): + if status_txt.group(i) == "green": + status.append(1) + else: + status.append(0) + + status = [status[1],status[2],status[4],status[3]] + status_headers = [site_name+" Site","IRC","Tracker","Moose"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + ahd = wrap(ahdStatus, [optional("something")]) + Class = Trackers From f99cd4f8a12f09d9fee3976698be759aa637787d Mon Sep 17 00:00:00 2001 From: liriel Date: Wed, 28 Jun 2017 05:17:22 +0000 Subject: [PATCH 06/23] Added AB --- plugin.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/plugin.py b/plugin.py index 7af1058..1df57f0 100644 --- a/plugin.py +++ b/plugin.py @@ -267,6 +267,44 @@ class Trackers(callbacks.Plugin): ahd = wrap(ahdStatus, [optional("something")]) + def abStatus(self, irc, msg, args, all): + """ + Check the status of PTH site, tracker, and irc. + """ + + # This function is different than the others because it scrapes HTML rather than use an api site + url = "http://status.animebytes.tv" + site_name = "AB" + + # Get web page content + headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} + try: + content = requests.get(url, headers=headers) + except: + irc.reply("Error: Couldn't connect to "+url) + sys.exit() + + # Extract statuses + status_txt = re.search(r'.*site.*\n.*status (.*)"[\S\s]+tracker.*\n.*status (.*)"[\S\s]+irc.*\n.*status (.*)"', content.text) + status = [] + for i in range(0,4): + if status_txt.group(i) == "normal": + status.append(1) + else: + status.append(0) + + status = [status[1],status[3],status[2]] + status_headers = [site_name+" Site","IRC","Tracker"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + ab = wrap(abStatus, [optional("something")]) + Class = Trackers From 6779ed1892e60ef813430462bdb5e1b4c869e4ca Mon Sep 17 00:00:00 2001 From: liriel Date: Thu, 6 Jul 2017 18:23:08 +0000 Subject: [PATCH 07/23] Fixed typos in help text --- plugin.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugin.py b/plugin.py index 1df57f0..26c8620 100644 --- a/plugin.py +++ b/plugin.py @@ -93,7 +93,7 @@ class Trackers(callbacks.Plugin): def redStatus(self, irc, msg, args, all): """ - Check the status of PTH site, tracker, and irc. + Check the status of RED site, tracker, and irc. """ url = "http://red.trackerstatus.info/api/status/" site_name = "RED" @@ -114,7 +114,7 @@ class Trackers(callbacks.Plugin): def mtvStatus(self, irc, msg, args, all): """ - Check the status of PTH site, tracker, and irc. + Check the status of MTV site, tracker, and irc. """ url = "http://mtv.trackerstatus.info/api/status/" site_name = "MTV" @@ -135,7 +135,7 @@ class Trackers(callbacks.Plugin): def nwcdStatus(self, irc, msg, args, all): """ - Check the status of PTH site, tracker, and irc. + Check the status of NWCD site, tracker, and irc. """ url = "http://nwcd.trackerstatus.info/api/status/" site_name = "NWCD" @@ -189,7 +189,7 @@ class Trackers(callbacks.Plugin): def ggnStatus(self, irc, msg, args, all): """ - Check the status of PTP site, tracker, and irc. + Check the status of GGN site, tracker, and irc. """ url = "https://ggn.trackerstatus.info/api/status/" site_name = "GGn" @@ -210,7 +210,7 @@ class Trackers(callbacks.Plugin): def arStatus(self, irc, msg, args, all): """ - Check the status of PTH site, tracker, and irc. + Check the status of AR site, tracker, and irc. """ url = "http://ar.trackerstatus.info/api/status/" site_name = "AR" @@ -231,7 +231,7 @@ class Trackers(callbacks.Plugin): def ahdStatus(self, irc, msg, args, all): """ - Check the status of PTH site, tracker, and irc. + Check the status of AHD site, tracker, and irc. """ # This function is different than the others because it scrapes HTML rather than use an api site @@ -269,7 +269,7 @@ class Trackers(callbacks.Plugin): def abStatus(self, irc, msg, args, all): """ - Check the status of PTH site, tracker, and irc. + Check the status of AB site, tracker, and irc. """ # This function is different than the others because it scrapes HTML rather than use an api site From 65a758429b61a073ceb15f405bd5a48229e17313 Mon Sep 17 00:00:00 2001 From: liriel Date: Wed, 19 Jul 2017 23:19:25 +0000 Subject: [PATCH 08/23] Updated regex for new format of AHD status page --- plugin.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugin.py b/plugin.py index 26c8620..5f48be6 100644 --- a/plugin.py +++ b/plugin.py @@ -247,16 +247,17 @@ class Trackers(callbacks.Plugin): sys.exit() # Extract statuses - status_txt = re.search(r'.*Site.*2x\ (.*)".*\n.*2x\ (.*)".*\n.*2x\ (.*)".*\n.*2x\ (.*)".*\n', content.text) + status_txt = re.search(r'.*Site.*2x\ (.*)".*\n.*2x\ (.*)".*\n.*2x\ (.*)"', content.text) + print status_txt status = [] - for i in range(0,5): + for i in range(0,4): if status_txt.group(i) == "green": status.append(1) else: status.append(0) - status = [status[1],status[2],status[4],status[3]] - status_headers = [site_name+" Site","IRC","Tracker","Moose"] + status = [status[1],status[2],status[3]] + status_headers = [site_name+" Site","IRC","Tracker"] breakpoints = [0] line_headers = [""] From 32d6dd6c98b4c3725cee8a2accd6345dc22e5604 Mon Sep 17 00:00:00 2001 From: liriel Date: Fri, 28 Jul 2017 16:54:24 +0000 Subject: [PATCH 09/23] Added EMP --- plugin.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/plugin.py b/plugin.py index 5f48be6..b445d0e 100644 --- a/plugin.py +++ b/plugin.py @@ -306,6 +306,44 @@ class Trackers(callbacks.Plugin): ab = wrap(abStatus, [optional("something")]) + def empStatus(self, irc, msg, args, all): + """ + Check the status of EMP site, tracker, and irc. + """ + + # This function is different than the others because it scrapes HTML rather than use an api site + url = "http://about.empornium.ph/" + site_name = "EMP" + + # Get web page content + headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} + try: + content = requests.get(url, headers=headers) + except: + irc.reply("Error: Couldn't connect to "+url) + sys.exit() + + # Extract statuses + status_txt = re.search(r'.*pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>', content.text) + status = [] + for i in range(0,5): + if status_txt.group(i) == "Online": + status.append(1) + else: + status.append(0) + + status = [status[1],status[2],status[4],status[3]] + status_headers = [site_name+" Site.me","Site.sx","Tracker","IRC"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + emp = wrap(empStatus, [optional("something")]) + Class = Trackers From b9881d4ea2bf350136a29428164de48ef7b6015c Mon Sep 17 00:00:00 2001 From: liriel Date: Tue, 7 Nov 2017 21:50:53 +0000 Subject: [PATCH 10/23] Added NBL --- plugin.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/plugin.py b/plugin.py index b445d0e..64a586e 100644 --- a/plugin.py +++ b/plugin.py @@ -216,8 +216,9 @@ class Trackers(callbacks.Plugin): site_name = "AR" content = WebParser().getWebData(irc,url) + content = content["services"] - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status = [content["site"], content["tracker"], content["tracker_ssl"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] breakpoints = [0] line_headers = [""] @@ -344,6 +345,36 @@ class Trackers(callbacks.Plugin): emp = wrap(empStatus, [optional("something")]) + def mtvStatus(self, irc, msg, args, all): + """ + Check the status of Nebulance site, tracker, and irc. + """ + url = "https://status.nebulance.io/status.json" + site_name = "NBL" + + content = WebParser().getWebData(irc,url) + content2 = content["services"] + + status_tmp = [content2["site"]["status"],content2["tracker"]["status"],content2["ssl_tracker"]["status"],content2["imagehost"]["status"]] + status = [] + for service in status_tmp: + if service: + status.append(1) + else: + status.append(0) + status_headers = [site_name+" Site","Tracker","Tracker SSL","Image Host"] + + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + nbl = wrap(nblStatus, [optional("something")]) + + Class = Trackers From 84e7bc7bbc3f9e2acb5847c4615254f6cc2bbfec Mon Sep 17 00:00:00 2001 From: liriel Date: Tue, 7 Nov 2017 22:00:45 +0000 Subject: [PATCH 11/23] Added NBL --- plugin.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugin.py b/plugin.py index 64a586e..372e036 100644 --- a/plugin.py +++ b/plugin.py @@ -216,9 +216,8 @@ class Trackers(callbacks.Plugin): site_name = "AR" content = WebParser().getWebData(irc,url) - content = content["services"] - status = [content["site"], content["tracker"], content["tracker_ssl"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] breakpoints = [0] line_headers = [""] @@ -226,7 +225,7 @@ class Trackers(callbacks.Plugin): outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) for i in range(0, len(outStr)): - irc.reply(outStr[i]) + irc.reply(outStr[i]) ar = wrap(arStatus, [optional("something")]) @@ -345,7 +344,7 @@ class Trackers(callbacks.Plugin): emp = wrap(empStatus, [optional("something")]) - def mtvStatus(self, irc, msg, args, all): + def nblStatus(self, irc, msg, args, all): """ Check the status of Nebulance site, tracker, and irc. """ @@ -355,8 +354,8 @@ class Trackers(callbacks.Plugin): content = WebParser().getWebData(irc,url) content2 = content["services"] - status_tmp = [content2["site"]["status"],content2["tracker"]["status"],content2["ssl_tracker"]["status"],content2["imagehost"]["status"]] - status = [] + status_tmp = [content2["site"]["status"],content2["tracker"]["status"],content2["tracker_ssl"]["status"],content2["imagehost"]["status"]] + status = [] for service in status_tmp: if service: status.append(1) From 9a2d0a59297dbb03b8a9346306e08c9e3b6b7f25 Mon Sep 17 00:00:00 2001 From: liriel Date: Wed, 6 Dec 2017 17:36:14 +0000 Subject: [PATCH 12/23] Removed image host from PTP and GGN --- plugin.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugin.py b/plugin.py index 372e036..58498a3 100644 --- a/plugin.py +++ b/plugin.py @@ -165,16 +165,16 @@ class Trackers(callbacks.Plugin): content = WebParser().getWebData(irc,url) if all != "all": - status = [content["Website"], content["TrackerHTTP"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"]] - status_headers = [site_name+" Site","Tracker","IRC","IRC Announce","IRC ID","Image Host"] + status = [content["Website"], content["TrackerHTTP"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","IRC","IRC Announce","IRC ID"] breakpoints = [0] line_headers = [""] else: - status = ([content["Website"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"], + status = ([content["Website"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["TrackerHTTPAddresses"]["51.255.35.82"], content["TrackerHTTPAddresses"]["164.132.54.181"],content["TrackerHTTPAddresses"]["164.132.54.182"],content["TrackerHTTPAddresses"]["192.99.58.220"], content["IRCPersona"], content["IRCPalme"], content["IRCSaraband"]]) - status_headers = ([site_name+" Site","IRC Announce","IRC ID","Image Host", + status_headers = ([site_name+" Site","IRC Announce","IRC ID", "51.255.35.82","164.132.54.181","164.132.54.182","192.99.58.220", "Persona","Palme","Saraband"]) breakpoints = [4,8] @@ -196,8 +196,8 @@ class Trackers(callbacks.Plugin): content = WebParser().getWebData(irc,url) - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"]] - status_headers = [site_name+" Site","Tracker","TrackerSSL","IRC","IRC Announce","IRC ID","Image Host"] + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","TrackerSSL","IRC","IRC Announce","IRC ID"] breakpoints = [0] line_headers = [""] From 3f6776f4e72fc7c879ebc575794d3ca26dab1fb4 Mon Sep 17 00:00:00 2001 From: liriel Date: Mon, 2 Apr 2018 16:55:06 +0000 Subject: [PATCH 13/23] Added 32p to Trackers --- plugin.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plugin.py b/plugin.py index 58498a3..8199cc0 100644 --- a/plugin.py +++ b/plugin.py @@ -229,6 +229,27 @@ class Trackers(callbacks.Plugin): ar = wrap(arStatus, [optional("something")]) + def p32Status(self, irc, msg, args, all): + """ + Check the status of AR site, tracker, and irc. + """ + url = "http://32p.trackerstatus.info/api/status/" + site_name = "32p" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + p32 = wrap(p32Status, [optional("something")]) + def ahdStatus(self, irc, msg, args, all): """ Check the status of AHD site, tracker, and irc. From 93c988a7d94010624a98cf1fc00ee0dd3fb1b142 Mon Sep 17 00:00:00 2001 From: liriel Date: Mon, 9 Apr 2018 22:31:14 +0000 Subject: [PATCH 14/23] Add option to return status message --- plugin.py | 125 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 98 insertions(+), 27 deletions(-) diff --git a/plugin.py b/plugin.py index 8199cc0..ab510eb 100644 --- a/plugin.py +++ b/plugin.py @@ -15,6 +15,15 @@ import json import sys import re +import supybot.schedule as schedule +from datetime import datetime + + + +status_commands = ['btnStatus', 'redStatus', 'mtvStatus', 'nwcdStatus', 'ptpStatus', 'ggnStatus', 'arStatus', 'p32Status', 'ahdStatus', 'ahdStatus', 'empStatus', 'nblStatus'] +status_trackers = ['btn', 'red', 'mtv', 'nwcd', 'ptp', 'ggn', 'ar', 'p32', 'ahd', 'ahd', 'emp', 'nbl'] + + class WebParser(): """Contains functions for getting and parsing web data""" @@ -55,28 +64,63 @@ class WebParser(): class Trackers(callbacks.Plugin): """Contains commands for checking server status of various trackers.""" threaded = True - def btnStatus(self, irc, msg, args, all): - """[all] - Check the status of BTN site, tracker, and irc. Append " all" to get detailed information. + # def __init__(self, irc): + # print "Setting it up" + + # self.__parent = super(Trackers, self) + # self.__parent.__init__(irc) + # # Set scheduler variables + + # # Schedule announce check + # # Check if event already exists + # try: + # schedule.removeEvent('statusAnnounce') + # except KeyError: + # pass + + # def myEventCaller(): + # print "Scheduling announce" + # self.autoAnnounce(irc) + + + # schedule.addPeriodicEvent(myEventCaller, 30, 'statusAnnounce') + # self.irc = irc + + # print "All done" + + def formatTimeSince(self, timestamp): + interval = datetime.now() - datetime.fromtimestamp(timestamp) + # seconds + if (interval.days == 0) and (interval.seconds < 60): + time_passed = "%s seconds ago" % interval.seconds + # minutes + elif interval.days == 0 and interval.seconds < 3600: + time_passed = "%s minutes ago" % int(interval.seconds / 60 ) + # hours + elif interval.days == 0: + time_passed = "%s hours ago" % int(interval.seconds / 3600 ) + else: + time_passed = "%s days ago" % interval.days + + return time_passed + + def btnStatus(self, irc, msg, args, opts): + """[--message] + + Check the status of BTN site, tracker, and irc. Use --message flag to check for additional information. """ url = "https://btn.trackerstatus.info/api/status/" site_name = "BTN" content = WebParser().getWebData(irc,url) - if all != "all": - if (int(content["TrackerHTTP"]) + int(content["TrackerHTTPS"])) == 2: - tracker_status = 1 - elif (int(content["TrackerHTTP"]) + int(content["TrackerHTTPS"])) == 1: - tracker_status = 2 - else: - tracker_status = 0 + if opts == "--message": + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(content["tweet"]["unix"]) - status = [content["Website"], content["IRC"], tracker_status] - status_headers = [site_name+" Site","IRC","Tracker"] - breakpoints = [0] - line_headers = [""] + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) else: status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"]] @@ -84,31 +128,40 @@ class Trackers(callbacks.Plugin): breakpoints = [0] line_headers = [""] - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - for i in range(0, len(outStr)): - irc.reply(outStr[i]) + for i in range(0, len(outStr)): + irc.reply(outStr[i]) btn = wrap(btnStatus, [optional("something")]) - def redStatus(self, irc, msg, args, all): - """ - Check the status of RED site, tracker, and irc. + def redStatus(self, irc, msg, args, opts): + """[--message] + + Check the status of RED site, tracker, and irc. Use --message flag to check for additional information. """ url = "http://red.trackerstatus.info/api/status/" site_name = "RED" content = WebParser().getWebData(irc,url) - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] - status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] - breakpoints = [0] - line_headers = [""] + if opts == "--message": + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(content["tweet"]["unix"]) - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + else: + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) - for i in range(0, len(outStr)): - irc.reply(outStr[i]) red = wrap(redStatus, [optional("something")]) @@ -394,7 +447,25 @@ class Trackers(callbacks.Plugin): nbl = wrap(nblStatus, [optional("something")]) + # def autoAnnounce(self, irc): + # """Schedule periodic announces for enabled trackers and channels""" + # print "Start" + # i = 0 + # for cmd in status_commands: + # print cmd + # for channel in irc.state.channels: + # print "announce.relay"+status_trackers[i] + # if self.registryValue("announce.relay"+status_trackers[i], channel): + # print "announce.relay"+status_trackers[i] + # try: + # locals()["self."+cmd]() + # except: + # print "Failed to query status" + # print channel + # i = +1 Class = Trackers + + From 202b4dfad7d0988b8df098f5a81e160e20604962 Mon Sep 17 00:00:00 2001 From: liriel Date: Tue, 10 Apr 2018 18:25:10 +0000 Subject: [PATCH 15/23] Extended message support to other trackers; fixed PTP server list --- plugin.py | 193 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 130 insertions(+), 63 deletions(-) diff --git a/plugin.py b/plugin.py index ab510eb..df32360 100644 --- a/plugin.py +++ b/plugin.py @@ -89,85 +89,102 @@ class Trackers(callbacks.Plugin): # print "All done" - def formatTimeSince(self, timestamp): - interval = datetime.now() - datetime.fromtimestamp(timestamp) + def formatTimeSince(self, interval): # seconds if (interval.days == 0) and (interval.seconds < 60): - time_passed = "%s seconds ago" % interval.seconds + time_passed = "%s seconds ago" % interval.seconds # minutes elif interval.days == 0 and interval.seconds < 3600: - time_passed = "%s minutes ago" % int(interval.seconds / 60 ) + if interval.seconds < 120: + time_passed = "1 minute ago" + else: + time_passed = "%s minutes ago" % int(interval.seconds / 60 ) # hours elif interval.days == 0: - time_passed = "%s hours ago" % int(interval.seconds / 3600 ) + if interval.seconds < 7200: + time_passed = "1 hour ago" + else: + time_passed = "%s hours ago" % int(interval.seconds / 3600 ) + # days + elif interval.days < 7: + if interval.days == 1: + time_passed = "1 day ago" + else: + time_passed = "%s days ago" % interval.days + # weeks else: - time_passed = "%s days ago" % interval.days + if interval.days < 14: + time_passed = "1 week ago" + else: + time_passed = "%s weeks ago" % (interval.days/7) return time_passed def btnStatus(self, irc, msg, args, opts): """[--message] - Check the status of BTN site, tracker, and irc. Use --message flag to check for additional information. + Check the status of BTN site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. """ url = "https://btn.trackerstatus.info/api/status/" site_name = "BTN" content = WebParser().getWebData(irc,url) - if opts == "--message": + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"]] + status_headers = ["Site","Tracker","Tracker SSL","IRC","IRC Id","IRC Announce"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(content["tweet"]["unix"]) + time_string = self.formatTimeSince(interval) outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) - irc.reply(outstr) - - else: - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"]] - status_headers = ["Site","Tracker","Tracker SSL","IRC","IRC Id","IRC Announce"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) + irc.reply(outstr) btn = wrap(btnStatus, [optional("something")]) def redStatus(self, irc, msg, args, opts): """[--message] - Check the status of RED site, tracker, and irc. Use --message flag to check for additional information. + Check the status of RED site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. """ url = "http://red.trackerstatus.info/api/status/" site_name = "RED" content = WebParser().getWebData(irc,url) - if opts == "--message": + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(content["tweet"]["unix"]) + time_string = self.formatTimeSince(interval) outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) irc.reply(outstr) - else: - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] - status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - red = wrap(redStatus, [optional("something")]) - def mtvStatus(self, irc, msg, args, all): + def mtvStatus(self, irc, msg, args, opts): """ - Check the status of MTV site, tracker, and irc. + Check the status of MTV site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. """ url = "http://mtv.trackerstatus.info/api/status/" site_name = "MTV" @@ -184,11 +201,20 @@ class Trackers(callbacks.Plugin): for i in range(0, len(outStr)): irc.reply(outStr[i]) + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + mtv = wrap(mtvStatus, [optional("something")]) - def nwcdStatus(self, irc, msg, args, all): + def nwcdStatus(self, irc, msg, args, opts): """ - Check the status of NWCD site, tracker, and irc. + Check the status of NWCD site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. """ url = "http://nwcd.trackerstatus.info/api/status/" site_name = "NWCD" @@ -205,50 +231,64 @@ class Trackers(callbacks.Plugin): for i in range(0, len(outStr)): irc.reply(outStr[i]) + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + nwcd = wrap(nwcdStatus, [optional("something")]) - def ptpStatus(self, irc, msg, args, all): + def ptpStatus(self, irc, msg, args, opts): """ - Check the status of PTP site, tracker, and irc. + Check the status of PTP site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. """ url = "https://ptp.trackerstatus.info/api/status/" site_name = "PTP" content = WebParser().getWebData(irc,url) - if all != "all": - status = [content["Website"], content["TrackerHTTP"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] - status_headers = [site_name+" Site","Tracker","IRC","IRC Announce","IRC ID"] - breakpoints = [0] - line_headers = [""] - else: - status = ([content["Website"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], - content["TrackerHTTPAddresses"]["51.255.35.82"], - content["TrackerHTTPAddresses"]["164.132.54.181"],content["TrackerHTTPAddresses"]["164.132.54.182"],content["TrackerHTTPAddresses"]["192.99.58.220"], - content["IRCPersona"], content["IRCPalme"], content["IRCSaraband"]]) - status_headers = ([site_name+" Site","IRC Announce","IRC ID", - "51.255.35.82","164.132.54.181","164.132.54.182","192.99.58.220", - "Persona","Palme","Saraband"]) - breakpoints = [4,8] - line_headers = ["Services: ", "Trackers: ", "IRC: "] + status = ([content["Website"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], + content["TrackerHTTPAddresses"]["51.255.35.82"], content["TrackerHTTPAddresses"]["51.255.35.90"], + content["TrackerHTTPAddresses"]["164.132.51.73"], + content["TrackerHTTPAddresses"]["164.132.54.181"], content["TrackerHTTPAddresses"]["164.132.54.182"], + content["TrackerHTTPAddresses"]["192.99.58.220"], + content["IRC"]]) + status_headers = ([site_name+" Site","IRC Announce","IRC ID", + "51.255.35.82", "51.255.35.90","164.132.51.73","164.132.54.181","164.132.54.182","192.99.58.220", + "Persona"]) + breakpoints = [4,9] + line_headers = ["Services: ", "Trackers: ", "IRC: "] outStr = WebParser().prepareStatusString(site_name, status, status_headers,breakpoints,line_headers) for i in range(0, len(outStr)): irc.reply(outStr[i]) + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + ptp = wrap(ptpStatus, [optional("something")]) - def ggnStatus(self, irc, msg, args, all): + def ggnStatus(self, irc, msg, args, opts): """ - Check the status of GGN site, tracker, and irc. + Check the status of GGN site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. """ url = "https://ggn.trackerstatus.info/api/status/" site_name = "GGn" content = WebParser().getWebData(irc,url) - + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] status_headers = [site_name+" Site","Tracker","TrackerSSL","IRC","IRC Announce","IRC ID"] breakpoints = [0] @@ -259,11 +299,20 @@ class Trackers(callbacks.Plugin): for i in range(0, len(outStr)): irc.reply(outStr[i]) + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + ggn = wrap(ggnStatus, [optional("something")]) - def arStatus(self, irc, msg, args, all): + def arStatus(self, irc, msg, args, opts): """ - Check the status of AR site, tracker, and irc. + Check the status of AR site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. """ url = "http://ar.trackerstatus.info/api/status/" site_name = "AR" @@ -280,11 +329,20 @@ class Trackers(callbacks.Plugin): for i in range(0, len(outStr)): irc.reply(outStr[i]) + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + ar = wrap(arStatus, [optional("something")]) - def p32Status(self, irc, msg, args, all): + def p32Status(self, irc, msg, args, opts): """ - Check the status of AR site, tracker, and irc. + Check the status of AR site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. """ url = "http://32p.trackerstatus.info/api/status/" site_name = "32p" @@ -301,6 +359,15 @@ class Trackers(callbacks.Plugin): for i in range(0, len(outStr)): irc.reply(outStr[i]) + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + p32 = wrap(p32Status, [optional("something")]) def ahdStatus(self, irc, msg, args, all): From bf283d25eb74a708ddab2628dfc3b16015cb8b7d Mon Sep 17 00:00:00 2001 From: liriel Date: Wed, 13 Jun 2018 18:25:26 +0000 Subject: [PATCH 16/23] Fixed output formatting --- plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin.py b/plugin.py index df32360..51b1dd0 100644 --- a/plugin.py +++ b/plugin.py @@ -130,8 +130,8 @@ class Trackers(callbacks.Plugin): content = WebParser().getWebData(irc,url) - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"]] - status_headers = ["Site","Tracker","Tracker SSL","IRC","IRC Id","IRC Announce"] + status = [content["Website"], content["API"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"]] + status_headers = ["Site","API","Tracker","Tracker SSL","IRC","IRC Id","IRC Announce"] breakpoints = [0] line_headers = [""] @@ -261,7 +261,7 @@ class Trackers(callbacks.Plugin): status_headers = ([site_name+" Site","IRC Announce","IRC ID", "51.255.35.82", "51.255.35.90","164.132.51.73","164.132.54.181","164.132.54.182","192.99.58.220", "Persona"]) - breakpoints = [4,9] + breakpoints = [3,9] line_headers = ["Services: ", "Trackers: ", "IRC: "] outStr = WebParser().prepareStatusString(site_name, status, status_headers,breakpoints,line_headers) From 7cb8b564e66a356cf06e33a2b0287e10325a3df1 Mon Sep 17 00:00:00 2001 From: liriel Date: Mon, 18 Jun 2018 18:51:49 +0000 Subject: [PATCH 17/23] Added kenyz status --- config.py | 13 +++++++++++++ plugin.py | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 5f7b316..0a1f7aa 100644 --- a/config.py +++ b/config.py @@ -27,6 +27,19 @@ def configure(advanced): from supybot.questions import expect, anything, something, yn conf.registerPlugin(PluginName, True) +Trackers = conf.registerPlugin('Trackers') + +conf.registerGroup(Trackers, 'announce') +conf.registerChannelValue(Trackers.announce, 'seconds', + registry.PositiveInteger(10, _("""Determines the amount of time in seconds the bot should + announce tracker statuses."""))) + +_events = {'ab':False, 'ahd':False, 'ar':False, 'btn':False, 'emp':False, 'ggn':False, 'mtv':False, 'nbl':False, 'nwcd':False, '32p':False, 'ptp':False, 'red':False} +for ev in _events: + conf.registerChannelValue(Trackers.announce, 'relay%s' % ev, + registry.Boolean(_events[ev], """Determines whether the bot should announce status for %s.""" % ev)) + + P = conf.registerPlugin(PluginName) P.__name__ = PluginName diff --git a/plugin.py b/plugin.py index 51b1dd0..92604fc 100644 --- a/plugin.py +++ b/plugin.py @@ -130,8 +130,8 @@ class Trackers(callbacks.Plugin): content = WebParser().getWebData(irc,url) - status = [content["Website"], content["API"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"]] - status_headers = ["Site","API","Tracker","Tracker SSL","IRC","IRC Id","IRC Announce"] + status = [content["Website"], content["API"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"], 2] + status_headers = ["Site","API","Tracker","Tracker SSL","IRC","IRC Id","IRC Announce","kenyz"] breakpoints = [0] line_headers = [""] From ba59efff9e3a062b5fe2c657903a75f3bed977e6 Mon Sep 17 00:00:00 2001 From: liriel Date: Mon, 15 Oct 2018 00:25:45 +0000 Subject: [PATCH 18/23] Remove deprecated PTP tracker IP --- plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin.py b/plugin.py index 92604fc..bb052a5 100644 --- a/plugin.py +++ b/plugin.py @@ -253,16 +253,16 @@ class Trackers(callbacks.Plugin): content = WebParser().getWebData(irc,url) status = ([content["Website"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], - content["TrackerHTTPAddresses"]["51.255.35.82"], content["TrackerHTTPAddresses"]["51.255.35.90"], + content["TrackerHTTPAddresses"]["51.255.35.90"], content["TrackerHTTPAddresses"]["164.132.51.73"], content["TrackerHTTPAddresses"]["164.132.54.181"], content["TrackerHTTPAddresses"]["164.132.54.182"], content["TrackerHTTPAddresses"]["192.99.58.220"], content["IRC"]]) status_headers = ([site_name+" Site","IRC Announce","IRC ID", - "51.255.35.82", "51.255.35.90","164.132.51.73","164.132.54.181","164.132.54.182","192.99.58.220", + "51.255.35.90","164.132.51.73","164.132.54.181","164.132.54.182","192.99.58.220", "Persona"]) - breakpoints = [3,9] - line_headers = ["Services: ", "Trackers: ", "IRC: "] + breakpoints = [3] + line_headers = ["Services: ", "Trackers: "] outStr = WebParser().prepareStatusString(site_name, status, status_headers,breakpoints,line_headers) From d150a705c2841562191bd79cfcc3c37ff6a4e37e Mon Sep 17 00:00:00 2001 From: liriel Date: Wed, 7 Nov 2018 17:45:09 +0000 Subject: [PATCH 19/23] Added Orpheus --- plugin.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/plugin.py b/plugin.py index bb052a5..32a6621 100644 --- a/plugin.py +++ b/plugin.py @@ -154,7 +154,7 @@ class Trackers(callbacks.Plugin): def redStatus(self, irc, msg, args, opts): """[--message] - Check the status of RED site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + Check the status of Redacted site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. """ url = "http://red.trackerstatus.info/api/status/" site_name = "RED" @@ -182,6 +182,37 @@ class Trackers(callbacks.Plugin): red = wrap(redStatus, [optional("something")]) + def opsStatus(self, irc, msg, args, opts): + """[--message] + + Check the status of Orpheus site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + """ + url = "http://ops.trackerstatus.info/api/status/" + site_name = "OPS" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + + ops = wrap(opsStatus, [optional("something")]) + def mtvStatus(self, irc, msg, args, opts): """ Check the status of MTV site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. From e9acb4b480c956b24fd31656052fb3fe3ecd2031 Mon Sep 17 00:00:00 2001 From: Ormanya Date: Tue, 19 Mar 2019 22:38:52 +0000 Subject: [PATCH 20/23] Ported from Python 2 to Python 3 --- __init__.py | 90 ++-- config.py | 2 +- plugin.py | 1138 +++++++++++++++++++++++++-------------------------- 3 files changed, 617 insertions(+), 613 deletions(-) diff --git a/__init__.py b/__init__.py index 65986fb..cedf6e3 100644 --- a/__init__.py +++ b/__init__.py @@ -1,43 +1,47 @@ -### -# Copyright (c) 2016 Ormanya -# All rights reserved. -# -# -### - -""" -Add a description of the plugin (to be presented to the user inside the wizard) -here. This should describe *what* the plugin does. -""" - -import supybot -import supybot.world as world - -# Use this for the version of this plugin. You may wish to put a CVS keyword -# in here if you're keeping the plugin in CVS or some similar system. -__version__ = "" - -# XXX Replace this with an appropriate author or supybot.Author instance. -__author__ = 'ormanya' - -# This is a dictionary mapping supybot.Author instances to lists of -# contributions. -__contributors__ = {} - -# This is a url where the most recent plugin package can be downloaded. -__url__ = '' # 'http://supybot.com/Members/yourname/ServerStatus/download' - -import config -import plugin -reload(plugin) # In case we're being reloaded. -# Add more reloads here if you add third-party modules and want them to be -# reloaded when this plugin is reloaded. Don't forget to import them as well! - -if world.testing: - import test - -Class = plugin.Class -configure = config.configure - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: +### +# Copyright (c) 2016 Ormanya +# All rights reserved. +# +# +### + +""" +Add a description of the plugin (to be presented to the user inside the wizard) +here. This should describe *what* the plugin does. +""" + +import supybot +import supybot.world as world + +# Use this for the version of this plugin. You may wish to put a CVS keyword +# in here if you're keeping the plugin in CVS or some similar system. +__version__ = "" + +# XXX Replace this with an appropriate author or supybot.Author instance. +__author__ = 'ormanya' + +# This is a dictionary mapping supybot.Author instances to lists of +# contributions. +__contributors__ = {} + +# This is a url where the most recent plugin package can be downloaded. +__url__ = '' # 'http://supybot.com/Members/yourname/ServerStatus/download' + +from . import config +from . import plugin +from imp import reload + +# In case we're being reloaded. +reload(config) +reload(plugin) +# Add more reloads here if you add third-party modules and want them to be +# reloaded when this plugin is reloaded. Don't forget to import them as well! + +if world.testing: + from . import test + +Class = plugin.Class +configure = config.configure + + +# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/config.py b/config.py index 0a1f7aa..7e4947b 100644 --- a/config.py +++ b/config.py @@ -41,7 +41,7 @@ for ev in _events: P = conf.registerPlugin(PluginName) -P.__name__ = PluginName +#P.__name__ = PluginName # This is where your configuration variables (if any) should go. For example: # conf.registerGlobalValue(PluginName, 'someConfigVariableName', diff --git a/plugin.py b/plugin.py index 32a6621..a98b97e 100644 --- a/plugin.py +++ b/plugin.py @@ -1,569 +1,569 @@ -# -*- coding: utf-8 -*- -### -# Copyright (c) 2016-2017 Ormanya -# All rights reserved. -# -# -### - -import supybot.plugins as plugins -from supybot.commands import * -import supybot.ircutils as ircutils -import supybot.callbacks as callbacks -import requests -import json -import sys -import re - -import supybot.schedule as schedule -from datetime import datetime - - - -status_commands = ['btnStatus', 'redStatus', 'mtvStatus', 'nwcdStatus', 'ptpStatus', 'ggnStatus', 'arStatus', 'p32Status', 'ahdStatus', 'ahdStatus', 'empStatus', 'nblStatus'] -status_trackers = ['btn', 'red', 'mtv', 'nwcd', 'ptp', 'ggn', 'ar', 'p32', 'ahd', 'ahd', 'emp', 'nbl'] - - -class WebParser(): - """Contains functions for getting and parsing web data""" - - def getWebData(self, irc, url): - headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} - try: - content = requests.get(url, headers=headers) - return content.json() - except: - irc.reply("Error: Couldn't connect to "+url) - sys.exit() - - def prepareStatusString(self, site_name, status, status_headers, breakpoints, line_headers): - # Specify look and feel - status_states = ["Down","Up","Iffy"] - status_symbols = ["Ⓧ","✓","◯"] - status_colours = [chr(3)+"04",chr(3)+"03",chr(3)+"07"] - - # Prepare output status message - outStr = [line_headers[0]] - count = 0 - line = 0 - for element in status: - count = count + 1 - i = int(element) - - outStr[line] = outStr[line]+status_colours[i]+status_symbols[i]+" "+status_headers[count - 1 ]+" "+status_states[i] - - # Split output at breakpoints - if count in breakpoints: - line = line + 1 - outStr.extend([line_headers[line]]) - # don't append "|" if end of line - elif count != len(status): - outStr[line] = outStr[line]+chr(15)+" | " - return outStr - -class Trackers(callbacks.Plugin): - """Contains commands for checking server status of various trackers.""" - threaded = True - - # def __init__(self, irc): - # print "Setting it up" - - # self.__parent = super(Trackers, self) - # self.__parent.__init__(irc) - # # Set scheduler variables - - # # Schedule announce check - # # Check if event already exists - # try: - # schedule.removeEvent('statusAnnounce') - # except KeyError: - # pass - - # def myEventCaller(): - # print "Scheduling announce" - # self.autoAnnounce(irc) - - - # schedule.addPeriodicEvent(myEventCaller, 30, 'statusAnnounce') - # self.irc = irc - - # print "All done" - - def formatTimeSince(self, interval): - # seconds - if (interval.days == 0) and (interval.seconds < 60): - time_passed = "%s seconds ago" % interval.seconds - # minutes - elif interval.days == 0 and interval.seconds < 3600: - if interval.seconds < 120: - time_passed = "1 minute ago" - else: - time_passed = "%s minutes ago" % int(interval.seconds / 60 ) - # hours - elif interval.days == 0: - if interval.seconds < 7200: - time_passed = "1 hour ago" - else: - time_passed = "%s hours ago" % int(interval.seconds / 3600 ) - # days - elif interval.days < 7: - if interval.days == 1: - time_passed = "1 day ago" - else: - time_passed = "%s days ago" % interval.days - # weeks - else: - if interval.days < 14: - time_passed = "1 week ago" - else: - time_passed = "%s weeks ago" % (interval.days/7) - - return time_passed - - def btnStatus(self, irc, msg, args, opts): - """[--message] - - Check the status of BTN site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. - """ - url = "https://btn.trackerstatus.info/api/status/" - site_name = "BTN" - - content = WebParser().getWebData(irc,url) - - status = [content["Website"], content["API"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"], 2] - status_headers = ["Site","API","Tracker","Tracker SSL","IRC","IRC Id","IRC Announce","kenyz"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - # Output message if --message flag specified or newer than 1 day - interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) - if opts == "--message" or interval.days < 1: - message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(interval) - - outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) - irc.reply(outstr) - - btn = wrap(btnStatus, [optional("something")]) - - def redStatus(self, irc, msg, args, opts): - """[--message] - - Check the status of Redacted site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. - """ - url = "http://red.trackerstatus.info/api/status/" - site_name = "RED" - - content = WebParser().getWebData(irc,url) - - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] - status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - # Output message if --message flag specified or newer than 1 day - interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) - if opts == "--message" or interval.days < 1: - message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(interval) - - outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) - irc.reply(outstr) - - red = wrap(redStatus, [optional("something")]) - - def opsStatus(self, irc, msg, args, opts): - """[--message] - - Check the status of Orpheus site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. - """ - url = "http://ops.trackerstatus.info/api/status/" - site_name = "OPS" - - content = WebParser().getWebData(irc,url) - - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] - status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - # Output message if --message flag specified or newer than 1 day - interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) - if opts == "--message" or interval.days < 1: - message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(interval) - - outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) - irc.reply(outstr) - - ops = wrap(opsStatus, [optional("something")]) - - def mtvStatus(self, irc, msg, args, opts): - """ - Check the status of MTV site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. - """ - url = "http://mtv.trackerstatus.info/api/status/" - site_name = "MTV" - - content = WebParser().getWebData(irc,url) - - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] - status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - # Output message if --message flag specified or newer than 1 day - interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) - if opts == "--message" or interval.days < 1: - message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(interval) - - outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) - irc.reply(outstr) - - mtv = wrap(mtvStatus, [optional("something")]) - - def nwcdStatus(self, irc, msg, args, opts): - """ - Check the status of NWCD site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. - """ - url = "http://nwcd.trackerstatus.info/api/status/" - site_name = "NWCD" - - content = WebParser().getWebData(irc,url) - - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"]] - status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID","Image Host"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - # Output message if --message flag specified or newer than 1 day - interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) - if opts == "--message" or interval.days < 1: - message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(interval) - - outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) - irc.reply(outstr) - - nwcd = wrap(nwcdStatus, [optional("something")]) - - - def ptpStatus(self, irc, msg, args, opts): - """ - Check the status of PTP site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. - """ - url = "https://ptp.trackerstatus.info/api/status/" - site_name = "PTP" - - content = WebParser().getWebData(irc,url) - - status = ([content["Website"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], - content["TrackerHTTPAddresses"]["51.255.35.90"], - content["TrackerHTTPAddresses"]["164.132.51.73"], - content["TrackerHTTPAddresses"]["164.132.54.181"], content["TrackerHTTPAddresses"]["164.132.54.182"], - content["TrackerHTTPAddresses"]["192.99.58.220"], - content["IRC"]]) - status_headers = ([site_name+" Site","IRC Announce","IRC ID", - "51.255.35.90","164.132.51.73","164.132.54.181","164.132.54.182","192.99.58.220", - "Persona"]) - breakpoints = [3] - line_headers = ["Services: ", "Trackers: "] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers,breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - # Output message if --message flag specified or newer than 1 day - interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) - if opts == "--message" or interval.days < 1: - message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(interval) - - outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) - irc.reply(outstr) - - ptp = wrap(ptpStatus, [optional("something")]) - - def ggnStatus(self, irc, msg, args, opts): - """ - Check the status of GGN site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. - """ - url = "https://ggn.trackerstatus.info/api/status/" - site_name = "GGn" - - content = WebParser().getWebData(irc,url) - - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] - status_headers = [site_name+" Site","Tracker","TrackerSSL","IRC","IRC Announce","IRC ID"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers,breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - # Output message if --message flag specified or newer than 1 day - interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) - if opts == "--message" or interval.days < 1: - message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(interval) - - outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) - irc.reply(outstr) - - ggn = wrap(ggnStatus, [optional("something")]) - - def arStatus(self, irc, msg, args, opts): - """ - Check the status of AR site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. - """ - url = "http://ar.trackerstatus.info/api/status/" - site_name = "AR" - - content = WebParser().getWebData(irc,url) - - status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] - status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - # Output message if --message flag specified or newer than 1 day - interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) - if opts == "--message" or interval.days < 1: - message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(interval) - - outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) - irc.reply(outstr) - - ar = wrap(arStatus, [optional("something")]) - - def p32Status(self, irc, msg, args, opts): - """ - Check the status of AR site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. - """ - url = "http://32p.trackerstatus.info/api/status/" - site_name = "32p" - - content = WebParser().getWebData(irc,url) - - status = [content["Website"], content["TrackerHTTP"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] - status_headers = [site_name+" Site","Tracker","IRC","IRC Announce","IRC ID"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - # Output message if --message flag specified or newer than 1 day - interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) - if opts == "--message" or interval.days < 1: - message_string = content["tweet"]["message"] - time_string = self.formatTimeSince(interval) - - outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) - irc.reply(outstr) - - p32 = wrap(p32Status, [optional("something")]) - - def ahdStatus(self, irc, msg, args, all): - """ - Check the status of AHD site, tracker, and irc. - """ - - # This function is different than the others because it scrapes HTML rather than use an api site - url = "https://status.awesome-hd.me" - site_name = "AHD" - - # Get web page content - headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} - try: - content = requests.get(url, headers=headers) - except: - irc.reply("Error: Couldn't connect to "+url) - sys.exit() - - # Extract statuses - status_txt = re.search(r'.*Site.*2x\ (.*)".*\n.*2x\ (.*)".*\n.*2x\ (.*)"', content.text) - print status_txt - status = [] - for i in range(0,4): - if status_txt.group(i) == "green": - status.append(1) - else: - status.append(0) - - status = [status[1],status[2],status[3]] - status_headers = [site_name+" Site","IRC","Tracker"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - ahd = wrap(ahdStatus, [optional("something")]) - - def abStatus(self, irc, msg, args, all): - """ - Check the status of AB site, tracker, and irc. - """ - - # This function is different than the others because it scrapes HTML rather than use an api site - url = "http://status.animebytes.tv" - site_name = "AB" - - # Get web page content - headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} - try: - content = requests.get(url, headers=headers) - except: - irc.reply("Error: Couldn't connect to "+url) - sys.exit() - - # Extract statuses - status_txt = re.search(r'.*site.*\n.*status (.*)"[\S\s]+tracker.*\n.*status (.*)"[\S\s]+irc.*\n.*status (.*)"', content.text) - status = [] - for i in range(0,4): - if status_txt.group(i) == "normal": - status.append(1) - else: - status.append(0) - - status = [status[1],status[3],status[2]] - status_headers = [site_name+" Site","IRC","Tracker"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - ab = wrap(abStatus, [optional("something")]) - - def empStatus(self, irc, msg, args, all): - """ - Check the status of EMP site, tracker, and irc. - """ - - # This function is different than the others because it scrapes HTML rather than use an api site - url = "http://about.empornium.ph/" - site_name = "EMP" - - # Get web page content - headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} - try: - content = requests.get(url, headers=headers) - except: - irc.reply("Error: Couldn't connect to "+url) - sys.exit() - - # Extract statuses - status_txt = re.search(r'.*pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>', content.text) - status = [] - for i in range(0,5): - if status_txt.group(i) == "Online": - status.append(1) - else: - status.append(0) - - status = [status[1],status[2],status[4],status[3]] - status_headers = [site_name+" Site.me","Site.sx","Tracker","IRC"] - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - emp = wrap(empStatus, [optional("something")]) - - def nblStatus(self, irc, msg, args, all): - """ - Check the status of Nebulance site, tracker, and irc. - """ - url = "https://status.nebulance.io/status.json" - site_name = "NBL" - - content = WebParser().getWebData(irc,url) - content2 = content["services"] - - status_tmp = [content2["site"]["status"],content2["tracker"]["status"],content2["tracker_ssl"]["status"],content2["imagehost"]["status"]] - status = [] - for service in status_tmp: - if service: - status.append(1) - else: - status.append(0) - status_headers = [site_name+" Site","Tracker","Tracker SSL","Image Host"] - - breakpoints = [0] - line_headers = [""] - - outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) - - for i in range(0, len(outStr)): - irc.reply(outStr[i]) - - nbl = wrap(nblStatus, [optional("something")]) - - # def autoAnnounce(self, irc): - # """Schedule periodic announces for enabled trackers and channels""" - # print "Start" - # i = 0 - # for cmd in status_commands: - # print cmd - # for channel in irc.state.channels: - # print "announce.relay"+status_trackers[i] - # if self.registryValue("announce.relay"+status_trackers[i], channel): - # print "announce.relay"+status_trackers[i] - # try: - # locals()["self."+cmd]() - # except: - # print "Failed to query status" - # print channel - # i = +1 - -Class = Trackers - - - - +# -*- coding: utf-8 -*- +### +# Copyright (c) 2016-2017 Ormanya +# All rights reserved. +# +# +### + +import supybot.plugins as plugins +from supybot.commands import * +import supybot.ircutils as ircutils +import supybot.callbacks as callbacks +import requests +import json +import sys +import re + +import supybot.schedule as schedule +from datetime import datetime + + + +status_commands = ['btnStatus', 'redStatus', 'mtvStatus', 'nwcdStatus', 'ptpStatus', 'ggnStatus', 'arStatus', 'p32Status', 'ahdStatus', 'ahdStatus', 'empStatus', 'nblStatus'] +status_trackers = ['btn', 'red', 'mtv', 'nwcd', 'ptp', 'ggn', 'ar', 'p32', 'ahd', 'ahd', 'emp', 'nbl'] + + +class WebParser(): + """Contains functions for getting and parsing web data""" + + def getWebData(self, irc, url): + headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} + try: + content = requests.get(url, headers=headers) + return content.json() + except: + irc.reply("Error: Couldn't connect to "+url) + sys.exit() + + def prepareStatusString(self, site_name, status, status_headers, breakpoints, line_headers): + # Specify look and feel + status_states = ["Down","Up","Iffy"] + status_symbols = ["Ⓧ","✓","◯"] + status_colours = [chr(3)+"04",chr(3)+"03",chr(3)+"07"] + + # Prepare output status message + outStr = [line_headers[0]] + count = 0 + line = 0 + for element in status: + count = count + 1 + i = int(element) + + outStr[line] = outStr[line]+status_colours[i]+status_symbols[i]+" "+status_headers[count - 1 ]+" "+status_states[i] + + # Split output at breakpoints + if count in breakpoints: + line = line + 1 + outStr.extend([line_headers[line]]) + # don't append "|" if end of line + elif count != len(status): + outStr[line] = outStr[line]+chr(15)+" | " + return outStr + +class Trackers(callbacks.Plugin): + """Contains commands for checking server status of various trackers.""" + threaded = True + + # def __init__(self, irc): + # print "Setting it up" + + # self.__parent = super(Trackers, self) + # self.__parent.__init__(irc) + # # Set scheduler variables + + # # Schedule announce check + # # Check if event already exists + # try: + # schedule.removeEvent('statusAnnounce') + # except KeyError: + # pass + + # def myEventCaller(): + # print "Scheduling announce" + # self.autoAnnounce(irc) + + + # schedule.addPeriodicEvent(myEventCaller, 30, 'statusAnnounce') + # self.irc = irc + + # print "All done" + + def formatTimeSince(self, interval): + # seconds + if (interval.days == 0) and (interval.seconds < 60): + time_passed = "%s seconds ago" % interval.seconds + # minutes + elif interval.days == 0 and interval.seconds < 3600: + if interval.seconds < 120: + time_passed = "1 minute ago" + else: + time_passed = "%s minutes ago" % int(interval.seconds / 60 ) + # hours + elif interval.days == 0: + if interval.seconds < 7200: + time_passed = "1 hour ago" + else: + time_passed = "%s hours ago" % int(interval.seconds / 3600 ) + # days + elif interval.days < 7: + if interval.days == 1: + time_passed = "1 day ago" + else: + time_passed = "%s days ago" % interval.days + # weeks + else: + if interval.days < 14: + time_passed = "1 week ago" + else: + time_passed = "%s weeks ago" % (interval.days/7) + + return time_passed + + def btnStatus(self, irc, msg, args, opts): + """[--message] + + Check the status of BTN site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + """ + url = "https://btn.trackerstatus.info/api/status/" + site_name = "BTN" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["API"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"], 2] + status_headers = ["Site","API","Tracker","Tracker SSL","IRC","IRC Id","IRC Announce","kenyz"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + + btn = wrap(btnStatus, [optional("something")]) + + def redStatus(self, irc, msg, args, opts): + """[--message] + + Check the status of Redacted site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + """ + url = "http://red.trackerstatus.info/api/status/" + site_name = "RED" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + + red = wrap(redStatus, [optional("something")]) + + def opsStatus(self, irc, msg, args, opts): + """[--message] + + Check the status of Orpheus site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + """ + url = "http://ops.trackerstatus.info/api/status/" + site_name = "OPS" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + + ops = wrap(opsStatus, [optional("something")]) + + def mtvStatus(self, irc, msg, args, opts): + """ + Check the status of MTV site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + """ + url = "http://mtv.trackerstatus.info/api/status/" + site_name = "MTV" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + + mtv = wrap(mtvStatus, [optional("something")]) + + def nwcdStatus(self, irc, msg, args, opts): + """ + Check the status of NWCD site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + """ + url = "http://nwcd.trackerstatus.info/api/status/" + site_name = "NWCD" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], content["ImageHost"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID","Image Host"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + + nwcd = wrap(nwcdStatus, [optional("something")]) + + + def ptpStatus(self, irc, msg, args, opts): + """ + Check the status of PTP site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + """ + url = "https://ptp.trackerstatus.info/api/status/" + site_name = "PTP" + + content = WebParser().getWebData(irc,url) + + status = ([content["Website"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"], + content["TrackerHTTPAddresses"]["51.255.35.90"], + content["TrackerHTTPAddresses"]["164.132.51.73"], + content["TrackerHTTPAddresses"]["164.132.54.181"], content["TrackerHTTPAddresses"]["164.132.54.182"], + content["TrackerHTTPAddresses"]["192.99.58.220"], + content["IRC"]]) + status_headers = ([site_name+" Site","IRC Announce","IRC ID", + "51.255.35.90","164.132.51.73","164.132.54.181","164.132.54.182","192.99.58.220", + "Persona"]) + breakpoints = [3] + line_headers = ["Services: ", "Trackers: "] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers,breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + + ptp = wrap(ptpStatus, [optional("something")]) + + def ggnStatus(self, irc, msg, args, opts): + """ + Check the status of GGN site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + """ + url = "https://ggn.trackerstatus.info/api/status/" + site_name = "GGn" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","TrackerSSL","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers,breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + + ggn = wrap(ggnStatus, [optional("something")]) + + def arStatus(self, irc, msg, args, opts): + """ + Check the status of AR site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + """ + url = "http://ar.trackerstatus.info/api/status/" + site_name = "AR" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","Tracker SSL","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + + ar = wrap(arStatus, [optional("something")]) + + def p32Status(self, irc, msg, args, opts): + """ + Check the status of AR site, tracker, and irc. Use --message flag to force return of message, even if older than 24 hours. + """ + url = "http://32p.trackerstatus.info/api/status/" + site_name = "32p" + + content = WebParser().getWebData(irc,url) + + status = [content["Website"], content["TrackerHTTP"], content["IRC"], content["IRCTorrentAnnouncer"], content["IRCUserIdentifier"]] + status_headers = [site_name+" Site","Tracker","IRC","IRC Announce","IRC ID"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + # Output message if --message flag specified or newer than 1 day + interval = datetime.now() - datetime.fromtimestamp(float(content["tweet"]["unix"])) + if opts == "--message" or interval.days < 1: + message_string = content["tweet"]["message"] + time_string = self.formatTimeSince(interval) + + outstr = "%s message: %s (%s)" % (site_name, message_string, time_string) + irc.reply(outstr) + + p32 = wrap(p32Status, [optional("something")]) + + def ahdStatus(self, irc, msg, args, all): + """ + Check the status of AHD site, tracker, and irc. + """ + + # This function is different than the others because it scrapes HTML rather than use an api site + url = "https://status.awesome-hd.me" + site_name = "AHD" + + # Get web page content + headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} + try: + content = requests.get(url, headers=headers) + except: + irc.reply("Error: Couldn't connect to "+url) + sys.exit() + + # Extract statuses + status_txt = re.search(r'.*Site.*2x\ (.*)".*\n.*2x\ (.*)".*\n.*2x\ (.*)"', content.text) + print(status_txt) + status = [] + for i in range(0,4): + if status_txt.group(i) == "green": + status.append(1) + else: + status.append(0) + + status = [status[1],status[2],status[3]] + status_headers = [site_name+" Site","IRC","Tracker"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + ahd = wrap(ahdStatus, [optional("something")]) + + def abStatus(self, irc, msg, args, all): + """ + Check the status of AB site, tracker, and irc. + """ + + # This function is different than the others because it scrapes HTML rather than use an api site + url = "http://status.animebytes.tv" + site_name = "AB" + + # Get web page content + headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} + try: + content = requests.get(url, headers=headers) + except: + irc.reply("Error: Couldn't connect to "+url) + sys.exit() + + # Extract statuses + status_txt = re.search(r'.*site.*\n.*status (.*)"[\S\s]+tracker.*\n.*status (.*)"[\S\s]+irc.*\n.*status (.*)"', content.text) + status = [] + for i in range(0,4): + if status_txt.group(i) == "normal": + status.append(1) + else: + status.append(0) + + status = [status[1],status[3],status[2]] + status_headers = [site_name+" Site","IRC","Tracker"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + ab = wrap(abStatus, [optional("something")]) + + def empStatus(self, irc, msg, args, all): + """ + Check the status of EMP site, tracker, and irc. + """ + + # This function is different than the others because it scrapes HTML rather than use an api site + url = "http://about.empornium.ph/" + site_name = "EMP" + + # Get web page content + headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.27 Safari/537.17'} + try: + content = requests.get(url, headers=headers) + except: + irc.reply("Error: Couldn't connect to "+url) + sys.exit() + + # Extract statuses + status_txt = re.search(r'.*pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>[\S\s.]+?pull-right">(.*)<\/span>', content.text) + status = [] + for i in range(0,5): + if status_txt.group(i) == "Online": + status.append(1) + else: + status.append(0) + + status = [status[1],status[2],status[4],status[3]] + status_headers = [site_name+" Site.me","Site.sx","Tracker","IRC"] + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + emp = wrap(empStatus, [optional("something")]) + + def nblStatus(self, irc, msg, args, all): + """ + Check the status of Nebulance site, tracker, and irc. + """ + url = "https://status.nebulance.io/status.json" + site_name = "NBL" + + content = WebParser().getWebData(irc,url) + content2 = content["services"] + + status_tmp = [content2["site"]["status"],content2["tracker"]["status"],content2["tracker_ssl"]["status"],content2["imagehost"]["status"]] + status = [] + for service in status_tmp: + if service: + status.append(1) + else: + status.append(0) + status_headers = [site_name+" Site","Tracker","Tracker SSL","Image Host"] + + breakpoints = [0] + line_headers = [""] + + outStr = WebParser().prepareStatusString(site_name, status, status_headers, breakpoints,line_headers) + + for i in range(0, len(outStr)): + irc.reply(outStr[i]) + + nbl = wrap(nblStatus, [optional("something")]) + + # def autoAnnounce(self, irc): + # """Schedule periodic announces for enabled trackers and channels""" + # print "Start" + # i = 0 + # for cmd in status_commands: + # print cmd + # for channel in irc.state.channels: + # print "announce.relay"+status_trackers[i] + # if self.registryValue("announce.relay"+status_trackers[i], channel): + # print "announce.relay"+status_trackers[i] + # try: + # locals()["self."+cmd]() + # except: + # print "Failed to query status" + # print channel + # i = +1 + +Class = Trackers + + + + From 21ec81d6a8ac42ee7397251f6558e7349a246c9a Mon Sep 17 00:00:00 2001 From: Ormanya Date: Mon, 25 Mar 2019 18:32:32 +0000 Subject: [PATCH 21/23] Cleaned up date formatting for --message flag --- plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.py b/plugin.py index a98b97e..49b1ea8 100644 --- a/plugin.py +++ b/plugin.py @@ -116,7 +116,7 @@ class Trackers(callbacks.Plugin): if interval.days < 14: time_passed = "1 week ago" else: - time_passed = "%s weeks ago" % (interval.days/7) + time_passed = "%s weeks ago" % int(interval.days/7) return time_passed From 88a71c3e6717e5bb355879732419a4d29214a6d7 Mon Sep 17 00:00:00 2001 From: Ormanya Date: Fri, 27 Dec 2019 14:46:46 -0800 Subject: [PATCH 22/23] Changed kenyz to mean --- plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin.py b/plugin.py index 49b1ea8..991dc75 100644 --- a/plugin.py +++ b/plugin.py @@ -38,9 +38,9 @@ class WebParser(): def prepareStatusString(self, site_name, status, status_headers, breakpoints, line_headers): # Specify look and feel - status_states = ["Down","Up","Iffy"] - status_symbols = ["Ⓧ","✓","◯"] - status_colours = [chr(3)+"04",chr(3)+"03",chr(3)+"07"] + status_states = ["Down","Up","Iffy","Mean"] + status_symbols = ["Ⓧ","✓","◯","💩"] + status_colours = [chr(3)+"04",chr(3)+"03",chr(3)+"07",chr(3)+"05"] # Prepare output status message outStr = [line_headers[0]] @@ -130,7 +130,7 @@ class Trackers(callbacks.Plugin): content = WebParser().getWebData(irc,url) - status = [content["Website"], content["API"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"], 2] + status = [content["Website"], content["API"], content["TrackerHTTP"], content["TrackerHTTPS"], content["IRC"], content["CableGuy"], content["Barney"], 3] status_headers = ["Site","API","Tracker","Tracker SSL","IRC","IRC Id","IRC Announce","kenyz"] breakpoints = [0] line_headers = [""] From 379185a578450db318d667d005c6a31cf16fa94f Mon Sep 17 00:00:00 2001 From: oddluck <39967334+oddluck@users.noreply.github.com> Date: Thu, 13 Feb 2020 13:19:20 +0000 Subject: [PATCH 23/23] Trackers: python 3 compatibility. --- __init__.py => Trackers/__init__.py | 0 config.py => Trackers/config.py | 0 plugin.py => Trackers/plugin.py | 0 test.py => Trackers/test.py | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename __init__.py => Trackers/__init__.py (100%) rename config.py => Trackers/config.py (100%) rename plugin.py => Trackers/plugin.py (100%) rename test.py => Trackers/test.py (100%) diff --git a/__init__.py b/Trackers/__init__.py similarity index 100% rename from __init__.py rename to Trackers/__init__.py diff --git a/config.py b/Trackers/config.py similarity index 100% rename from config.py rename to Trackers/config.py diff --git a/plugin.py b/Trackers/plugin.py similarity index 100% rename from plugin.py rename to Trackers/plugin.py diff --git a/test.py b/Trackers/test.py similarity index 100% rename from test.py rename to Trackers/test.py