Skip to content

Commit b65f009

Browse files
committed
Implement process_image_task()
1 parent 614bbde commit b65f009

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

go_capture/tasks.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import os
2+
from pathlib import Path
23

34
from celery import Celery
45

6+
from go_capture.sgf.process_image import process_image
7+
58
# Set the default Django settings module for the 'celery' program.
69
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'go_capture.settings')
710

@@ -24,4 +27,7 @@ def debug_task(self):
2427

2528
@app.task
2629
def process_image_task(image_filename):
27-
print(image_filename)
30+
sgf_filename = f'{Path(image_filename).stem}.sgf'
31+
with open(image_filename, 'rb') as image_file:
32+
with open(sgf_filename, 'w') as sgf_file:
33+
process_image(image_file, sgf_file)

0 commit comments

Comments
 (0)