Пример #1
0
#!/usr/bin/env python
from __future__ import unicode_literals, print_function, absolute_import
"""Locate any orphaned photos.

Usage: scripts/orphaned-photos.py <path/to/db> <path/to/static/photos>"""

import sys
import os
import codecs
import json
import glob

sys.path.append(".")
from rophako.settings import Config
Config.load_settings()

import rophako.jsondb as JsonDB


def main():
    if len(sys.argv) == 1:
        print("Usage: {} <path/to/static/photos>".format(__file__))
        sys.exit(1)

    photo_root = sys.argv[1]

    db = JsonDB.get("photos/index")
    photos = set()
    for album in db["albums"]:
        for key, data in db["albums"][album].iteritems():
            for img in ["large", "thumb", "avatar"]:
Пример #2
0
#!/usr/bin/env python
from __future__ import unicode_literals, print_function, absolute_import

"""Locate any orphaned photos.

Usage: scripts/orphaned-photos.py <path/to/db> <path/to/static/photos>"""

import sys
import os
import codecs
import json
import glob

sys.path.append(".")
from rophako.settings import Config
Config.load_settings()

import rophako.jsondb as JsonDB

def main():
    if len(sys.argv) == 1:
        print("Usage: {} <path/to/static/photos>".format(__file__))
        sys.exit(1)

    photo_root = sys.argv[1]

    db = JsonDB.get("photos/index")
    photos = set()
    for album in db["albums"]:
        for key, data in db["albums"][album].iteritems():
            for img in ["large", "thumb", "avatar"]:
Пример #3
0
# without getting a circular import error.
app = Flask(__name__,
    static_url_path="/.static",
)
Compress(app)

# We use a custom Jinja loader to support multiple template paths for custom
# and default templates. The base list of template paths to check includes
# your custom path (from config.SITE_ROOT), the "rophako/www" path for normal
# pages, and then the blueprint paths for all imported plugins. This list will
# be extended while blueprints are being loaded and passed in below to the
# jinja2.ChoiceLoader.
BLUEPRINT_PATHS = []

from rophako.settings import Config
Config.load_settings()
Config.load_plugins()

from rophako.plugin import load_plugin
from rophako.log import logger
#import rophako.model.tracking as Tracking
import rophako.utils

# String escaping for the secret key (processes \ escapes properly), the
# escape encoding name varies between Python 2 and 3.
string_escape = "string_escape" if sys.version_info[0] == 2 \
                else "unicode_escape"

app.DEBUG      = Config.site.debug == "true"
app.secret_key = bytes(Config.security.secret_key.encode("utf-8")) \
                 .decode(string_escape)
Пример #4
0
app = Flask(
    __name__,
    static_url_path="/.static",
)

# We use a custom Jinja loader to support multiple template paths for custom
# and default templates. The base list of template paths to check includes
# your custom path (from config.SITE_ROOT), the "rophako/www" path for normal
# pages, and then the blueprint paths for all imported plugins. This list will
# be extended while blueprints are being loaded and passed in below to the
# jinja2.ChoiceLoader.
BLUEPRINT_PATHS = []

from rophako.settings import Config

Config.load_settings()
Config.load_plugins()

from rophako.plugin import load_plugin
from rophako.log import logger
#import rophako.model.tracking as Tracking
import rophako.utils

# String escaping for the secret key (processes \ escapes properly), the
# escape encoding name varies between Python 2 and 3.
string_escape = "string_escape" if sys.version_info[0] == 2 \
                else "unicode_escape"

app.DEBUG = Config.site.debug == "true"
app.secret_key = bytes(Config.security.secret_key.encode("utf-8")) \
                 .decode(string_escape)