azai91/alfred-drive-workflow

Can't find `.pdf` or `.psd`

Opened this issue · 6 comments

Thanks for a great plugin! Just what I needed.

The workflow seems not to find any files that are not Google Docs, Spreadsheets or maybe Presentations. I've got tons of files in my Drive that are of other formats, and I'd love to find those as well.

added a patch that allows for pdfs. working on feature that will allow you to customize different types of files. which type would you say you need after docs, sheets, slides, forms, and pdfs?

Hmm. May I ask the rationale behind only searching certain filetypes? I'd assume it found anything.

Also not sure what you mean by "forms".

Thanks.

Google forms (https://www.google.com/forms/about/). Google by default returns all file types - including folders and other meta files - which made the results most of the time incomprehensible. I am going to add a setting where you can filter the file types to allow for more customizability.

Dope.

Yes, I've been trying to search for folders too. Nice.

For anyone needing support for more file types, at the top of google-drive.rb you will find this (associative) array:

MIME_TYPE_ICONS = {
  'application/vnd.google-apps.document'     => { :path => 'icons/doc.png'   },
  'application/vnd.google-apps.spreadsheet'  => { :path => 'icons/sheet.png' },
  'application/vnd.google-apps.presentation' => { :path => 'icons/slide.png' },
  'application/vnd.google-apps.form'         => { :path => 'icons/form.png'  },
  'application/pdf'                          => { :path => 'icons/dummy.pdf', :type => 'fileicon' },
}

You can add new lines to this array to get more file types included.

Unfortunately for a proper icon, Alfred requires either an image file or a local file with the file extension that indicate what (system) icon should be used. The latter is what is done for pdf files.

After making changes to the array, it may take up to 10 minutes before your new file type shows up in Alfred because of caching.

Though you can safely delete the cache by running this in a terminal:

rm ~/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow\ Data/com.drive.azai91/drive-items.json

Pull requests for more file types are welcomed, it is primarily because of the icon mapping that I have not made it show all file types, as we either need to manually map all known file types to icons, or possibly dynamically create dummy icons in the cache folder for unknown file types.

I have also
md
docx
pptx
xlsx

It would be great to be able to search for them too.
Thanks!
Francesco