diff options
| author | yo mama <pepper@scannerjammer.com> | 2016-08-23 11:08:54 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2016-08-23 11:08:54 -0700 |
| commit | c42f2684cad8d29b20540076349cc2fcec1573c9 (patch) | |
| tree | 59ec71564e34a418e1f88a7475dec0e6b1f74a68 | |
| parent | 0c238e0bd38573f4b8fa2fdf16d46960f9920fec (diff) | |
good
| -rw-r--r-- | photoblaster/_file.py | 8 | ||||
| -rw-r--r-- | photoblaster/config.py | 7 | ||||
| -rwxr-xr-x | photoblaster/modules/pbpattern/__init__.py | 2 | ||||
| -rw-r--r-- | photoblaster/server.py | 7 | ||||
| -rw-r--r-- | run_server.py | 11 | ||||
| -rw-r--r-- | share/frontend/imconcat/index.html | 20 |
6 files changed, 43 insertions, 12 deletions
diff --git a/photoblaster/_file.py b/photoblaster/_file.py index 3db52b8..a5a04ef 100644 --- a/photoblaster/_file.py +++ b/photoblaster/_file.py @@ -6,7 +6,8 @@ import sys import time from subprocess import Popen, PIPE, call from photoblaster.config import WORKING_DIR, BIN_IDENTIFY, \ - BIN_CONVERT, BASE_URL, DEFAULT_FINALFORMAT, BIN_GIFSICLE + BIN_CONVERT, BASE_URL, DEFAULT_FINALFORMAT, BIN_GIFSICLE,\ + SERVER_PORT, SERVER_HOST from photoblaster.s3.cli import S3Cli _MAX_FILENAME_LENGTH = 20 @@ -142,7 +143,10 @@ class File(object): def as_dict(self): url = "%s/im/%s/%s" % (BASE_URL, self._hashdir, self.get_filename()) if self.get_storage() == "local": - url = "/im/cache/%s" % self.get_filename() + url = "http://%s/im/cache/%s" % ( + SERVER_HOST, + self.get_filename() + ) dimensions = self.get_dimensions() return { 'url': url, diff --git a/photoblaster/config.py b/photoblaster/config.py index be972bb..e7fda7c 100644 --- a/photoblaster/config.py +++ b/photoblaster/config.py @@ -5,6 +5,8 @@ if os.environ.get("PB_PRODUCTION"): MAX_SIZE = 1024 * 1024 * 1.2 * 1.5 +if LOCAL: + MAX_SIZE = 1024 * 1024 * 1.2 * 7 # PATHS BIN_CONVERT = "/usr/bin/convert" @@ -43,7 +45,10 @@ WORKING_DIR = "/var/www/cache" STATIC_FOLDER = "../share/frontend/" # server -SERVER_HOST = '0.0.0.0' +if LOCAL: + SERVER_HOST = 'localhost' +else: + SERVER_HOST = '0.0.0.0' SERVER_PORT = 8999 # s3 diff --git a/photoblaster/modules/pbpattern/__init__.py b/photoblaster/modules/pbpattern/__init__.py index 2d73f89..772280c 100755 --- a/photoblaster/modules/pbpattern/__init__.py +++ b/photoblaster/modules/pbpattern/__init__.py @@ -20,7 +20,7 @@ class PbPattern(ModuleBase): _definitions = { 'image_url': {'type': 'img_url'}, 'pattern_url': {'type': 'img_url'}, - 'pattern_data': {'type': 'json'}, + 'pattern_data': {'type': 'json'}, 'username': {'type': 'string'}, } self.params.definitions_import( diff --git a/photoblaster/server.py b/photoblaster/server.py index 92e51f3..1205854 100644 --- a/photoblaster/server.py +++ b/photoblaster/server.py @@ -190,7 +190,10 @@ class Server(object): results = ImCmd.search(**search_params) images = results.limit(limit).offset(offset).all() if LOCAL: - images = ["/im/cache/%s" % image.newfile for image in images] + images = ["http://%s/im/cache/%s" % ( + SERVER_HOST, + image.newfile + ) for image in images] else: images = [ "http://i.asdf.us/im/%s/%s" % @@ -259,7 +262,7 @@ class Server(object): sys.stderr.write(dict(request_form)) raise InvalidUsage('Problem with server-side processing') except Exception as e: - + sys.stderr.write("Unknown Error\n") sys.stderr.write("%s\n" % e) sys.stderr.write(str(request_form)) diff --git a/run_server.py b/run_server.py index 63b932c..2e0a3c1 100644 --- a/run_server.py +++ b/run_server.py @@ -1,6 +1,7 @@ #!/usr/bin/python2 """script used to run the webserver""" import sys +from subprocess import Popen from photoblaster.server import Server from photoblaster.config import LOCAL @@ -13,8 +14,16 @@ if __name__ == "__main__": "RUNNING LOCAL VERSION OF SERVER\n" "TO RUN PRODUCTION VERSION SET ENVIRONMENT VARIABLE" "PB_PRODUCTION=1...ie\n" - "$>export PB_PRODUCTION=1" + "$>export PB_PRODUCTION=1\n" ) + #test if nginx is running + test = Popen(['pgrep', 'nginx']) + test.communicate() + if test.returncode: + sys.stderr.write( + "ERROR:\n" + "you must start nginx to serve static content\n") + sys.exit(1) server.run() else: server.run_wsgi() diff --git a/share/frontend/imconcat/index.html b/share/frontend/imconcat/index.html index c851100..86e7e3c 100644 --- a/share/frontend/imconcat/index.html +++ b/share/frontend/imconcat/index.html @@ -156,10 +156,10 @@ $(document).ready(function(){ $('form').jsonForm({ "schema": { - "img_url1": { - "type": "string", - "title": "Image Url 1:" - }, + "img_url1": { + "type": "string", + "title": "Image Url 1:" + }, "img_url2": { "type": "string", "title": "Image Url 2:" @@ -167,7 +167,7 @@ "dimensions_match": { "type": "string", "title": "Match Dimensions To:", - "enum": [ "smaller", "larger" ] + "enum": [ "smaller", "larger", "dont match dimensions" ] }, "frames_match": { "type": "string", @@ -321,6 +321,16 @@ }) } ) + $("#jsonform-0-elt-resize_switch").css( + { + "display": "inline", + "margin-left": "10px", + "margin-top": "10px", + } + ).attr("checked", true) + $("#jsonform-0-elt-resize_switch").parent().css("display", "inline") + $("#jsonform-0-elt-resize_switch").parent().parent().css("display", "inline") + $("#jsonform-0-elt-resize_switch").parent().parent().parent().css("margin-top", "10px") }) </script> |
