上传数百个非EXIF视频 - 使用API​​来更正日期

时间:2017-11-28 19:05:56

标签: google-drive-api google-api-python-client google-photos

我向谷歌照片上传了几百个旧的(~2009-2010)视频(mpg,mts),令我沮丧的是,EXIF元数据不存在或无法识别,所以他们都将日期标记设置为什么时候上传。

我想我可以使用Google Drive API更改modifiedTime属性,因为可以通过那里访问照片。

但是,API似乎只根据范围提供对照片空间的只读访问权限,因此我收到了权限问题。

file_metadata = {
    'modifiedTime': some_custom_date#datetime.utcnow().isoformat() + 'Z'
}
file = DRIVE.files().update(fileId=file_id,
                                    body=file_metadata,
                                    fields='id, modifiedTime').execute()

具体来说,我收到了错误

HttpError: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files/xxxxxxxxxxxxxxxxxxxxxx?fields=id%2C+modifiedTime&alt=json returned 

"The user has not granted the app yyyyyyyy write access to the file xxxxxxxxxxxxxxxxxxxxxx.">

所以问题是,是否有办法通过Drive API修改照片范围内的文件?错误本身似乎表明它是一个可以更改的权限吗?

1 个答案:

答案 0 :(得分:0)

要更改modifiedTime的值,您必须是该文件的所有者。使用Try-it为此,它对我有用。