# Path: cum/config.py
# class BaseConfig(object):
# class MadokamiConfig(object):
#     def __init__(self):
#     def __setattr__(self, name, value):
#     def default_download_directory(self):
#     def load(self):
#     def serialize(self):
#     def write(self):
#     def __init__(self, config, dict):
#     def login(self):
# def get():
# def initialize(directory=None):
# 
# Path: cum/exceptions.py
# class CumException(Exception):
# class LoginError(CumException):
# class ScrapingError(CumException):
# class ConfigError(CumException):
#     def __init__(self, message=''):
#     def __str__(self):
#     def __init__(self, config, cursor, message=''):
# 
# Path: cum/output.py
# def chapter(msg):
# def configuration(dictionary):
# def configuration_error(config_error):
# def configuration_flatten(dictionary, parent_key=None):
# def error(msg):
# def even_columns(items, bold_first_column=False, separator_width=1):
# def list(items):
# def series(msg):
# def warning(msg):
# 
# Path: cum/version.py
# def version_string():


from cum import config, exceptions, output, version
from functools import wraps
    from cum import output
    from cum import db, sanity, utility
import click
import concurrent.futures
@click.option('--ignore', is_flag=True,
              help='Ignores the chapters for the added follows.')
def follow(urls, directory, download, ignore):
    """Follow a series."""
    chapters = []
    for url in urls:
        try:
            series = utility.series_by_url(url)
        except exceptions.ScrapingError:
            output.warning('Scraping error ({})'.format(url))
            continue
        except exceptions.LoginError as e:
            output.warning('{} ({})'.format(e.message, url))
            continue
        if not series:
            output.warning('Invalid URL "{}"'.format(url))
            continue
        series.directory = directory
        if ignore:
            series.follow(ignore=True)
            output.chapter('Ignoring {} chapters'.format(len(series.chapters)))
        else:
            series.follow()
            chapters += db.Chapter.find_new(alias=series.alias)

    if download:
        output.chapter('Downloading {} chapters'.format(len(chapters)))
        for chapter in chapters:
            try:
                chapter.get()

# Path: cum/config.py
# class BaseConfig(object):
# class MadokamiConfig(object):
#     def __init__(self):
#     def __setattr__(self, name, value):
#     def default_download_directory(self):
#     def load(self):
#     def serialize(self):
#     def write(self):
#     def __init__(self, config, dict):
#     def login(self):
# def get():
# def initialize(directory=None):
# 
# Path: cum/exceptions.py
# class CumException(Exception):
# class LoginError(CumException):
# class ScrapingError(CumException):
# class ConfigError(CumException):
#     def __init__(self, message=''):
#     def __str__(self):
#     def __init__(self, config, cursor, message=''):
# 
# Path: cum/output.py
# def chapter(msg):
# def configuration(dictionary):
# def configuration_error(config_error):
# def configuration_flatten(dictionary, parent_key=None):
# def error(msg):
# def even_columns(items, bold_first_column=False, separator_width=1):
# def list(items):
# def series(msg):
# def warning(msg):
# 
# Path: cum/version.py
# def version_string():


# Path: cum/cum.py
from cum import config, exceptions, output, version
from functools import wraps
    from cum import output
    from cum import db, sanity, utility
import click
import concurrent.futures

@click.option('--ignore', is_flag=True,
              help='Ignores the chapters for the added follows.')
def follow(urls, directory, download, ignore):
    """Follow a series."""
    chapters = []
    for url in urls:
        try:
            series = utility.series_by_url(url)
        except exceptions.ScrapingError:
            output.warning('Scraping error ({})'.format(url))
            continue
        except exceptions.LoginError as e:
            output.warning('{} ({})'.format(e.message, url))
            continue
        if not series:
            output.warning('Invalid URL "{}"'.format(url))
            continue
        series.directory = directory
        if ignore:
            series.follow(ignore=True)
            output.chapter('Ignoring {} chapters'.format(len(series.chapters)))
        else:
            series.follow()
            chapters += db.Chapter.find_new(alias=series.alias)

    if download:
        output.chapter('Downloading {} chapters'.format(len(chapters)))
        for chapter in chapters:
            try:
                chapter.get()

            except exceptions.LoginError as e: