Adding the captions via the google drive sdk - google-drive-api

I have 1k+ closed captions (in the srt format) and I would like to add all of them to my videos on the google drive. Is it possible to do it via the API?
thank you
Radek

Yes, it is possible through Drive REST API. See Upload Files. You have three choices for this, Simple upload, Multipart upload and Resumable upload.
Simple upload
The most straightforward method for uploading a file is by making a simple upload request. This option is a good choice when:
The file is small enough to upload again in its entirety if the connection fails.
There is no metadata to send. This might be true if you plan to send metadata for this resource in a separate request, or if no metadata is supported or available.
Multipart upload
If you have metadata that you want to send along with the data to upload, you can make a single multipart/related request. This is a good choice if the data you are sending is small enough to upload again in its entirety if the connection fails.
Resumable upload
To upload data files more reliably, you can use the resumable upload protocol. This protocol allows you to resume an upload operation after a communication failure has interrupted the flow of data. It is especially useful if you are transferring large files and the likelihood of a network interruption or some other transmission failure is high, for example, when uploading from a mobile client app. It can also reduce your bandwidth usage in the event of network failures because you don't have to restart large file uploads from the beginning.
You may also want to see Work with Folders for inserting files in a folder.

Related

dowloading photos uploaded as google form answer with a name

I have created a google form where I collect info about workers (name famil photo etc...).
I want to download all photos uploaded through the form to my PC but I want each photo downloaded to have a name suitable to the name and family answers that the worker submitted , i.e. _.
This will be used to produce magnetic cards automatically without the need to go over each one and choose his image manually.
For uploading file, you can use the method specified in the documentation.
The Drive API allows you to upload file data when creating or
updating a File resource.
You can send upload requests in any of the following ways:
Simple upload: uploadType=media. For quick transfer of a small file (5 MB or less). To perform a simple upload, refer to
Performing a Simple Upload.
Multipart upload: uploadType=multipart. For quick transfer of a small file (5 MB or less) and metadata describing the file, all in
a single request. To perform a multipart upload, refer to
Performing a Multipart Upload.
Resumable upload: uploadType=resumable. For more reliable transfer, especially important with large files. Resumable uploads are a good
choice for most applications, since they also work for small files at
the cost of one additional HTTP request per upload. To perform a
resumable upload, refer to Performing a Resumable Upload.
Most Google API client libraries implement at least one of the
methods. Refer to the client library documentation for additional
details on how to use each of the methods.
Then you can manipulate your metadata,
Much of the information you'll need to get started inserting and
retrieving files is detailed in the Files reference. Here are a
few more important considerations for naming files and working with
metadata like thumbnails and indexable text.
Next, here is how to Specify file names and extensions
Apps should specify a file extension in the title property when
inserting files with the API. For example, an operation to insert a
JPEG file should specify something like "name": "cat.jpg" in the
metadata.
Subsequent GET requests include the read-only fileExtension
property populated with the extension originally specified in the name
property. When a Google Drive user requests to download a file, or
when the file is downloaded through the sync client, Drive builds a
full filename (with extension) based on the title. In cases where the
extension is missing, Google Drive attempts to determine the extension
based on the file's MIME type.

Google Real-Time API: How to download real time file larger than 10MB?

We are using Google real-time API for some internal communication. However, some of the files got bigger than 10MB. Now we are getting error "Requested Resource Too Large to Return" when trying to download it via the server (https://www.googleapis.com/drive/v2/files/realtime/ call).
Is there are a way to download this file using server API?
You Can try to download the file in parts/chunks as what suggested in this SO post.
For further reference, you can check this documentation about partial download.
Partial download involves downloading only a specified portion of a
file. You can specify the portion of the file you want to dowload by
using a byte range with the Range header. For example:
Range: bytes=500-999

using extract.autodesk.io and automatically download bubbles to our local server

I'm trying to use and modify the extract.autodesk.io (thanks to Cyrille Fauvel) but not yet successful. In a nut shell, this is what I want to do:
user drag-drop the design file (i'm ok with this)
I've removed the submit button - so right after uploading, extraction should begin in autodesk's server. (i've added a .done to trigger the auto-extraction : uploadFile (uri).done(function(){SubmitProjectDirect();}); )
no need to load a temp viewer for view/test
automatically download the bubble in zip file into our local server folder.
Delete uploaded model right away as our projects are mostly strictly confidential.
I'm encountering a 405 'Method not allowed' on 'api/file' sub folder, which I believe it should be autodesk's folder in the server.
Can anyone point the root urn of api/file?
I seem to get stuck on item 2 above due to the 405 error. But if get passed that one, I still need to solve 3, 4 and 5.
Appreciate any help...
In light of the additional comment above, the issue is a bit more complicated than I thought originally. In order to upload a file on the Autodesk cloud storage, you need to use specific endpoints, with a PUT verb and provide an oAuth Access Token.
It should be possible to setup the Flow.js to use all the above, but since it is a javascript library running on your client, it means anyone can steal your access token and use it illegitimately to either access your data, or consume your cloud credit to do action on your behalf.
Another issue is that the OSS minimum chunk is 5Mb - see this article, so you need to control this as well as providing OSS the byte assembly range information.
I would not recommend uploading to OSS from the client directly for security reason, but if you do not want to store on your server as a temporary storage, we can either proxy the Flow.js upload on the OSS storage or pipe the uploaded chunk on the Autodesk cloud storage. Both of the solution will be secured with no storage on your server, but traffic will continue to go via your server. I will create a branch on the github repo in a few days to demonstrate both approach.

Upload part of the file to Google drive

Is it possible to change a large file using google drive api, by uploading only changed part of the file, instead of entire file? I tried to find information about it in the API docs, but there's only support for continue uploading after connection reset. It seems to be an important feature.
No it's not possible. The Drive SDK treats files as atomic data blobs. It knows nothing about the format of content and hence what constitutes a change.

How i can get multiple files from google drive through the google drive api?

I would like to know how i could to obtain multiple files from google drive. I searched this in the reference but i not found this information. I'm building a web application that will talk to drive and retreive a link of a zip file to download. Zip of the files.
I'm using php with api v2.
That is currently not possible with the Drive API, you have to send multiple requests to retrieve multiple files.
I've been faced with a similar problem and while there's currently no way of doing this through Drive (to my knowledge), this is the solution I came up with.
I'm serving up hundreds of thousands of files to clients using a Drive folder as the storage with a custom built front-end built with the Drive API. With that many files, it's ridiculously tedious for users to download files one at a time. So the idea was to let the users select which files they'd like to download and then present them with a zip file containing the files.
To do that, first you'll need to get an array of the Drive files that you want to download whether that's some you generate programmatically or through check-boxes on the front-end. Then you'll loop through that array and grab the 'downloadURL' value for each file and perform a cURL to the url provided. Depending on how many files you're planning on handling per request you can either keep them all in memory or temporarily store them on the disk or in a database. Regardless, once you have all of the files, you can then zip them up using any number of zip libs that are out there. Then just send the resulting zip file to the user.
In our case we ended up sticking with individual file downloads because of the potentially massive amount of resources and bandwidth this can eat but it's a potential solution if you're not serving large numbers of files.
Assuming I am answering the correct query, if you place the files in a folder on google drive, then as far as I know it is possible to download as a complete group of files.