Is there a way to make one call to search for multiple mimeTypes at once? For example, I'm trying to find all mp3 files in a folder. It seems like you need to make a call for each individual mimeType to find all the different ones, similar to this:
https://www.googleapis.com/drive/v2/files?key=aaamykeyaaa&q=mimeType='audio/mpeg' https://www.googleapis.com/drive/v2/files?key=aaamykeyaaa&q=mimeType='audio/mpeg3' https://www.googleapis.com/drive/v2/files?key=aaamykeyaaa&q=mimeType='audio/mp3'
Is there no way to include multiple mimeTypes in one query? It's very inefficient to do it this way.
Thanks.
For detecting MIME-types, use the aptly named "mimetype" command. It has a number of options for formatting the output, it even has an option for backward compatibility to "file". But most of all, it accepts input not only as file, but also via stdin/pipe, so you can avoid temporary files when processing streams.
There are 2868 known MIME types.
All MIME type information is stored in a database. The MIME database is located in the directory /usr/share/mime/ . The MIME database contains a large number of common MIME types, stored in the file /usr/share/mime/packages/freedesktop. org.
A file's MIME type specifies how a server or browser should interpret the file. For example, whether the file contains plain text, formatted HTML, an image, or a sound recording. In a Web server, MIME mappings specify how a static file should be interpreted by mapping file extensions to MIME types.
Yes you can, like this:
(mimeType = 'audio/mpeg' or mimeType = 'audio/mpeg3' or mimeType = 'audio/mp3')
The deprecated Documents List API has that where you just set "type:audio" in the query. I can't find something similar in the Drive API, but you can try using some undocumented search features:
I think they are undocumented because they don't index well. If the user has lots of files, you might need to paginate through a lot of pages with empty items before you get results. You might also get more rate limiting errors if you try to query this way because it is taxing to their servers. It might be more efficient to query each mimeType separately. The Drive API should provide a new operator (like startswith) or a new parameter for these kinds of queries (similar to the Documents List API).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With