示例#1
0
    def index(self, id=None):
        c.views = self.VIEWS
        c.view = id if id in c.views else sorted(c.views)[0]
        c.title = c.views[c.view]
        c.rt_globals = self.rt_globals
     
        if c.view == "icons":
            c.icons = sorted(os.path.splitext(name)[0]
                for name in os.listdir(os.path.join(os.path.dirname(__file__), "../public/img/svg/icons"))
                if name.endswith(".svg")
            )
        elif c.view == "rtorrent":
            c.proxy = rtorrent.Proxy()
            if request.params.get("methods"):
                c.methods = defaultdict(list)
                for method in c.proxy.rpc.system.listMethods():
                    c.methods[method[0].upper()].append((method, (
                        c.proxy.rpc.system.methodSignature(method), 
                        c.proxy.rpc.system.methodHelp(method),
                    )))
        elif c.view == "json":
            c.json_api = dict((method, getattr(getattr(JsonController, method), '__doc__'))
                for method in dir(JsonController)
                if not method.startswith('_') 
                and method != 'index'
                and callable(getattr(JsonController, method))
            )

        # Return a rendered template
        return render("pages/sandbox.mako")
示例#2
0
    def index(self, id=None):
        c.views = self.VIEWS
        c.view = id if id in c.views else sorted(c.views)[0]
        c.title = c.views[c.view]
        c.rt_globals = self.rt_globals

        if c.view == "icons":
            c.icons = sorted(
                os.path.splitext(name)[0]
                for name in os.listdir(os.path.join(os.path.dirname(__file__), "../public/img/svg/icons"))
                if name.endswith(".svg")
            )
        elif c.view == "rtorrent":
            c.proxy = rtorrent.Proxy()
            if request.params.get("methods"):
                c.methods = defaultdict(list)
                for method in c.proxy.rpc.system.listMethods():
                    c.methods[method[0].upper()].append(
                        (method, (c.proxy.rpc.system.methodSignature(method), c.proxy.rpc.system.methodHelp(method)))
                    )
        elif c.view == "json":
            c.json_api = dict(
                (method, getattr(getattr(JsonController, method), "__doc__"))
                for method in dir(JsonController)
                if not method.startswith("_") and method != "index" and callable(getattr(JsonController, method))
            )

        # Return a rendered template
        return render("pages/sandbox.mako")
示例#3
0
    def view(self, id):
        c.hash = id
        c.name = id

        c.torrents = list(rtorrent.View(self.proxy, "incomplete").items())

        # Return a rendered template
        return render("pages/torrent.mako")
示例#4
0
    def view(self, id):
        c.hash = id
        c.name = id

        c.torrents = list(rtorrent.View(self.proxy, "incomplete").items())

        # Return a rendered template
        return render("pages/torrent.mako")
示例#5
0
    def list(self, id):
        c.view = self.views[id]

        # Get list of torrents
        if c.view.get("stock", True):
            # Built-in view
            c.torrents = list(rtorrent.View(self.proxy, id).items())
        else:
            # Handle non-stock views
            c.torrents = getattr(self, "_get_" + id)()
        
        # Handle filter
        c.torrents_unfiltered = len(c.torrents)
        c.filter = self._normalized_filter()
        c.torrents = self._filter(c.torrents, c.filter)

        # Build view model
        self._model_fixup()
        
        # Return a rendered template
        return render("pages/view.mako")
示例#6
0
    def list(self, id):
        c.view = self.views[id]

        # Get list of torrents
        if c.view.get("stock", True):
            # Built-in view
            c.torrents = list(rtorrent.View(self.proxy, id).items())
        else:
            # Handle non-stock views
            c.torrents = getattr(self, "_get_" + id)()

        # Handle filter
        c.torrents_unfiltered = len(c.torrents)
        c.filter = self._normalized_filter()
        c.torrents = self._filter(c.torrents, c.filter)

        # Build view model
        self._model_fixup()

        # Return a rendered template
        return render("pages/view.mako")
示例#7
0
 def _render(self):
     return render("/pages/stats.mako")
示例#8
0
 def _render(self):
     return render("/pages/admin.mako")
示例#9
0
 def _render(self):
     return render("/pages/stats.mako")
示例#10
0
    def index(self):
        # Build model
        c.page = WikiPage.open("PyroScope")

        # Return a rendered template
        return render("/pages/index.mako")
示例#11
0
    def wiki(self, id):
        # Build model
        c.page = WikiPage.open(id)

        # Return a rendered template
        return render("pages/help.mako")
示例#12
0
    def index(self):
        # Build model
        c.page = WikiPage.open("PyroScope")

        # Return a rendered template
        return render("/pages/index.mako")
示例#13
0
 def _render(self):
     return render("/pages/admin.mako")