I have the below code to download film strips for a shot but it takes 2-3 seconds which is rather slow for a 188K file. Obviously it’s not the download itself but the DB queries that are the bottleneck.
Does anybody know how to speed this up?
start = time.time()
sg = shotgun_api3.Shotgun(server, script, key)
data = sg.find_one("Shot", [["id", "is", 8832]], ["image", "filmstrip_image"])
out_img_path = "/tmp/test_filmstrip.jpg"
response = requests.get(data["filmstrip_image"])
with open(out_img_path, "wb") as out_file:
end = time.time()
The sowness is definitely the database query.
I might have to re-think the way I am writing the app and pre-cache filmstrips rather than download them on demand.
Damn, had hoped to keep that part simple.