X-Git-Url: https://git.rvb.name/vpproxy.git/blobdiff_plain/f4c36b837c66078d1dd496481b82439377d5709a..8960711387d2b34c7f8b8d8a0cc036e52c6c6f06:/plugins/debug_plugin.py diff --git a/plugins/debug_plugin.py b/plugins/debug_plugin.py new file mode 100644 index 0000000..ffa0079 --- /dev/null +++ b/plugins/debug_plugin.py @@ -0,0 +1,60 @@ +__author__ = 'rvb' +''' +Local Playlist Plugin +(based on ytv plugin by ValdikSS) + +plsylist index + +http://ip:port/index + +m3u playlists + +http://ip:port/m3u +http://ip:port/m3u/ +http://ip:port/m3u/list-name + +plain-tet channel names + +http://ip:port/list +http://ip:port/list/ +http://ip:port/list/list-name + +forward to player + +http://ip:port/play/channel-name +http://ip:port/play/list-name/channel-name +http://ip:port/play/{list-name}/(get|mp4|webm)/channel-name + +''' +import logging +import gc +from modules.PluginInterface import VPProxyPlugin +import os +from guppy import hpy +h = hpy() + +class Debug(VPProxyPlugin): + + handlers = ('debug',) + + logger = logging.getLogger('mem_debug') + + def handle(self, connection): + + connection.send_response(200) + connection.send_header('Content-Type', 'text/plain') + connection.end_headers() + + gc.set_debug(gc.DEBUG_LEAK) + + connection.wfile.write('{} objects collected\n'.format(gc.collect())) + + connection.wfile.write(h.heap()) + + def getparam(self, key): + if key in self.params: + return self.params[key][0] + else: + return None + + \ No newline at end of file