degal/config.py
author Tero Marttila <terom@fixme.fi>
Sun, 14 Jun 2009 20:05:11 +0300
changeset 117 a2e4562deaab
parent 111 ecceaf23c969
child 118 60b126ff0b74
permissions -rw-r--r--
implement concurrency... :)
"""
    Configuration
"""

import logging

class Configuration (object) :
    """
        Various configuration settings
    """
    ## runtime settings

    # the path to the gallery
    gallery_path        = "."
    
    # force-update items
    force_thumb         = False
    force_html          = False

    # minimum logging level
    log_level           = logging.INFO

    # number of threads to use for concurrency
    thread_count        = 2

    ## detailed configuration
    # the name of the gallery
    gallery_title       = "Image Gallery"

    # recognized image extensions
    image_exts          = ('jpg', 'jpeg', 'png', 'gif', 'bmp')
    
    # subdirectory used for generated thumbnails/previews
    thumb_dir           = 'thumbs'
    preview_dir         = 'previews'

    # size of generated thumbnails/previews
    thumb_size          = (160, 120)
    preview_size        = (640, 480)

    # number of images displayed per folder page
    images_per_page     = 50
    
    # load Exif data for images
    # this may be slow
    exif_enabled        = False

    # exif tags used in output
    # Copyright (C) 2008, Santtu Pajukanta <santtu@pajukanta.fi>
    # XXX: import from dexif?
    exif_tags           = [
        # TODO Create date is in a useless format, needs some strptime love
        ("CreateDate",              "Create date"               ),
        ("Model",                   "Camera model"              ),
        ("Aperture",                "Aperture"                  ),
        ("ExposureMode",            "Exposure mode"             ),
        ("ExposureCompensation",    "Exposure compensation"     ),
        ("ExposureTime",            "Exposure time"             ),
        ("Flash",                   "Flash mode"                ),
        ("ISO",                     "ISO"                       ),
        ("ShootingMode",            "Shooting mode"             ),
        ("LensType",                "Lens type"                 ),
        ("FocalLength",             "Focal length"              )
    ]
    

    ### functions
    def is_image (self, file) :
        """
            Tests if the given File is an image, based on its file extension
        """

        return file.matchext(self.image_exts)