Google Drive API – the case of the unprocessed video files

We’ve been using the Google Drive API uploader for quite a while now. The main lesson we took away from using Google service, specifically from their API is that things will break for more or less valid reasons. That’s not to say we’re unhappy with the way things are going, by and large Google provides amazing service.

To answer quirks, we’ve done everything from handling 2 http response codes to crawling folders to add & remove user permissions or they wouldn’t see the folders that were shared with their groups.

The last bug we’ve had on our radar for a while is that of the Video files that mysteriously would go unprocessed.Screen Shot 2015-01-15 at 16.27.21Leave them for days they will never get encoded. Everything about the file is right but specifically the md5 checksum reported by Google. The only way to have it processed is to re-upload it. After months of chasing down such files we finally found a programmatic way to “kick” the processing.

When a file is in this state, it does not contain the “thumbnail” attribute, this is how you find them. Then if its “createdDate” attribute is older than X hours, you can run API calls to copy it and delete the original.

Screen Shot 2015-01-15 at 20.15.23

Of course this assumes you’re already knee deep into API land.