We work in a visual industry and put a thumbnail on every task using coverimage and its been an awesome tool.
However for larger jobs the number of actions to upload the images is getting irksome:
click on the task and click “attach document”
click “choose files”
choose the file!
click “upload files”
click “close this window”
then the drop down menu to set the image as the thumbnail
close the task
Is there a way of automating this or at least in reducing the number of steps required?
We’re looking at uploading the tasks themselves using a csv file. A pointer in there to an image file that is then configured as the thumbnail would be great.
`def createShot(shotName,thumbnailPathFileName): #authenticate as user
kb = Kanboard(‘https://URL to my kanboard jsonrpc.php’, userName, token)
kb.get_my_projects()
#get the project
project = kb.getProjectByName(name=projectName)
project_id=project['id']
#create a task
task_id = kb.create_task(project_id=project_id, title=shotName)
# encode the image as a base64 string
with open(thumbnailPathFileName,"rb") as image_file:
encoded_string = base64.b64encode(image_file.read())
thumbnailFileName = ntpath.basename(thumbnailPathFileName)
thumbnail_id = kb.createTaskFile(project_id=project_id,task_id=task_id,filename=thumbnailFileName, blob=encoded_string)
#set metadata to make coverimage display the image
kb.saveTaskMetadata(task_id=task_id, ??? thumbnail_id ???
`
I just don’t know how to specify the metadata data as a parameter that saveTaskMetadata() will accept - more correctly, python will interpret correctly. json is expecting an array.
The rest of the code works as expected.
Thanks
Edit: hmm, can’t get the formatting to make sense but I think you’ll get the idea