# Path: pyrikura/config.py
# def reload(path):


from pyrikura.config import Config
import os
import pygame
import logging

loaded = False
sounds = None
images = None
music = None


def load():
    global sounds, images, music, loaded

    if loaded:
        logger.debug('want to load resources, but already have')
        return

    logger.debug('loading resources...')

    sounds = dict()
    images = dict()
    music = dict()

    if Config.has_section('sound-files'):
        vol = Config.getint('sound', 'sound-volume') / 100.
        for name, filename in Config.items('sound-files'):
            path = jpath(resource_path, 'sounds', filename)
            logger.info("loading %s", path)
            sound = pygame.mixer.Sound(path)
            sound.set_volume(vol)
            sounds[name] = sound

    if Config.has_section('image-files'):

# Path: pyrikura/config.py
# def reload(path):


# Path: pyrikura/resources.py
from pyrikura.config import Config
import os
import pygame
import logging


loaded = False
sounds = None
images = None
music = None


def load():
    global sounds, images, music, loaded

    if loaded:
        logger.debug('want to load resources, but already have')
        return

    logger.debug('loading resources...')

    sounds = dict()
    images = dict()
    music = dict()

    if Config.has_section('sound-files'):
        vol = Config.getint('sound', 'sound-volume') / 100.
        for name, filename in Config.items('sound-files'):
            path = jpath(resource_path, 'sounds', filename)
            logger.info("loading %s", path)
            sound = pygame.mixer.Sound(path)
            sound.set_volume(vol)
            sounds[name] = sound

    if Config.has_section('image-files'):

        for name, filename in Config.items('image-files'):