Ejemplo n.º 1
0
def system():
    about_info = OrderedDict()
    about_info['Hostname'] = platform.node()
    about_info['Platform'] = "{0} ({1})".format(platform.platform(), platform.architecture()[0])
    about_info['Python'] = "{0} {1}".format(platform.python_implementation(), platform.python_version())
    about_info['Uptime-Sys'] = time.strftime("%H:%M:%S", time.gmtime(util.uptime_sys()))
    about_info['Uptime-App'] = time.strftime("%H:%M:%S", time.gmtime(util.uptime_app()))
    try:
        # TODO Win/OSX support
        if hasattr(sys, "real_prefix"):
            about_info['Distribution'] = "VirtualEnv"
        else:
            distro = platform.linux_distribution()
            if distro[0]:
                about_info['Distribution'] = "{0} {1} {2}".format(distro[0], distro[1], distro[2])
    except IndexError:
        pass

    # Get disk info and sort it by path
    disk_info = util.disk_free()
    sorted_disk_info = OrderedDict()
    for key in sorted(disk_info.keys()):
        sorted_disk_info[key] = disk_info[key]

    return ui.render_template("system.html", section="tranny", info=about_info, disk_info=sorted_disk_info)
Ejemplo n.º 2
0
def index():
    feed_data = {}
    for section in config.find_sections("rss_"):
        settings = config.get_section_values(section)
        # for key, default, type_func in option_set:
        #     settings[key] = config.get_default(section, key, default, type_func)
        if not "enabled" in settings:
            try:
                enabled = config.getboolean(section, "enabled")
            except NoOptionError:
                enabled = False
            settings['enabled'] = "0" if enabled else "1"
        tpl_key = section.split("_")[1]
        feed_data[tpl_key] = settings
    return ui.render_template("rss.html", section="rss", feeds=feed_data)
Ejemplo n.º 3
0
def index():
    section_data = []
    for section in ['tv', 'movies']:
        config_section = "section_{0}".format(section)
        section_info = {}
        for key in ['dl_path', 'group_name', 'sort_seasons']:
            try:
                section_info[key] = config.get(config_section, key)
            except (NoOptionError, NoSectionError):
                pass
        for key in ['quality_hd', 'quality_sd', 'quality_any']:
            try:
                values = [" ".join(show.split()) for show in config.get(config_section, key).split(",") if show]
                if values:
                    section_info[key] = values

            except (NoOptionError, NoSectionError):
                pass
        section_info['section'] = section
        section_data.append(section_info)
    return ui.render_template("filters.html", section_data=section_data, section="filters")
Ejemplo n.º 4
0
 def server_error_page(error):
     return ui.render_template("errors/server_error.html", error=error), httplib.INTERNAL_SERVER_ERROR
Ejemplo n.º 5
0
 def page_not_found(error):
     return ui.render_template("errors/page_not_found.html", error=error), httplib.NOT_FOUND
Ejemplo n.º 6
0
 def forbidden_page(error):
     return ui.render_template("errors/forbidden_page.html", error=error), httplib.FORBIDDEN
Ejemplo n.º 7
0
 def server_error_page(error):
     return ui.render_template(
         "errors/server_error.html",
         error=error), http.client.INTERNAL_SERVER_ERROR
Ejemplo n.º 8
0
 def page_not_found(error):
     return ui.render_template("errors/page_not_found.html",
                               error=error), http.client.NOT_FOUND
Ejemplo n.º 9
0
 def forbidden_page(error):
     return ui.render_template("errors/forbidden_page.html",
                               error=error), http.client.FORBIDDEN
Ejemplo n.º 10
0
def login():
    return ui.render_template("login.html")
Ejemplo n.º 11
0
def index():
    service_info = {k: config.get_section_values(k) for k in config.find_sections("service_")}
    return ui.render_template("services.html", section="services", service_info=service_info)
Ejemplo n.º 12
0
def syslog():
    return ui.render_template("syslog.html", section="syslog", logs=[])
Ejemplo n.º 13
0
def index():
    newest = models.DownloadEntity.query.limit(25).all()
    return ui.render_template("index.html", newest=newest, section="stats")