Exemplo n.º 1
0
def init_client(client_type=None):
    """ Import & initialize the client set in the configuration file and return the
    usable instance.

    :param client_type: Manually specify a client to load
    :type client_type: unicode
    :return: Configured backend torrent instance
    :rtype: ClientProvider
    """
    if not client_type:
        client_type = config.get_default("general", "client",
                                         "transmission").lower()
    if client_type == "rtorrent":
        from tranny.client.rtorrent import RTorrentClient as Client
    elif client_type == "transmission":
        from tranny.client.transmission import TransmissionClient as Client
    elif client_type == "utorrent":
        # from tranny.client.utorrent import UTorrentClient as TorrentClient
        raise NotImplementedError(
            "Utorrent support is currently incomplete. Please use another client"
        )
    elif client_type == "deluge":
        from tranny.client.deluge import DelugeClient as Client
    elif client_type == "simplefile":
        from tranny.client.simplefile import SimpleFileClient as Client
    else:
        raise ConfigError(
            "Invalid client type supplied: {0}".format(client_type))
    config_values = config.get_section_values(Client.config_key)

    client = Client(**config_values)
    from tranny.app import plugin_manager
    plugin_manager.register(client)

    return client
Exemplo n.º 2
0
def init_client(client_type=None):
    """ Import & initialize the client set in the configuration file and return the
    usable instance.

    :param client_type: Manually specify a client to load
    :type client_type: unicode
    :return: Configured backend torrent instance
    :rtype: ClientProvider
    """
    if not client_type:
        client_type = config.get_default("general", "client", "transmission").lower()
    if client_type == "rtorrent":
        from tranny.client.rtorrent import RTorrentClient as Client
    elif client_type == "transmission":
        from tranny.client.transmission import TransmissionClient as Client
    elif client_type == "utorrent":
        #from tranny.client.utorrent import UTorrentClient as TorrentClient
        raise NotImplementedError("Utorrent support is currently incomplete. Please use another client")
    elif client_type == "deluge":
        from tranny.client.deluge import DelugeClient as Client
    else:
        raise ConfigError("Invalid client type supplied: {0}".format(client_type))
    config_values = config.get_section_values(Client.config_key)

    return Client(**config_values)
Exemplo n.º 3
0
def index():
    """ Generate config data for all the sections in the config

    :return: Config data
    :rtype: dict
    """
    groups = OrderedDict([
        ('General', ['General', 'WebUI', 'Ignore', 'Log', 'Proxy']),
        ('Sections', ['section_TV', 'section_Movie']),
        ('Services', ['service_IMDB', 'service_TheMovieDB']),
        ('Clients', [
            'client_uTorrent', 'client_Transmission', 'client_rTorrent',
            'client_Deluge'
        ]),
    ])
    settings_data = OrderedDict()
    for group, sections in list(groups.items()):
        settings_data[group] = {}
        for s in sections:
            settings_data[group][s] = config.get_section_values(s.lower())
    # TODO Remove these hardcoded keys and look for bool like values instead?
    bool_values = ['enabled', 'sort_seasons', 'group_name', 'fetch_proper']
    select_values = ['type']
    ignore_keys = ['quality_sd', 'quality_hd', 'quality_any']
    return dict(settings=settings_data,
                bool_values=bool_values,
                select_values=select_values,
                ignore_keys=ignore_keys)
Exemplo n.º 4
0
def index():
    """ Generate and render a list of provider configs

    :return: Provider configs
    :rtype: dict
    """
    provider_info = {k: config.get_section_values(k) for k in config.find_sections("provider_")}
    return dict(provider_info=provider_info)
Exemplo n.º 5
0
def index():
    """ Generate and render a list of provider configs

    :return: Provider configs
    :rtype: dict
    """
    provider_info = {
        k: config.get_section_values(k)
        for k in config.find_sections("provider_")
    }
    return dict(provider_info=provider_info)
Exemplo n.º 6
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)
Exemplo n.º 7
0
def index():
    """ Generate feed configuration data from the local config and show
    it to the user to allow editing

    :return: RSS Configuration
    :rtype: dict
    """
    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.partition("_")[2]
        feed_data[tpl_key] = settings
    return dict(feeds=feed_data)
Exemplo n.º 8
0
def index():
    """ Generate feed configuration data from the local config and show
    it to the user to allow editing

    :return: RSS Configuration
    :rtype: dict
    """
    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.partition("_")[2]
        feed_data[tpl_key] = settings
    return dict(feeds=feed_data)
Exemplo n.º 9
0
def index():
    """ Generate config data for all the sections in the config

    :return: Config data
    :rtype: dict
    """
    groups = OrderedDict(
        [
            ("General", ["General", "WebUI", "Ignore", "Log", "Proxy"]),
            ("Sections", ["section_TV", "section_Movie"]),
            ("Services", ["service_IMDB", "service_TheMovieDB"]),
            ("Clients", ["client_uTorrent", "client_Transmission", "client_rTorrent", "client_Deluge"]),
        ]
    )
    settings_data = OrderedDict()
    for group, sections in groups.items():
        settings_data[group] = {}
        for s in sections:
            settings_data[group][s] = config.get_section_values(s.lower())
    # TODO Remove these hardcoded keys and look for bool like values instead?
    bool_values = ["enabled", "sort_seasons", "group_name", "fetch_proper"]
    select_values = ["type"]
    ignore_keys = ["quality_sd", "quality_hd", "quality_any"]
    return dict(settings=settings_data, bool_values=bool_values, select_values=select_values, ignore_keys=ignore_keys)
Exemplo n.º 10
0
 def make_client(self):
     return TransmissionClient(
         **config.get_section_values(TransmissionClient.config_key))
Exemplo n.º 11
0
 def make_client(self):
     client = DelugeClient(
         **config.get_section_values(DelugeClient.config_key))
     client.authenticate()
     return client
Exemplo n.º 12
0
 def make_client(self):
     return TransmissionClient(**config.get_section_values(TransmissionClient.config_key))
Exemplo n.º 13
0
 def make_client(self):
     client = DelugeClient(**config.get_section_values(DelugeClient.config_key))
     client.authenticate()
     return client
Exemplo n.º 14
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)