summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpepperpepperpepper <pepper@scannerjammer.com>2016-03-01 16:24:00 -0800
committerpepperpepperpepper <pepper@scannerjammer.com>2016-03-01 16:24:00 -0800
commit6f1d39fc12ce4a87dff5e1ac39fdab447e0ea68f (patch)
tree2e9e3b537be4e6cc229bc1a1427d74c84bd30cc6
parent46681c0088ac43d4d626e793d09583173f3c0ba7 (diff)
better
-rw-r--r--photoblaster/_file.py8
-rw-r--r--photoblaster/modules/base.py10
-rwxr-xr-xphotoblaster/modules/pbgradient.py16
-rw-r--r--run_module_examples.py4
4 files changed, 22 insertions, 16 deletions
diff --git a/photoblaster/_file.py b/photoblaster/_file.py
index 3ab1afc..0a21d51 100644
--- a/photoblaster/_file.py
+++ b/photoblaster/_file.py
@@ -19,8 +19,10 @@ class File(object):
username="",
is_temp=False,
extension=DEFAULT_FINALFORMAT,
- directory=WORKING_DIR
+ directory=WORKING_DIR,
+ classname="pb"
):
+ self._classname = classname
self._is_temp = is_temp
self.extension = extension
self._directory = directory
@@ -52,9 +54,9 @@ class File(object):
name = ""
if self._is_temp:
namepart = "temp"
+ name += "%s_%s" % (self._classname, self.get_creation_time())
if namepart:
- name += "%s-" % namepart
- name += "%s_%s" % (self.__class__.__name__, self.get_creation_time())
+ name += "_%s" % namepart
if username:
name += "_%s" % username
if self.extension:
diff --git a/photoblaster/modules/base.py b/photoblaster/modules/base.py
index 14163f5..253ad16 100644
--- a/photoblaster/modules/base.py
+++ b/photoblaster/modules/base.py
@@ -25,6 +25,8 @@ class Pb(object):
self.tag = self.__class__.__name__
self._db_url_param = None
+ self.output_file = None
+
self.width = None
self.height = None
@@ -60,7 +62,7 @@ class Pb(object):
b = cls(**example_params)
b.create()
if verbose:
- sys.stderr.write("generated %s\n" % b.newfile.get_filepath())
+ sys.stderr.write("generated %s\n" % b.output_file.get_filepath())
sys.stderr.write("files created %s\n" % b._files_created)
sys.stderr.write("commands:\n %s\n" % ";\n ".join(b.commands))
return b
@@ -72,13 +74,13 @@ class Pb(object):
):
try:
_insert_data = {
- 'date': self.newfile.get_creation_time(),
+ 'date': self.output_file.get_creation_time(),
'remote_addr': remote_addr,
'name': str(self.params.username),
'url': self._db_url_param,
- 'dir': self.newfile.get_hashdir(),
+ 'dir': self.output_file.get_hashdir(),
'oldfile': None,
- 'newfile': self.newfile.get_filename(),
+ 'newfile': self.output_file.get_filename(),
'dataobj': json.dumps(dict(self._input_kwargs)),
'cmd': "; ".join(self.commands),
'tag': self.tag,
diff --git a/photoblaster/modules/pbgradient.py b/photoblaster/modules/pbgradient.py
index bf6bdd2..b65412c 100755
--- a/photoblaster/modules/pbgradient.py
+++ b/photoblaster/modules/pbgradient.py
@@ -83,16 +83,18 @@ class PbGradient(Pb):
self.params.definitions_import(
_definitions, kwargs, classname=self.__class__.__name__)
- namepart = "%s%s-%s" % (
- self.__class__.__name__,
+ namepart = "%s-%s" % (
str(self.params.color1).replace(
'#', '').replace('(', '-').replace(')', '-'),
str(self.params.color2).replace(
'#', '').replace('(', '-').replace(')', '-')
)
- if self.params.username:
- namepart += "_%s" % self.params.username
- self.newfile = File(namepart=namepart, extension=self.params.filetype)
+ self.output_file = File(
+ namepart=namepart,
+ extension=self.params.filetype,
+ classname=self.__class__.__name__,
+ username=self.params.username
+ )
def _build_cmd(self):
cmd = [BIN_CONVERT]
@@ -184,7 +186,7 @@ class PbGradient(Pb):
self.params.hue or "100"
)
]
- cmd.append(self.newfile.get_filepath())
+ cmd.append(self.output_file.get_filepath())
self._call_cmd(cmd)
if self.params.bevel:
self._make_bevel()
@@ -222,7 +224,7 @@ class PbGradient(Pb):
def _make_bevel(self):
cmd = [BEVELBORDER]
cmd += self._get_bevelvalue()
- cmd += [self.newfile.get_filepath(), self.newfile.get_filepath()]
+ cmd += [self.output_file.get_filepath(), self.output_file.get_filepath()]
self._call_cmd(cmd)
def create(self):
diff --git a/run_module_examples.py b/run_module_examples.py
index 779a6e8..54b8a30 100644
--- a/run_module_examples.py
+++ b/run_module_examples.py
@@ -5,6 +5,6 @@ for cls in Pb.__subclasses__():
print cls.__name__
if cls.__name__ == "PbGradient":
instance = cls.example_run()
- print instance.newfile.as_dict()
- instance.newfile.s3move()
+ print instance.output_file.as_dict()
+ instance.output_file.s3move()
instance.db_send()