Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


robwalton last won the day on April 9

robwalton had the most liked content!

About robwalton

  • Rank
  1. Leveraging x-callback-url in workflows

    Hi @dfay, have been out for a while. How goes it? I had an attempt at packaging up something to make x-callback-url calls and then receive the callbacks. You might try https://github.com/martinfinke/xcall from the command line. I've put a python wrapper around it here: https://github.com/robwalton/python-xcall . I've not really used it in earnest, or checked it for race conditions or threads safety and whatnot. But it might help and it has tests so we might be able to improve it if you come across any issues! It may also be total overkill, if you've found a lighter way @dfay. I wanted something signed with apple that could be distributed easily.
  2. Ulysses workflow

    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.
  3. Ulysses workflow

    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!
  4. Ulysses workflow

    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
  5. Ulysses workflow

    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?)
  6. Ulysses workflow

    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?
  7. Ulysses workflow

    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: I've not seen a problem with this one. Even if you request new token, old ones seem to keep working.
  8. Ulysses workflow

    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
  9. Ulysses workflow

    The vote came in for Boaty McBoatFace I'm afraid.
  10. Ulysses workflow

    Thanks. Using xcall is an easy way to handle things and Martin signed it too so no brainer to use it. I haven't profiled it to see how much overhead there is in firing it up every time---in principle leaving the url-callback receiver part running would be quicker---but it seems to be fast enough. 100ms to Ulysses and back again for most calls most of the time. Good spotting! I've fixed that. Totally agree. I was a bit shy about taking the package name ulysses which is partly why it was awkward. Have followed your suggestions. I just need to do something useful with it now (like ul @dfay), to see what needs changing about the API.
  11. Ulysses workflow

    Hi @dfay, Looks like you've made good progress on the ul command. I've gone off on one and pretty much finished a full ulysses python client to the 23 calls described here and put it up at github. Example use: >>> from ulysses_client import ulysses >>> ulysses.get_version() u'2' >>> token = ulysses.authorize() >>> ulysses.set_access_token(token) >>> library = ulysses.get_root_items(recursive=True) >>> print library[0] Group(title='iCloud', n_sheets=0, n_containers=4, identifier='4A14NiU-iGaw06m2Y2DNwA') >>> print '\n'.join(ulysses.treeview(library[0])) ... Will use it (or about 5% of it!) to add an append command to the workflow and also your cool ul workflow fragment fairly soon. I was all fired up to replace all calls in the Ulysses workflow with this (rather than the reverse engineered file system parsing approach it currently uses). However, it would be hard or impossible to replace the uf find command at his point. This command currently uses spotlight to find the location on disk of entries who's internal content matches a query; and then uses this list of file locations to filter the richer structure built up from reverse engineering the library. The problem is that it would currently take a call to ulysses.get_quick_look_url(id) on every single node in the tree obtained via x-callback to get path that backs each node. (The Ulysses API has no find call.) I'll ask the Ulysses guys about this, but with this version of the Ulysses API it doesn't seem like I can do a full replacement---was hoping this would fix the muddle with 'On My Mac' items and provide access to external folders without more reverse engineering (also its always nice to throw away fiddly code!)
  12. Ulysses workflow

    This would be a very cool feature. I guess we'd just want to paste it at the cursor location of the currently open sheet? I loose track of keyboard modifiers: would this warrant a new ul (for link) command?
  13. Ulysses workflow

    Sond like there are two issues: 1. The workflow should only look in 'On My Mac' if preference is set. 2. I don't see the 'On My Mac' prefixes that you see. Is it possible you once enabled 'On My Mac' and had some stuff in there? The workflow will find old things on disk---this would not account for everything having 'On My Mac' in front, but could cause confusion Will look at #1. Regarding #2, could you check that you don't have stuff in 'On My Mac' that be causing confusion P.S. Could just disable On My Mac support until I have time look at it properly. This was just a stepping stone to supporting external folders.
  14. Ulysses workflow

    So I tried this out and unfortunately Ulysses won't send callbacks to html schemes. I asked Ulysses technical support and got a very quick and helpful answer. This is a deliberate choice for security reasons. They pointed me at a command line utility they'd made for calling a url scheme and getting a callback xcall. I'll go with this. Thanks for the suggestion though, it would have been tidy and self contained.
  15. Ulysses workflow

    It is a URL callback and that looks like a good library, thanks. I'll give it a go. If it worked it would bypass a lot of cruft (I have an old school fifo pipe in the mix too)---it depends, I guess, on wether ulysses is happy sending its callback's to an http server rather than a locally registered url application scheme tied by OSX to a specific application (described here).