# 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/db.py
# class Series(Base):
# class Chapter(Base):
# class Group(Base):
#     def __init__(self, series):
#     def alias_lookup(alias, unfollowed=False):
#     def check_alias_uniqueness(self):
#     def last_added(self):
#     def mark_as_updated(self):
#     def needs_update(self):
#     def ordered_chapters(self):
#     def release_interval(self):
#     def __init__(self, chapter, series):
#     def find_new(alias=None):
#     def group_tag(self):
#     def status(self):
#     def to_object(self):
#     def __init__(self, name):
#     def __str__(self):
# def backup_database():
# def initialize():
# def test_database():
# 
# 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):


from abc import ABCMeta, abstractmethod
from concurrent.futures import ThreadPoolExecutor
from cum import config, db, output
from mimetypes import guess_extension
from re import match, sub
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from sqlalchemy.orm.exc import NoResultFound
from tempfile import NamedTemporaryFile
import click
import os
import requests
import sys
import zipfile
                self.mark_downloaded()
        elif use_db:
            output.warning('Removing {} {}: missing from remote'
                           .format(self.name, self.chapter))
            self.db_remove()

    @staticmethod
    def guess_extension(mime_type):
        """Wrapper for mimetypes.guess_extension() to normalize extensions."""
        ext = guess_extension(mime_type)
        if ext in ['.jpeg', '.jpe']:
            return '.jpg'
        return ext

    def ignore(self):
        """Fetches the chapter from the database and marks it ignored."""
        c = db.session.query(db.Chapter).filter_by(url=self.url).one()
        c.downloaded = -1
        db.session.commit()

    def mark_downloaded(self):
        """Fetches the chapter from the database and marks it downloaded."""
        c = db.session.query(db.Chapter).filter_by(url=self.url).one()
        c.downloaded = 1
        db.session.commit()

    def mark_new(self):
        """Fetches the chapter from the database and marks it new."""
        c = db.session.query(db.Chapter).filter_by(url=self.url).one()
        c.downloaded = 0

# 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/db.py
# class Series(Base):
# class Chapter(Base):
# class Group(Base):
#     def __init__(self, series):
#     def alias_lookup(alias, unfollowed=False):
#     def check_alias_uniqueness(self):
#     def last_added(self):
#     def mark_as_updated(self):
#     def needs_update(self):
#     def ordered_chapters(self):
#     def release_interval(self):
#     def __init__(self, chapter, series):
#     def find_new(alias=None):
#     def group_tag(self):
#     def status(self):
#     def to_object(self):
#     def __init__(self, name):
#     def __str__(self):
# def backup_database():
# def initialize():
# def test_database():
# 
# 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/scrapers/base.py
from abc import ABCMeta, abstractmethod
from concurrent.futures import ThreadPoolExecutor
from cum import config, db, output
from mimetypes import guess_extension
from re import match, sub
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from sqlalchemy.orm.exc import NoResultFound
from tempfile import NamedTemporaryFile
import click
import os
import requests
import sys
import zipfile

                self.mark_downloaded()
        elif use_db:
            output.warning('Removing {} {}: missing from remote'
                           .format(self.name, self.chapter))
            self.db_remove()

    @staticmethod
    def guess_extension(mime_type):
        """Wrapper for mimetypes.guess_extension() to normalize extensions."""
        ext = guess_extension(mime_type)
        if ext in ['.jpeg', '.jpe']:
            return '.jpg'
        return ext

    def ignore(self):
        """Fetches the chapter from the database and marks it ignored."""
        c = db.session.query(db.Chapter).filter_by(url=self.url).one()
        c.downloaded = -1
        db.session.commit()

    def mark_downloaded(self):
        """Fetches the chapter from the database and marks it downloaded."""
        c = db.session.query(db.Chapter).filter_by(url=self.url).one()
        c.downloaded = 1
        db.session.commit()

    def mark_new(self):
        """Fetches the chapter from the database and marks it new."""
        c = db.session.query(db.Chapter).filter_by(url=self.url).one()
        c.downloaded = 0

        db.session.commit()