deanishe/alfred-searchio

Add Google Lucky Search

Closed this issue · 25 comments

I can try add this but want to wait for a new release of Searchio first to accommodate new AwGo changes.

What exactly are you suggesting/requesting? What's different to #15 (which you created)?

Well it was closed. I don't mind having it as separate script filters. Just wanted to keep it open so it's in the open issues.

I basically want to do #16 but for new Searchio.

That's pretty simple: it just requires duplicating the regular Google definition and changing the values for search_url.

Last time I tried building the workflow, it failed. You mentioned it wasn't a trivial change to get Searchio working with new AwGo. So I am waiting for that to complete first if that makes sense.

You mentioned it wasn't a trivial change to get Searchio working with new AwGo

I did, but that was a bit silly. It shouldn't be very hard simply because the Go component of the workflow is tiny.

It shouldn't be very hard simply because the Go component of the workflow is tiny.

Should I try do this? Or you got some spare time? 🙂

I am quite desperate because I love the new speed but on fallback searches I select my query and run KM macro to do a google search on it which is rather annoying.

I just compiled the workflow against the latest version of AwGo.

What versions are you trying to compile?

~/clones/alfred-searchio develop
❯ modd
18:55:52: prep: go build -v -o ./src/search ./src/search.go && ./src/search google-en beast
src/search.go:28:2: cannot find package "github.com/NodePrime/jsonpath" in any of:
	/usr/local/go/src/github.com/NodePrime/jsonpath (from $GOROOT)
	/Users/nikivi/go/src/github.com/NodePrime/jsonpath (from $GOPATH)
exit status 1
^C
~/clones/alfred-searchio develop 7s
❯ go get github.com/NodePrime/jsonpath
# cd .; git clone https://github.com/NodePrime/jsonpath /Users/nikivi/go/src/github.com/NodePrime/jsonpath
Cloning into '/Users/nikivi/go/src/github.com/NodePrime/jsonpath'...
remote: Repository not found.
fatal: repository 'https://github.com/NodePrime/jsonpath/' not found
package github.com/NodePrime/jsonpath: exit status 128

I tried running modd on develop branch. NodePrime/jsonpath no longer exists and I changed references to it to the mirror. Let me try again.

I read something about vendoring dependencies which solves these kind of issues. I think it would be nice to adopt.

It's not a Go package, Niki, just a single script. Vendoring doesn't work.

10 seconds with Google turns up github.com/JumboInteractiveLimited/jsonpath

Replace the github.com/NodePrime/jsonpath import with github.com/JumboInteractiveLimited/jsonpath.

It would be cool to have CONTRIBUTING.md file on how to start developing the workflows.

I get that I have to set the three variables on running it but I fail to understand why it doesn't work for me when I did it this way.

~/clones/alfred-searchio develop* 8s
❯ alfred_workflow_bundleid=net.deanishe.alfred-searchio

~/clones/alfred-searchio develop*
❯ echo $alfred_workflow_bundleid
net.deanishe.alfred-searchio

~/clones/alfred-searchio develop*
❯ alfred_workflow_cache=/Users/nikivi/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow\ Data/net.deanishe.alfred-searchio

~/clones/alfred-searchio develop*
❯ alfred_workflow_data=/Users/nikivi/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-searchio
zsh: no such file or directory: Support/Alfred

~/clones/alfred-searchio develop*
❯ modd
19:09:52: prep: go build -v -o ./src/search ./src/search.go && ./src/search google-en beast
panic: Invalid Workflow environment: alfred_workflow_bundleid is not set, alfred_workflow_cache is not set, alfred_workflow_data is not set

nvm the third path being wrong, it says they were not set at all. I also tried to do it in the modd.conf script itself although that seems like the wrong way to do it. Going to google more.

p.s. my own CONTRIBUTING.md file I reuse across all my Go workflows. I think it's the most important file for any open source project.

Awesome! Thanks for RC ✨🚀

Going to try add Google Lucky now and submit PR

Tbh, the only thing worth mentioning (regarding this project) is modd. Everything else is just basic Go/Python/git, which is outside the scope of the workflow.

Going to try add Google Lucky now and submit PR

👍

Tbh, the only thing worth mentioning

Even then I think it's nice to have a process in place. i.e. mention that it would be nice to open an issue first before starting to work on some massive PR only for it to get rejected.

Everything else is just basic Go/Python/git

And shell knowledge I guess. Because I don't know how to set those variables so modd likes it.

Because I don't know how to set those variables so modd likes it

Good point. I've added alfred_env.sh to the repo, which creates the expected shell environment. It's also source in modd.conf, so modd should Just Work now.

I have issues getting the Google Lucky search to work.

I cloned Searchio and git checkout develop. I then ran your symlink script with workflow-install -s src and had Searchio show up in Alfred Preferences.

It says these are my installed searches

2018-10-02 at 22 55

There are no icons on them so I suppose those are not being picked up too. And these are the script filters I have:

2018-10-02 at 22 56

Running Reload seem to have done nothing as the script filters of Wiki, DDG are still there and there is no YouTube script filter at all too. Not sure what I am doing wrong.

Here is the log I get when I ran the Reload command:

Cleaning caches ...
22:57:03 workflow.py:2255 DEBUG    ---------- Searchio! (2.0.0-rc2) ----------
22:57:03 workflow.py:1665 DEBUG    reading settings from /Users/nikivi/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-searchio/settings.json
22:57:03 workflow.py:2539 DEBUG    update check not due
22:57:03 cli.py:63 DEBUG    args={'--help': False,
 '--version': False,
 '<args>': [],
 '<command>': 'clean'}
22:57:03 clean.py:91 INFO     [clean] 0 stale item(s) deleted
22:57:03 workflow.py:2448 DEBUG    set last run version: 2.0.0-rc2
22:57:03 workflow.py:2297 DEBUG    ---------- finished in 0.018s ----------
Updating info.plist ...
22:57:03 workflow.py:2255 DEBUG    ---------- Searchio! (2.0.0-rc2) ----------
22:57:03 workflow.py:1665 DEBUG    reading settings from /Users/nikivi/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-searchio/settings.json
22:57:03 workflow.py:2539 DEBUG    update check not due
22:57:03 cli.py:63 DEBUG    args={'--help': False,
 '--version': False,
 '<args>': [],
 '<command>': 'reload'}
22:57:03 reload.py:266 DEBUG    args={'--defaults': False,
 '--help': False,
 'reload': True}
22:57:03 reload.py:176 INFO     Removed Script Filter "YouTube (United States)" (youtube-us)
22:57:03 reload.py:176 INFO     Removed Script Filter "Google (English)" (google-en)
22:57:03 reload.py:176 INFO     Removed Script Filter "Google Lucky (English)" (google-lucky-en)
22:57:03 reload.py:176 INFO     Removed Script Filter "Google Images (English)" (google-images-en)
22:57:03 reload.py:232 INFO     Added Script Filter "YouTube (United States)" (youtube-us)
22:57:03 reload.py:232 INFO     Added Script Filter "Google (English)" (google-en)
22:57:03 reload.py:232 INFO     Added Script Filter "Google Lucky (English)" (google-lucky-en)
22:57:03 reload.py:232 INFO     Added Script Filter "Google Images (English)" (google-images-en)
22:57:03 reload.py:248 DEBUG    Removed search icon "/Users/nikivi/clones/alfred-searchio/src/google-images-en.png"
22:57:03 reload.py:248 DEBUG    Removed search icon "/Users/nikivi/clones/alfred-searchio/src/youtube-us.png"
22:57:03 reload.py:248 DEBUG    Removed search icon "/Users/nikivi/clones/alfred-searchio/src/google-lucky-en.png"
22:57:03 reload.py:248 DEBUG    Removed search icon "/Users/nikivi/clones/alfred-searchio/src/google-en.png"
22:57:03 reload.py:258 DEBUG    Linking "../../../Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.4AE8D491-F632-4BA5-9A08-5A6543446EA0/icons/engines/youtube.png" to "youtube-us.png"
22:57:03 reload.py:258 DEBUG    Linking "../../../Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.4AE8D491-F632-4BA5-9A08-5A6543446EA0/icons/engines/google.png" to "google-en.png"
22:57:03 reload.py:258 DEBUG    Linking "icons/engines/google-lucky.png" to "google-lucky-en.png"
22:57:03 reload.py:258 DEBUG    Linking "../../../Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.4AE8D491-F632-4BA5-9A08-5A6543446EA0/icons/engines/google-images.png" to "google-images-en.png"
22:57:03 workflow.py:2448 DEBUG    set last run version: 2.0.0-rc2
22:57:03 workflow.py:2297 DEBUG    ---------- finished in 0.039s ----------
[2018-10-02 22:57:03][STDERR: input.scriptfilter] 22:57:03 workflow.py:2255 DEBUG    ---------- Searchio! (2.0.0-rc2) ----------
22:57:03 workflow.py:1665 DEBUG    reading settings from /Users/nikivi/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-searchio/settings.json
22:57:03 workflow.py:2539 DEBUG    update check not due
22:57:03 cli.py:63 DEBUG    args={'--help': False,
 '--version': False,
 '<args>': [''],
 '<command>': 'config'}
22:57:03 config.py:61 DEBUG    args={'--help': False,
 '<query>': '',
 'config': True}
22:57:03 workflow.py:1892 DEBUG    loading cached data: /Users/nikivi/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-searchio/__workflow_update_status.cpickle
22:57:03 workflow.py:2469 DEBUG    update_data: {u'available': False}
22:57:03 workflow.py:1892 DEBUG    loading cached data: /Users/nikivi/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-searchio/__workflow_update_status.cpickle
22:57:03 workflow.py:2469 DEBUG    update_data: {u'available': False}
22:57:03 workflow.py:2448 DEBUG    set last run version: 2.0.0-rc2
22:57:03 workflow.py:2297 DEBUG    ---------- finished in 0.016s ----------

Thank you for any help.

I just checked RC2 and this issue doesn't happen there. So I guess its due to me symlinking it?

RC2 also has issues with icons not showing:

2018-10-02 at 23 03

What happens if you run "Reload" from the searchio (keyword) menu?

Running reload on RC2 doesn't add the icons back. I don't mind the icons though. I just want to get google lucky search working. And I ran reload on my symlinked latest develop branch workflow too. Although that one has issues with script filters not changing.

It's probably the symlinking. Alfred doesn't notice when the workflow has changed. Try restarting Alfred.