Jump to content

phyllisstein

Member
  • Posts

    366
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by phyllisstein

  1. Generally speaking, I think it's best to do a series of conditional checks for the length of argv. So your code could be rewritten to look something like this: import urllib2 import sys args = sys.argv def generate_password(length = 4, dictionary = "british"): dict_file = dictionary.lower() + ".txt" with open(dict_file) as f: orig_list = f.readlines() wordlist = [] for word in orig_list: wordlist.append(word.strip()) maximum = len(wordlist) # etc. return password if len(args) == 1: #sys.argv[0] is always your script's name print generate_password() if len(args) == 2: query = int(args[1]) print generate_password(length=query) if len(args) == 3: query = int(args[1]) dictionary = str(args[2]) print generate_password(length=query, dictionary=dictionary) Because—at least according to my quick experimenting—all the objects in sys.argv are type str, even if they can be cast to or treated as numbers, it'd be hard to test for whether the user entered just a dictionary name. You could do it by not adding .txt automatically, and then checking to see if .txt was in the argument's string: import sys args = sys.argv if len(args) == 2 and ".txt" in args[1]: print generate_password(dictionary=args[1]) elif len(args) == 2: print generate_password(length=args[1]) elif len(args) == 3: # etc.
  2. Hey everybody! So I've just made some changes to this workflow. In particular, you can now create filenames with spaces in them (slight oversight), and you can now delete files by entering their names and pressing Control+Return. Control+Return will still forget saved names and paths if you invoke the "Add File" or "Add Path" options, enter the filename or path again, and then press the key combination. Holding Command while pressing Return will still open the file after its creation. You can grab the update through Alleyoop, or at http://alfred.daniel.sh/Workflows/CreateNewFile.alfredworkflow Enjoy!
  3. I know, right? I'm literally shoving go-go boys off my knees, trying to get something, anything done. In which regard: I caught a bug that might have caused Alleyoop to crash if a cached workflow was deleted. Hopefully the problem's been circumvented now. New version in Alleyoop and at http://alfred.daniel.sh/Workflows/Alleyoop.alfredworkflow
  4. Oh, how foolish of me! Sharing was disabled. It looks to be working beautifully now—thanks a billion!
  5. Well, since both six and biplist were small and easy to tweak so as to be imported with alp, and since it seemed like it could come up again, I decided to go ahead and do it. Meaning, as a general announcement, that alp now supports reading binary plists—no changes to implementation necessary. I added a link, @soulesschild, to your github profile in the code; let me know if I can be more direct with crediting you for the change in any way.
  6. Hey there! This is utterly brilliant, and I'm excited to start using it! Unfortunately, I'm having some trouble: I can't get iTunes to react, even using the Terminal command, which just runs without any output. I tried disabling Norton's firewall and LittleSnitch, but I never even got notice from them that a service was starting on your port. If it helps, ruby -v turns up ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]; I recently updated it with MacPorts, which I worry might be the source of the problem.
  7. Thanks! I'll take it under advisement, though I'll confess to being less than keen on requiring all alp users to install a new module.
  8. Absolutely! Thanks for figuring that out. I've just uploaded a new version to http://alfred.daniel.sh/Workflows/Alleyoop.alfredworkflow with followlinks set to True.
  9. Hah! I see; I didn't account for binary plists at all when writing it. That'd definitely cause it to generate malformed XML. Glad you figured it out!
  10. Hi there, I'm honestly not sure, but I suspect that there's something wrong with the plist such that it's generating invalid XML. My guess, but it's only a guess, is that there's a UTF-8 character in the property list. You may have to use the codecs module to open the file, read it into memory, and then pass it to plistlib.readPlistFromString() by hand. I'll rewrite the alp code so that it does this—it's probably wise anyway—but give that a shot in the meantime and see if it does you any good. ETA: I've just pushed a change to Github that may help, but I'm not positive. Give it a shot and see how it works. If you'd be willing to e-mail me the plist file (d at daniel dot sh), that'd be great too.
  11. Alright, I've just uploaded a new version to http://alfred.daniel.sh/Workflows/OpenMetaTags.alfredworkflow that will hopefully correct the problem. If not, let me know.
  12. I'll give it some thought, but I don't think so; all the internal searching is done by tag, not by file. Could you check the workflow's folder for a file called "feedback.log" and let me know what it contains? Thanks.
  13. Nice work! You might want to rename it to reflect the fact that it's adding comments, not tags, though; OpenMeta tags are a different animal than Spotlight comments, as you can see from my tagging workflow.
  14. Yeah; I have no doubt that the search API Apple exposes works differently from the search in iTunes itself. Among other things, the API requires that I make two requests for a basic keyword search: one for "items," and one for "artists," and so artist results will always be the second-place set, even when they're more relevant. It also just has a more general habit of returning crummier, less relevant results that I can't really account for: I've been over and over the API docs looking for a different way to ask it the question I want to ask without any luck. Consequently, this is the workflow of mine I use least often. *shrug*
  15. Sorry all, silly typo. Just tested http://alfred.daniel.sh/Workflows/Alleyoop.alfredworkflow and it seems to be working.
  16. It was actually the update-check for Alleyoop itself that was timing out, and so it's indeed my site. I believe that some of the workflows are hosted on Dropbox; a number are on Github; some are on personal sites.
  17. It looks like your connection is timing out. Unfortunately, there's not much I can do about that except catch the exception and skip the workflow that's timing out; that's no guarantee, I'm afraid, that it'll work on any of them. You can try with the updated version at http://alfred.daniel.sh/Workflows/Alleyoop.alfredworkflow though.
  18. It would be helpful if you could post the contents of "all.log" from the workflow's folder here so that I can get a better idea of what's going on.
  19. I made a couple of changes to get it running again; try http://alfred.daniel.sh/Workflows/iTunesStore.alfredworkflow International users will be pleased to know that they can now set the country whose iTunes/App Store is searched by modifying the file ~/Library/Application Support/Alfred 2/Workflow Data/com.danielsh.its/settings.json and including a key--value pair like this: { "country": "NL" } I've uploaded the old version to http://alfred.daniel.sh/Workflows/iTunesStore (Old).alfredworkflow, but I don't plan to support it or update it any further; it won't have feature parity and I can't drive myself nuts keeping two versions up-to-date.
  20. Not to worry; nobody likes bugs. I think I've squashed at least some of them in the latest version, so let me know how it works for you. I'm afraid that since it's just a script filter, there's no way I can see to do it without adding three more separate scripts or supporting two versions at once, neither of which is hugely appealing. I've been trying to get it to behave like this since the beginning, so I'm more inclined to stick with this version. If the search works the way it's supposed to, I imagine that most people will want to go straight to purchasing an item; if it doesn't, opening a web browser is way more memory-hogging than iTunes or the App Store.
  21. Hah, thanks! So the best I can do for now is catch the error, log it, and continue on to the next workflow hoping that things are better the next time around; it won't just fail on you, but if you notice that some workflows are conspicuously missing then it'll make sense to check the debug.log file for errors. I take this to be a slight improvement, at least, till I can figure out why this module is breaking. Self-update or download here.
  22. Thanks for the log files. I poked around a bit on my own system and got a couple of errors with requests_cache, so hopefully that was causing your trouble, too; I'll try and figure out what the deal is. Sorry for the inconvenience.
  23. Can you tell me what comes up in the .log files in the workflow folder?
  24. Sorry it took me so long to get around to this, gang, but I wasn't getting e-mail updates from this thread for some reason. I've just posted a new version of the workflow that updates some of the backend stuff, hopefully making it a bit faster, adds a direct fallback search in the App Store and iTunes Store, searches for artists, and opens the links it returns in the pertinent Store directly rather than jumping to a Web page. You can download it here or, if you've downloaded it recently, update it through Alleyoop.
  25. Thanks, good catch! I just fixed it with a new update. Hopefully that'll settle things for a while.
×
×
  • Create New...