Exemple #1
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
from lib.smugmug import API, SmugmugException
from lib.logging_utils import setup_logging
from lib.decorators import memoize
from ConfigParser import ConfigParser
from os import path, makedirs
from jinja2 import Template
import codecs
import locale
import logging
import shutil
import sys

setup_logging('generate_static.log')

# Wrap sys.stdout into a StreamWriter to allow writing unicode.
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout) 

def album_matches(album_spec, album_info):
    chunks = album_spec.split('/')
    key = None
    if len(chunks) == 1: 
        key = [album_info['Title']]
    elif len(chunks) == 2: 
        key = [album_info['Category']['Name'], album_info['Title']] 
    elif len(chunks) == 3: 
        key = [album_info['Category']['Name'],
               album_info.get('SubCategory', {'Name': ''})['Name'],
               album_info['Title']] 
Exemple #2
0
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
from collections import defaultdict
from os import path, makedirs
from lib.index import Index
from lib.config import should_index
from lib.fs_utils import (unicode_walk, md5, stat, get_date, flat_walk, move, copy)
from lib.image_utils import autorotate
from lib.logging_utils import setup_logging
import logging
import codecs
import re
import locale
import sys

setup_logging('import.log')

# Wrap sys.stdout into a StreamWriter to allow writing unicode.
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout) 

def get_parser():
    parser = ArgumentParser()
    parser.add_argument('from_dir', help='Directory to import from.')
    parser.add_argument('to_dir', help='Import to. Should have pictures.db.')
    parser.add_argument('--dry-run', help="Don't do anything",
                        default=False, action='store_true')
    parser.add_argument('--move', help='Move, do not copy',
                        default=False, action='store_true')
    parser.add_argument('--directory-for-date',
                        help='Use directory name instead of detecting dates.',
                        default=False, action='store_true')
Exemple #3
0
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
from lib.index import Index
from lib.smugmug import API, SmugmugException
from lib.logging_utils import setup_logging
from lib.decorators import memoize
from lib.fs_utils import read_exif
from ConfigParser import ConfigParser
from os import path
import logging
import codecs
import locale
import sys
import re

setup_logging('upload.log')

# Wrap sys.stdout into a StreamWriter to allow writing unicode.
sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout) 


def is_ascii(path):
    return all(ord(ch) < 128 for ch in path)

def get_parser():
    parser = ArgumentParser()
    parser.add_argument('archive_dir', help='Home directory.')
    parser.add_argument('--config', help='Path to config file.', default='config.ini')
    parser.add_argument('--skip-unicode-filenames', default=False,
                        action='store_true')
    parser.add_argument('--move', default=False, action='store_true',