Jump to content

Google Drive — List File Stream contents from Google Drive


Recommended Posts

@vitor, huge thanks for this workflow! I'm having trouble getting it to work, and wanted to see if you had any suggestions. 

 

I've installed the latest from Github, and ran the cache rebuilder and gdlaunchd. I fairly instantly received a notification saying the cache had been rebuilt. However, when I open alfred and type "gd", add a space and then my search terms, no results are ever returned. 

 

I have two Google accounts (one is my gmail, one is my work email, also a Google account). I only really care about trying to get results returned from my Shared Drive we use at work. I've synced all those files locally, but can't find them … or any files. Not when I search for files that are just in my normal Google Drive: 

 

1779874219_ScreenShot2021-10-15at10_03_09PM.thumb.png.a252adbbaa713c9a9f24687bdd879107.png

 

Or when I search for things in my Shared Drive: 

 

1683744294_ScreenShot2021-10-15at10_03_24PM.thumb.png.cfeaaa60de78013868d481ce0a7feab0.png

 

 

Any idea what I'm doing wrong? I saw references to adjusting the paths, but couldn't figure out how to do that, or if that was relevant. My Google Drives should be in the default locations though. 

Link to comment
6 hours ago, egoldin said:

Any idea what I'm doing wrong?

 

Please don't post screenshots like that. We can't tell you what's going wrong from screenshots of a workflow doing nothing any more than a mechanic can look at a photo of your parked car and tell you why it won't start.

 

Look in the workflow debugger to see what Alfred/the workflow say.

 

6 hours ago, egoldin said:

couldn't figure out how to do that

 

Workflow Environment Variables in the workflow's configuration sheet.

Link to comment

Hello @vitor,

for several weeks your workflow isn't working for me. Today, I take the time and removed the old Google Drive Workflow from Alfred.

 

I installed the new workflow from your thread here.

- Google Drive Workflow Version: v2021.4

- Alfred Version: 4.6 [1266] 

- MacOS Version: Big Sur (11.6)

 

After enabling the Agent:

[11:09:17.099] Google Drive[Script Filter] Queuing argument ''
[11:09:17.167] Google Drive[Script Filter] Script with argv '' finished
[11:09:17.168] Google Drive[Script Filter] {"items": [
      {
        "title": "Install Google Drive launchd service",
        "subtitle": "Save a cache of added files whenever /Users/henryauffahrt/henry.auffahrt@aufbau.online - Google Drive is modified",
        "arg": "install"
      },
    ]}
[11:09:18.036] Google Drive[Script Filter] Processing complete
[11:09:18.038] Google Drive[Script Filter] Passing output 'install' to Run Script
[11:09:18.281] Google Drive[External] Processing complete
[11:09:18.283] Google Drive[External] Passing output '' to Run Script

PS: I also tried this path: /Users/henryauffahrt/Google Drive - AufBau.

 

I do not see a message like "all done" popping up for several minutes.

 

If I search something, I get the following message:

[11:13:37.146] Google Drive[Script Filter] Queuing argument 'chocolat'
[11:13:37.287] Google Drive[Script Filter] Script with argv 'chocolat' finished
[11:13:37.288] Google Drive[Script Filter] {"items":[{"title":"Run :gdrebuildcache or :gdlaunchd","subtitle":"The former will rebuild the cache file once while the latter will rebuild it every day","valid":false}]}

 

What do you mean with "The former"? Is the indexing process is still in progress?

 

I tried to rebuild the cache with the :gdrebuildcache command

[11:14:34.158] Google Drive[Keyword] Processing complete
[11:14:34.159] Google Drive[Keyword] Passing output '' to Arg and Vars
[11:14:34.160] Google Drive[Arg and Vars] Processing complete
[11:14:34.161] Google Drive[Arg and Vars] Passing output '' to Run Script

 

Passing output '' ← Could the blank output be a problem here?

 

I also read your comment in the script for the :gdlaunchd

# Set correct directory to watch
# Current method might not be robust enough
# if there are characters in the path which need escaping

 

So I tried some other pathes like:

  • /Users/henryauffahrt/Google Drive - AufBau/My Drive
  • /Users/henryauffahrt/Google Drive - AufBau/Shared drvies
  • /Users/henryauffahrt/Google Drive - AufBau
  • /Users/henryauffahrt/Google Drive - AufBau/
  • "/Users/henryauffahrt/Google Drive - AufBau" ← Here I get an error output: [11:18:53.931] ERROR: Google Drive[Run Script] Google Drive path does not exist!
  • '/Users/henryauffahrt/Google Drive - AufBau' ← Same as above, thanks for this good error handling

After changing the path I run :gdrebuildcache and I got the following message:

[11:22:17.718] Google Drive[Keyword] Processing complete
[11:22:17.719] Google Drive[Keyword] Passing output '' to Arg and Vars
[11:22:17.720] Google Drive[Arg and Vars] Processing complete
[11:22:17.720] Google Drive[Arg and Vars] Passing output '' to Run Script
[11:22:17.954] ERROR: Google Drive[Run Script] /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in `initialize': table main already exists (SQLite3::SQLException)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in `new'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in `prepare'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:in `execute'
	from /Users/henryauffahrt/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.5665891C-6430-468E-97FC-80D87DD7B501/rebuild_cache:24:in `<main>'

 

Sorry If I might get it wrong, but with 'initialize' it means that the indexing process is still going on? May I'm not patient enough?

 

Thanks a lot for your help again, I don't know how to make it up to you 😅

Link to comment
On 10/21/2021 at 2:34 PM, vitor said:

 

Yes. You’re running the commands multiple times and making them trample each other.

 

On 10/22/2021 at 3:26 AM, vitor said:

New release is out. It expands gd to differentiate between cache missing or being built and prevents immediate sequential cache rebuilds.

 

Thanks a lot for clarifying, and also for the new release.


I installed everything on the mac of my colleague and after a while the index was built up and everything works fine for him. For me, on my mac, after 24h it was not working, the index seems not to built up correctly.

But now I get it to work, this is how I did it:

  1. Make sure the index agent is disabled
  2. Deleted your workflow
  3. Restarted by Mac
  4. Reinstalled your workflow new
  5. enabled the index agent
  6. after a while the index was built up, everything works 🎉

Thanks a lot for your work @vitor!!

 

 

Link to comment
On 10/16/2021 at 12:15 PM, deanishe said:

 

Please don't post screenshots like that. We can't tell you what's going wrong from screenshots of a workflow doing nothing any more than a mechanic can look at a photo of your parked car and tell you why it won't start.

 

Look in the workflow debugger to see what Alfred/the workflow say.

 

 

Workflow Environment Variables in the workflow's configuration sheet.

 

Sorry about that @deanishe! I thought those screenshots would be helpful, but I now realize the debugger would be a lot more helpful. On that note, I used the debugger and thanks to @vitor's updates, it looks like the issue is that the Google Drive Path does not exist (screenshot attached).

 

I don't think I've ever modified/customized my Google Drive Path, but I just noticed when I open the "Configure variables" settings for this workflow, I see the workflow is set to [redacted path]. Should I change that to my Mac username? I'm just trying to search my Shared Drives on my work Google Drive — and I've set all shared drives/files to sync locally/be available for offline access. 

 

Attached [redacted screenshot] showing file path to those shared drives, in case that's helpful. (Can delete if it's a bad idea to share my emails). 

 

Thanks for your help!

 

 

 

Edited by vitor
Redacted semi-personal info
Link to comment

That is a test path which has never made it into any official release of this Workflow. I know because I just rechecked them all.

 

I have no idea how you got into that situation. Delete the Workflow and make sure to get it from the top post on this thread.

 

Also, before posting about any issues please be sure to follow the second post of this thread.

Edited by vitor
Link to comment

I just updated to Monterey (from Catalina) so I'm brand new to this crippling Google Drive issue, so firstly thank you Vitor for saving the day!

Wondering if it would be possible to modify the results to show directories first? Or even just filter the results to show directories only?

I have thousands of files (eg rendered video frames) that share part of the name/s of their directory structure. Those files are populating the results before a directory can be found.

Link to comment

I paid for a Powerpack and signed up for this forum just to say thank you for releasing this. I'd be manually running the terminal command for months until recent releases couldn't even force Spotlight to index Google Drive.

 

This has drastically improved my day to day. I was spending so much time trying to reset search, find files I need to be effective at work, find files I need for personal reasons - it's baffling Google screwed this up when their old product worked, but whatever. Thank you, again for this.

Link to comment
On 11/1/2021 at 2:28 AM, Floating.Point said:

so firstly thank you Vitor for saving the day!

 

On 11/1/2021 at 1:18 PM, hb1 said:

paid for a Powerpack and signed up for this forum just to say thank you for releasing this. (…) This has drastically improved my day to day.

 

Thank you both for the kind words!

 

On 11/1/2021 at 2:28 AM, Floating.Point said:

Wondering if it would be possible to modify the results to show directories first? Or even just filter the results to show directories only?

 

I previously rejected this on account of being niche and requiring a tradeoff. Three things changed:

  • Another person asked and I now think more may want this.
  • Thought of a way which might make the tradeoff negligible.
  • Your example clicked with me.

Here‘s a new version. Would you and @giovanni mind giving it a quick test before I publish? I followed @giovanni’s gdf suggestion rather than gdd because it’s faster to type, looks nicer, and pairs with the example “Simple Folder Search”.

 

gd works as before, but to use gdf you’ll need to rebuild the cache—either wait for the launchd agent do it or force it with :gdrebuildcache.

Link to comment
On 10/16/2021 at 4:15 AM, deanishe said:

 

Please don't post screenshots like that. We can't tell you what's going wrong from screenshots of a workflow doing nothing any more than a mechanic can look at a photo of your parked car and tell you why it won't start.

 

Look in the workflow debugger to see what Alfred/the workflow say.

 

 

Workflow Environment Variables in the workflow's configuration sheet.

 

Got it working! I hadn't sent the path correctly apparently. All fixed now. Huge thanks @vitor for the updates too! 

Link to comment
10 hours ago, vitor said:

mind giving it a quick test before I publish?

 

Hi Vitor, I just rebuilt my (fairly large) cache, and gdf seems to be working beautifully. I will use it throughout production tomorrow and let you know if I encounter any issues. Without this solution, I would need to roll back to Catalina. It's shocking (and kind of comical) how lost I felt doing file management in the Finder.

Link to comment

Just to confirm, I’ve downloaded the latest version of the workflow and it works, thanks @vitor!

 

I think I know what causes confusion in people: there is no system notification when the process is finished. Debugger showed nothing at then end that could indicate that “it’s done”, it was just pending. But after a few hours I gave it a shoot, and the files appeared.

 

So glad that we have this. 🙏

Link to comment
36 minutes ago, Kaske said:

Debugger showed nothing at then end that could indicate that “it’s done”

 

But it does tell you if something goes wrong.

 

20 minutes ago, Kaske said:

there is no system notification when the process is finished.

 

There is, but only if you do it manually with :gdrebuildcache. In the meantime, if you try to gd to search, it’ll tell you it’s still building. Having a notification show every day after the cache is rebuilt might be a bit intrusive, but in the next update I’ll change it so it shows a notification the first time the launchd job is fired (via :gdlaunchd). Thank you for the suggestion.

 

Link to comment
3 hours ago, vitor said:

 

Why, specifically, do you say that? What have you done and what are you seeing?


I’ll also need the information requested in the second post.

 

I've been trying to search the drive using the gd script filter, but it keeps saying that the cache is building.

 

Here's my details

 

Workflow: v2021.6

Alfred: 4.6.1 [1268]

macOS: 12.0.1 Monterey (Apple Silicon)

 

My Google Drive path matches the default variable.

 

Debug Log

 

[10:00:35.186] Logging Started...

[10:01:06.663] Google Drive[Script Filter] Queuing argument 'c'

[10:01:06.837] Google Drive[Script Filter] Script with argv 'c' finished

[10:01:06.838] Google Drive[Script Filter] {"items":[{"title":"Cache is being built…","subtitle":"Please be patient. Depending on how many files you have, it can take a while.","valid":false}]}

[10:01:21.144] Google Drive[Keyword] Processing complete

[10:01:21.146] Google Drive[Keyword] Passing output '' to Arg and Vars

[10:01:21.147] Google Drive[Arg and Vars] Processing complete

[10:01:21.147] Google Drive[Arg and Vars] Passing output '' to Run Script

[10:01:21.236] ERROR: Google Drive[Run Script] Cache creation already in progress

[10:01:21.238] Google Drive[Run Script] Processing complete

[10:01:21.239] Google Drive[Run Script] Passing output 'ONGOING_REBUILD' to Run Script

[10:01:21.239] Google Drive[Run Script] Passing output 'ONGOING_REBUILD' to Conditional

[10:01:21.240] Google Drive[Conditional] Processing complete

[10:01:21.240] Google Drive[Conditional] Passing output 'ONGOING_REBUILD' to Post Notification

[10:01:21.241] Google Drive[Post Notification] Processing complete

[10:01:21.241] Google Drive[Post Notification] Passing output 'ONGOING_REBUILD' to Play Sound

 

Thanks for your help, and sorry I missed the second post.

Link to comment

It seems likely something interrupted the process and left the temporary cache there.

  1. Install the latest version.
  2. Restart your Mac.
  3. In a terminal, run the following:
rm -rf "${HOME}/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.vitorgalvao.alfred.googledrive"
rm "${HOME}/Library/LaunchAgents/com.vitorgalvao.launchd.googledrivecache.plist"
osascript -e 'tell application id "com.runningwithcrayons.Alfred" to run trigger "googledrivelaunchd" in workflow "com.alfredapp.googledrive" with argument "uninstall"'
osascript -e 'tell application id "com.runningwithcrayons.Alfred" to run trigger "googledrivelaunchd" in workflow "com.alfredapp.googledrive" with argument "install"'

 

That will do some cleanup and restart the process.

Edited by vitor
Link to comment
On 11/12/2021 at 11:18 AM, vitor said:

It seems likely something interrupted the process and left the temporary cache there.

  1. Install this version.
  2. Restart your Mac.
  3. In a terminal, run the following:
rm -rf "${HOME}/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.vitorgalvao.alfred.googledrive"
rm "${HOME}/Library/LaunchAgents/com.vitorgalvao.launchd.googledrivecache.plist"
osascript -e 'tell application id "com.runningwithcrayons.Alfred" to run trigger "googledrivelaunchd" in workflow "com.alfredapp.googledrive" with argument "uninstall"'
osascript -e 'tell application id "com.runningwithcrayons.Alfred" to run trigger "googledrivelaunchd" in workflow "com.alfredapp.googledrive" with argument "install"'

 

That will do some cleanup and restart the process.

 

 

Thanks for your help with this. Not sure if this worked, but here's what happened running this process...

 

rm "${HOME}/Library/LaunchAgents/com.vitorgalvao.launchd.googledrivecache.plist"

 

Running this command showed returned "No such file or directory" in terminal.

 

osascript -e 'tell application id "com.runningwithcrayons.Alfred" to run trigger "googledrivelaunchd" in workflow "com.alfredapp.googledrive" with argument "uninstall"'

 

Running this command created this debug output in Alfred.

 

[12:19:35.421] Logging Started...
[12:20:03.580] Google Drive[External] Processing complete
[12:20:03.584] Google Drive[External] Passing output 'uninstall' to Run Script
[12:20:03.658] Google Drive[Run Script] Processing complete
[12:20:03.660] Google Drive[Run Script] Passing output '' to Conditional

 

osascript -e 'tell application id "com.runningwithcrayons.Alfred" to run trigger "googledrivelaunchd" in workflow "com.alfredapp.googledrive" with argument "install"'

 

Running this command gave me this debug output in Alfred.

 

12:20:18.191] Google Drive[External] Processing complete
[12:20:18.193] Google Drive[External] Passing output 'install' to Run Script
[12:20:18.271] Google Drive[Run Script] Processing complete
[12:20:18.274] Google Drive[Run Script] Passing output 'BUILD_CACHE' to Conditional
[12:20:18.276] Google Drive[Conditional] Processing complete
[12:20:18.276] Google Drive[Conditional] Passing output 'BUILD_CACHE' to Arg and Vars
[12:20:18.277] Google Drive[Arg and Vars] Processing complete
[12:20:18.277] Google Drive[Arg and Vars] Passing output '' to Run Script
[12:20:18.375] Google Drive[External] Processing complete
[12:20:18.378] Google Drive[External] Passing output '' to Run Script
[12:20:18.438] ERROR: Google Drive[Run Script] Cache creation already in progress
[12:20:18.441] Google Drive[Run Script] Processing complete
[12:20:18.441] Google Drive[Run Script] Passing output 'ONGOING_REBUILD' to Run Script
[12:20:18.442] Google Drive[Run Script] Passing output 'ONGOING_REBUILD' to Conditional
[12:20:18.442] Google Drive[Conditional] Processing complete
[12:20:18.443] Google Drive[Conditional] Passing output 'ONGOING_REBUILD' to Post Notification
[12:20:18.443] Google Drive[Post Notification] Processing complete
[12:20:18.444] Google Drive[Post Notification] Passing output 'ONGOING_REBUILD' to Play Sound

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...