# Path: rophako/settings.py
# class ConfigHandler(object):
#     def load_settings(self):
#     def print_settings(self):
#     def load_plugins(self):
#     def __getattr__(self, section):
# 
# Path: rophako/utils.py
# def sanitize_name(name):
#     """Sanitize a name that may be used in the filesystem.
# 
#     Only allows numbers, letters, and some symbols."""
#     return re.sub(r'[^A-Za-z0-9 .\-_]+', '', name)
# 
# def remote_addr():
#     """Retrieve the end user's remote IP address. If the site is configured
#     to honor X-Forwarded-For and this header is present, it's returned."""
#     if Config.security.use_forwarded_for:
#         return request.access_route[0]
#     return request.remote_addr
# 
# Path: rophako/log.py
# class LogHandler(logging.Handler):
#     def emit(self, record):


import os
import time
import requests
import hashlib
import random
import rophako.jsondb as JsonDB
from flask import g
from PIL import Image
from rophako.settings import Config
from rophako.utils import sanitize_name, remote_addr
from rophako.log import logger
            cover=pic,
            data=index["albums"][album],
        ))

    return result


def get_album(name):
    """Get details about an album."""
    index = get_index()

    if not name in index["albums"]:
        return None

    album = index["albums"][name]
    cover = index["covers"][name]

    return dict(
        name=name,
        format=index["settings"][name]["format"],
        description=index["settings"][name]["description"],
        cover=album[cover]["thumb"],
    )


def rename_album(old_name, new_name):
    """Rename an existing photo album.

    Returns True on success, False if the new name conflicts with another
    album's name."""

# Path: rophako/settings.py
# class ConfigHandler(object):
#     def load_settings(self):
#     def print_settings(self):
#     def load_plugins(self):
#     def __getattr__(self, section):
# 
# Path: rophako/utils.py
# def sanitize_name(name):
#     """Sanitize a name that may be used in the filesystem.
# 
#     Only allows numbers, letters, and some symbols."""
#     return re.sub(r'[^A-Za-z0-9 .\-_]+', '', name)
# 
# def remote_addr():
#     """Retrieve the end user's remote IP address. If the site is configured
#     to honor X-Forwarded-For and this header is present, it's returned."""
#     if Config.security.use_forwarded_for:
#         return request.access_route[0]
#     return request.remote_addr
# 
# Path: rophako/log.py
# class LogHandler(logging.Handler):
#     def emit(self, record):


# Path: rophako/model/photo.py
import os
import time
import requests
import hashlib
import random
import rophako.jsondb as JsonDB
from flask import g
from PIL import Image
from rophako.settings import Config
from rophako.utils import sanitize_name, remote_addr
from rophako.log import logger

            cover=pic,
            data=index["albums"][album],
        ))

    return result


def get_album(name):
    """Get details about an album."""
    index = get_index()

    if not name in index["albums"]:
        return None

    album = index["albums"][name]
    cover = index["covers"][name]

    return dict(
        name=name,
        format=index["settings"][name]["format"],
        description=index["settings"][name]["description"],
        cover=album[cover]["thumb"],
    )


def rename_album(old_name, new_name):
    """Rename an existing photo album.

    Returns True on success, False if the new name conflicts with another
    album's name."""

    old_name = sanitize_name(old_name)