diff --git a/.gitignore b/.gitignore index cd2da12..a1537e9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,9 @@ !.gitignore !.gitempty *.log +*.pyc settings_local.py +env/ video/* tmp/ uploads/ -*.pyc diff --git a/bpy_checkout.py b/bpy_checkout.py index d663d4b..95ef307 100644 --- a/bpy_checkout.py +++ b/bpy_checkout.py @@ -1,8 +1,8 @@ # -*- coding: UTF-8 -*- import bpy -import sys import json +import sys def main(): if (len(sys.argv) == 8): diff --git a/bpy_render.py b/bpy_render.py index e34496f..3402d9c 100644 --- a/bpy_render.py +++ b/bpy_render.py @@ -3,13 +3,12 @@ import bpy import json import os -import sys import shutil +import sys def configure_output(): bpy.context.scene.frame_start = 0 - bpy.context.scene.frame_current = bpy.context.scene.frame_start - bpy.context.scene.frame_end = bpy.context.scene.frame_start + bpy.context.scene.frame_current = 0 bpy.context.scene.render.resolution_x = 640 bpy.context.scene.render.resolution_y = 480 bpy.context.scene.render.resolution_percentage = 100 @@ -62,11 +61,7 @@ def main(): sys.exit(3) try: configure_output() - renamed_video = file_rename(render_video(video_output)) - base_path = os.path.splitext(renamed_video)[0] - if (convert_to_webm): - subprocess.call(["avconv", "-loglevel", "0", "-y", "-i", renamed_video, "-r", "24", "-vcodec", "libvpx", base_path + ".webm"]) - subprocess.call(["rm", renamed_video]) + file_rename(render_video(video_output)) except: sys.exit(4) else: diff --git a/checkout.py b/checkout.py index c04f8db..0a2cd1e 100644 --- a/checkout.py +++ b/checkout.py @@ -1,10 +1,7 @@ # -*- coding: UTF-8 -*- -import copy import json -import math import os -import sys import subprocess getcwd = os.path.dirname(os.path.abspath(__file__)) @@ -43,7 +40,7 @@ def check_action(blend_file = "", action_name = "", action_fake_is_valid = True, else: return 3 -def render_video(blend_file = "", video_output = "", convert_to_webm = True, hide_output = False): +def render_video(blend_file = "", video_output = "", convert_to_webm = True, rm_original_video = True, hide_output = False): if (file_exists(blend_file)): if not (isinstance(blend_file, str) and isinstance(video_output, str)): return 1 @@ -56,16 +53,24 @@ def render_video(blend_file = "", video_output = "", convert_to_webm = True, hid ) if (hide_output): dev_null = open(os.devnull, 'w') - return subprocess.call(['blender', '-b', blend_file, '-noaudio', '-P', bpy_script_render, "--", json_object], stdout = dev_null, stderr = dev_null) + result_code = subprocess.call(['blender', '-b', blend_file, '-noaudio', '-P', bpy_script_render, "--", json_object], stdout = dev_null, stderr = dev_null) else: - return subprocess.call(['blender', '-b', blend_file, '-noaudio', '-P', bpy_script_render, "--", json_object]) + result_code = subprocess.call(['blender', '-b', blend_file, '-noaudio', '-P', bpy_script_render, "--", json_object]) + if (convert_to_webm): + video_mp4 = video_output.upper() + ".mp4" + video_webm = video_output.upper() + ".webm" + subprocess.call(["avconv", "-loglevel", "0", "-y", "-i", video_mp4, "-r", "24", "-vcodec", "libvpx", video_webm]) + if (rm_original_video): + subprocess.call(["rm", video_mp4]) except: return 2 + return result_code else: return 3 +""" def main(): - print("check_action return:", check_action("casa.blend")) + print("check_action return:", check_action("ENTANTO_AVATAR.blend", "ENTANTO")) # return codes # 0: [OK] Blend file and Action Name exists # 1: [ERROR] Args to check_action no match types @@ -76,8 +81,7 @@ def main(): # 6: [ERROR] Action is fake user # 7: [ERROR] Timeline Frame Count is less than 10 # 8: [ERROR] Args count no match - - print("render_video return:", render_video("casa.blend", "casa")) + print("render_video return:", render_video("ENTANTO_AVATAR.blend", "ENTANTO")) # return codes # 0: [OK] Video.mp4 generated # 1: [ERROR] Args to check_action no match types @@ -89,3 +93,4 @@ def main(): if __name__ == "__main__": main() +""" \ No newline at end of file diff --git a/corretor.py b/corretor.py index 497316e..361d80f 100644 --- a/corretor.py +++ b/corretor.py @@ -91,11 +91,12 @@ class Corretor: file.save(uploaded_file) renamed_file = os.path.join(upload_dir, secure_filename(sign_name + ".blend")) os.rename(uploaded_file, renamed_file) - if (checkout.check_action(renamed_file, sign_name) == 0): + check_result = checkout.check_action(str(renamed_file), str(sign_name)) + if (check_result == 0): result_msg = "File " + filename + " was uploaded." code = 200 else: - result_msg = "File " + filename + " has not expected structure of blend file." + result_msg = "File " + filename + " has not expected structure of blend file. " + str(check_result) code = 400 pyutil.log(result_msg) return make_response(result_msg, code) diff --git a/view/img/blender.svg b/view/img/blender.svg old mode 100755 new mode 100644 index 536481c..bc1a3a9 --- a/view/img/blender.svg +++ b/view/img/blender.svg @@ -1,4 +1,5 @@ + - - + - + diff --git a/view/img/finish.svg b/view/img/finish.svg old mode 100755 new mode 100644 index f6d4e0c..639e679 --- a/view/img/finish.svg +++ b/view/img/finish.svg @@ -1,7 +1,7 @@ - - + - + diff --git a/view/img/fix.svg b/view/img/fix.svg new file mode 100644 index 0000000..95acfd9 --- /dev/null +++ b/view/img/fix.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/view/img/paperclip.svg b/view/img/paperclip.svg old mode 100755 new mode 100644 index 9e5ad8b..d55b273 --- a/view/img/paperclip.svg +++ b/view/img/paperclip.svg @@ -1,17 +1,18 @@ - - + - + diff --git a/view/img/skip.svg b/view/img/skip.svg old mode 100755 new mode 100644 index 2d006dc..7caf611 --- a/view/img/skip.svg +++ b/view/img/skip.svg @@ -1,7 +1,7 @@ - - + - + -- libgit2 0.21.2