Jump to content

smarg19

Member
  • Posts

    505
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by smarg19

  1. Whoah, this is the second must viewed workflow (right after the Evernote workflow)! That's crazy! Guess lots of other people besides me use Library Genesis.
  2. 1. I originally wrote the utils script to be Workflow independent, thus the port. 2. Good call. I wasn't aware of the user-specific prefix. I will text the os.environ['LANG'] = 'en_US.UTF-8' solution.
  3. Thank you for finding this small bug. I actually changed the API, but didn't update all of the workflow's API calls. I will be sure to have this fixed for final release. For you, it's an easy fix. Open the "Run Script" node attached to the z:prefs keyword. In the script text, change /usr/bin/python zotquery.py config prefs into /usr/bin/python zotquery.py configure prefs. So, you are changing "config" into "configure". That will fix the problem. stephen
  4. Glad you figured out your specific problem. You are right, this workflow is fairly narrow in its functionality, but that's really the only way to ensure that it works well. Plus, as you also say, there are so many workflows that add the specific functionality someone may be looking for. I'm just happy you found something that does the work you need done. stephen
  5. @poer, that's a great idea. When I update the workflow, I will definitely add this feature. I'm also happy to hear that you like the workflow and it helps you out stephen
  6. Oh yeah. I gave it a new bundle_id so that I could develop it alongside the older version. I should change that soon. Basically, you should use it and if it works well for you after you put it through the paces, I'm going to officially release it (then I will need to change the bundle_id to the basic ZotQuery one).
  7. I haven't had any problems. But I also do alot of minor magic to deal with encoding. The functions I use are: def to_unicode(text, encoding='utf-8'): """Convert `text` to unicode""" if isinstance(text, basestring): if not isinstance(text, unicode): text = unicode(text, encoding) return text def set_clipboard(data): """Set clipboard to [font=courier new,courier,monospace]data[/font]""" os.environ['__CF_USER_TEXT_ENCODING'] = "0x1F5:0x8000100:0x8000100" text = to_unicode(data) proc = subprocess.Popen(['pbcopy', 'w'], stdin=subprocess.PIPE) proc.communicate(input=text.encode('utf-8')) def get_clipboard(): """Retrieve data from clipboard""" os.environ['__CF_USER_TEXT_ENCODING'] = "0x1F5:0x8000100:0x8000100" proc = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE) (stdout, stderr) = proc.communicate() return to_unicode(stdout) set_clipboard('hëllœ wõrld') x = get_clipboard() print(type(x)) print(x.encode('utf-8')) This works perfectly fine for me on Yosemite. And you're right, the JSON stuff is basically unneeded with Alfred-Workflow's new serializer functionality. The AppleScript and clipboard stuff is probably the most useful (converting Python lists to AS lists is sooo helpful the one time you need it). I agree. I've figured it out. This was primarily aimed at keeping Alfred-Workflow up-to-date in all of my workflows, both for my own development and for packaging and sharing. I wrote a simple Python script to overwrite Alfred-Workflow with a canonical version to keep it up to date.
  8. Ok. Instead of trying to debug an older version of ZotQuery, I'm going to send you the beta of the new version (TBH I barely remember the code from the old version). This should fix your problem (assuming the problem is what I think it is). The new version will automatically overwrite the old version, so it is super easy to install. Go here and download the .alfredworkflow file: <https://github.com/smargh/alfred_zotquery/releases>. Then, try to set everything up again.
  9. It does. I used it successfully to update to this newest version
  10. I'm grateful that you think zotquery worth the investment. Have you tried to run z:config with Alfred's debugger on for ZotQuery? That would probably give me some helpful clues as to what's wrong. Also, try to do a simple search with the debugger on. Paste those logs here and I'll look them over.
  11. I've decided to go another route. I've written a quick Python script that overwrites all instances of a certain file with a canonical version. This way, I ensure that all of my workflows are using the most up-to-date version of certain key libraries (Alfred-Workflow, Alfred-Bundler, utils.py, etc), but the actual files are all real, so it's easy as pie to package and share the workflow via Packal. Also, if you post some specific target goals on GitHub for the Python Bundler, I'll give it a look. It's been a while since I looked at @deanishe's code, but from what I remember it was super well-documented and easy to follow. I also think adding utils.py could be helpful. I passed the idea of adding it to Alfred-Workflow by @deanishe, but he wasn't sure it would be worth the added bloat. But I use it in all of my workflows. It has a number of functions to simplify reading and writing to files (and directly to JSON), a collection of functions to make using AppleScript in Python a total breeze, functions to interact with Alfred, a simple but helpful mdfind wrapper for searching a user's drive, and convenience functions for working with the system clipboard (in UTF-8 encoding ). It's sort of a grab-bag, but it really helps with development, since I use these functions all of the time, but now I don't need to keep rewriting them.
  12. I'm wondering if someone else has tried this or does this? I want to clean up my Workflows, and the main way I'm thinking to do this is to symlink files that I use in multiple workflows (like the Alfred-Workflow library and a utils.py file I've made). While I know that this will allow the workflows to work on my machine, I'm not certain how things will work when I share a workflow with symlinked files in it. Has anyone distributed a workflow with symlinked files?
  13. Yeah, one of the downsides to fiddling with my computer so much is that I often loose track of what I've changed and how. That's one of the reasons I like to package things in Alfred workflows. It's all synced thru Dropbox and I know to go to one place for functionality.
  14. Woops. I recently reset my Air and `cask` isn't installed yet. So that's on me, tho having a check for installation up front would probably provide better debugging.
  15. Unfortunately I'm still having trouble with the cask filter (using version 2.2 from GitHub). When I type cask, I get all the options, but if I select any of the options, Alfred immediately kicks to the default search (this happens with any options, i.e. cask search, cask install, cask list, etc). Here is the log for two attempts: [ERROR: alfred.workflow.input.scriptfilter] Code 0: 20:59:16 workflow.py:2053 DEBUG Update check not due 20:59:16 workflow.py:1544 DEBUG Loading cached data from : /Users/smargheim/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.fniephaus.homebrew/__workflow_update_status.cpickle 20:59:16 background.py:180 DEBUG Command arguments cached to [font=courier new,courier,monospace]/Users/smargheim/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.fniephaus.homebrew/cask_refresh.argcache[/font] 20:59:16 background.py:184 DEBUG Calling [u'/usr/bin/python', '/Users/smargheim/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.A69C6FCF-7BC0-402E-8931-A7344624C51C/workflow/background.pyc', 'cask_refresh'] ... 20:59:16 workflow.py:1907 DEBUG Workflow finished in 0.002 seconds. 20:59:16 workflow.py:1907 DEBUG Workflow finished in 0.004 seconds. 20:59:16 background.py:189 DEBUG Executing task [font=courier new,courier,monospace]cask_refresh[/font] in background... [ERROR: alfred.workflow.input.scriptfilter] Code 0: 20:59:39 workflow.py:2053 DEBUG Update check not due 20:59:39 workflow.py:1544 DEBUG Loading cached data from : /Users/smargheim/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.fniephaus.homebrew/__workflow_update_status.cpickle 20:59:39 workflow.py:1544 DEBUG Loading cached data from : /Users/smargheim/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.fniephaus.homebrew/cask_installed.cpickle 20:59:39 background.py:180 DEBUG Command arguments cached to [font=courier new,courier,monospace]/Users/smargheim/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.fniephaus.homebrew/cask_refresh.argcache[/font] 20:59:39 background.py:184 DEBUG Calling [u'/usr/bin/python', '/Users/smargheim/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.A69C6FCF-7BC0-402E-8931-A7344624C51C/workflow/background.pyc', 'cask_refresh'] ... 20:59:39 workflow.py:1907 DEBUG Workflow finished in 0.002 seconds. 20:59:39 workflow.py:1907 DEBUG Workflow finished in 0.004 seconds. 20:59:39 background.py:189 DEBUG Executing task [font=courier new,courier,monospace]cask_refresh[/font] in background...
  16. There appears to be a file missing. I get this error when running the cask command: [ERROR: alfred.workflow.input.scriptfilter] Code 1: Traceback (most recent call last): File "cask.py", line 10, in <module> import cask_refresh File "/Users/smargheim/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.A69C6FCF-7BC0-402E-8931-A7344624C51C/cask_refresh.py", line 5, in <module> from cask_helpers import execute_cask_command ImportError: No module named cask_helpers
  17. @dfay, these are great notices. If you've altered your version of the workflow's code, you could throw a GitHub pull request and I could easily add it. Right now, I'm working on my rewrite of ZotQuery, so I can't fiddle with this right now, but I will eventually get back to it.
  18. Ok. I need a few beta testers for ZotQuery 10.0. This is a complete rewrite of the ZotQuery code base, though it retains the exact same API (so keywords are the same, possible actions are the same). I've been testing it on my machine, but I want to run it through its paces. I have some automated testing that you could run, and then you would also use the workflow for a while so I can get your feedback. If you are interested, send me a PM.
  19. Ah... I meant that there is only the one keyword `libgen` used for the workflow. You can use as many query terms as you'd like. I guess I'm not certain which your comment actually meant.
  20. Well, first, thank you. I don't remember where I said there is a one keyword limit, but that is at least no longer true. You can type as many words as you like, followed by the . to start the search. However, I cannot increase the number of Displayed Results. This is a part of Alfred's underlying UI. As to opening the site with the query, that is certainly doable. I will look into when I can (I'm trying to finish my total rewrite of ZotQuery. Be forewarned, it looks the exact same, but it is FAST and just plain kick-ass )
  21. Ok. I'm not 100% certain what caused the issue. I think it might have been an internal change in Alfred, or maybe do to some small change in Yosemite. Basically, a newline space was being added to the end of the URL as it was being processed in Bash. Whatever the cause, however, I have it fixed. I was actually about to radically simplify the downloading code, which should keep any future errors of this sort out of the picture. Please update at Packal (version 1.1) and let me know if this does the trick for you. http://www.packal.org/workflow/libgen stephen
  22. ctwise makes good points. In simplified form, you should try this: ruby start.rb "{query}"
  23. Can you run Alfred's debugger and send me the results? The workflow is still working for me. Also, could you send me an example search and item you selected to get this error?
  24. Could you post the before and after of line 96, so that I can see exactly what needs to be changed, and hopefully can see why.
×
×
  • Create New...