Mapilliary_tools v0.10: Image paths in .json?

Having updated from v0.7, I’m trying to update my uploader process to work with the newer v0.10 tools.

The ‘zip’ command looks good, but I can’t get it work (see Mapilliary_tools v0.10: How to use zip option?). So for now I’m just using ‘process’ and ‘upload’ as before.

My process works by having one thread pick up a sequence folder from a queue, running ‘process’ on it, and when complete, moving the sequence folder into a working folder.

Another thread picks up sequences from the working folder, and runs ‘upload’ on them, dropping them into a completed folder when finished.

A final thread picks up sequences from the completed folder, does some tidying up and then moves them to the right place in my big fat archive of uploaded images.

Uploads are now failing because the .json file contains absolute paths to the jpgs, and when I move the sequence between the queue and the working folder, the images aren’t where the .json says they are, so nothing uploads.

Seeing as the .json file sits inside the same folder as the .jpgs, is there any reason why the paths in there need to be full, absolute paths?

FYI, as a workaround I’m now having to do this before uploading:

file_in = os.path.join(FOLDER_REMOTE_PREPARING, entry.name, 'mapillary_image_description.json')
file_out = os.path.join(FOLDER_REMOTE_PREPARING, entry.name, 'mapillary_image_description.tmp')
with open(file_in, 'rt') as fin:
    with open(file_out, 'wt') as fout:
        for line in fin:
            fout.write(line.replace(FOLDER_REMOTE_PREPARING, FOLDER_REMOTE_UPLOADING)) 
os.replace(file_out, file_in)

Seeing as the .json file sits inside the same folder as the .jpgs, is there any reason why the paths in there need to be full, absolute paths?

It is because of multiple folders support. For example you can can process or upload

mapillary_tools process images/ videos/ gopro/*.jpg

Since a single json is generated, we have to switch to absolute paths to reference files in different locations.