robwalton

Ulysses workflow

65 posts in this topic

4 hours ago, deanishe said:

 

Call it Odysseus :) 

stately-plump-buck-mulligan was taken?

deanishe likes this

Share this post


Link to post

No punctuation in package names, alas. Joyce would approve.

Share this post


Link to post

Posted (edited)

I've extracted the xcall part of ulysses-python-client into a separate project python-xcall. I think this could be quite a handy tool and I'll try and put this up on PyPi if I can work out how to distribute the lib folder including Martin's xcall.app. Seems like pip wheels are the key!

 

Then maybe after doing some actual work I'll include your ul command @dfayinto the ulysses workflow this thread is supposed to be about ;)

Edited by deanishe
fix URL

Share this post


Link to post

This reminds me I meant to post about a weird issue I had last night. I kept getting a message "xcall.app is no longer running". In activity monitor there were like nine instances of xcall active.  I had to kill them all manually before the workflow would work again.

Share this post


Link to post
4 minutes ago, dfay said:

This reminds me I meant to post about a weird issue I had last night. I kept getting a message "xcall.app is no longer running". In activity monitor there were like nine instances of xcall active.  I had to kill them all manually before the workflow would work again.

Uh oh! I must have called it thousands of times with automated testing and haven't noticed this. But I noticed sometimes when calling ulysses with a wrong id there are long delays in returning. Possibly there might be other causes of this too. I wonder if your issue might be caused by making a call before another has returned and it all getting out of sync? I'll see if I can reproduce.

 

Also, you mentioned a while back:

Quote

One thing I noticed, though, was that the authentication token I'd acquired earlier today no longer worked and I had to re-authenticate.  Have you been able to consistently use the same token without repeat re-authentication?

I've not seen a problem with this one. Even if you request new token, old ones seem to keep working.

Share this post


Link to post

Just ran into another issue when I sat down at my iMac for the first time in a week....workflows sync via Dropbox but of course Ulysses authentication tokens are not the same from one Mac installation to another.  I think I will need to do something like this 

 and pass the authentication token when I call the script in the Script Filter.  Unless you see a better way.

Share this post


Link to post

Posted (edited)

 

@robwalton I'm looking over the workflow code. There's no need for such long imports. The AW API is defined in __init__.py.

 

from workflow import Workflow3

 

is enough, unless you're using some internal functions—at your peril ;)

 

 

Edited by deanishe

Share this post


Link to post
22 minutes ago, deanishe said:

 

@robwalton I'm looking over the workflow code. There's no need for such long imports. The AW API is defined in __init__.py.

 

from workflow import Workflow3

 

is enough, unless you're using some internal functions—at your peril ;)

Thanks Python tutor :). I've fixed this on my local development version (it did feel a bit clunky at the time). I have a huge project in my day job which would could probably do with using defining  package APIs in __init__s. Will look at that too. I did a huge refactor of that a while back to make it less Java-like, but I guess I still missed some Python tricks.

 

BTW, is there is there a good way to get Alfred to run off a git repo's working copy? Now I ask it: I guess I could just replace my e.g user.workflow.A661A55B-8CCD-4E74-BC15-54528262B74E folder with a symbolic link to my git working copy?

Share this post


Link to post
On 13/04/2017 at 1:43 AM, dfay said:

I poked around in the XML in the library a bit and it seems that the DisplayName for my root is set to "On My Mac" even though it is in fact in iCloud.  Seems like a Ulysses bug that is otherwise invisible but which the workflow may make evident by using the DisplayName?  Just a guess.

Hi there, just integrating the x-callback stuff into ulysses workflow. I think I will go back to supporting iCloud only for now as this seems more trouble than its worth (unless you got further analysing it?)

Share this post


Link to post
On 20/04/2017 at 5:56 PM, dfay said:

Just ran into another issue when I sat down at my iMac for the first time in a week....workflows sync via Dropbox but of course Ulysses authentication tokens are not the same from one Mac installation to another.  I think I will need to do something like this 

 and pass the authentication token when I call the script in the Script Filter.  Unless you see a better way.

Thanks @dfay, I'll get this bit working in the workflow first. 

 

I think that in bringing in the x-callback stuff, given the lack of tests in the workflow, I'll run old and new next to each other for a bit with some assertions. May still be a bit until I add your new commands, as will be working on foundations.

 

Thanks for your ideas, work and debugging to date! --Rob

Share this post


Link to post
On 20/04/2017 at 5:28 PM, robwalton said:

This reminds me I meant to post about a weird issue I had last night. I kept getting a message "xcall.app is no longer running". In activity monitor there were like nine instances of xcall active.  I had to kill them all manually before the workflow would work again.

Hi again, I tried pretty hard to reproduce by firing off call from threads in parallel, but seemed okay. I haven't checked if xcall is thrad/process safe yet, but a quick glance in the code makes me think not. For this, and your issue, python-xcall now throws an AssertionError if it finds xcall already running. There is 20-30ms period after making one call where a second will still go through though. It should help a bit--and it might help you diagnose want wrong for you? The real solution is (from the outside of xcall at least) is a file lock--but those cause so much grief! 

Share this post


Link to post
On 19/04/2017 at 6:42 AM, dfay said:

 

Actually there's a typo in Rob's code … in ulysses_calls.py --  open_recent() should call the URL that patgilmour pasted above.

 

Whoops! Thanks for spotting that. No tests for those bits. Have fixed the workflow on master. Will have to start thinking about a release when it settles down.

Share this post


Link to post

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