phyllisstein Posted May 24, 2013 Share Posted May 24, 2013 Hey everybody, it's your old pal Daniel. I just wanted to share a workflow that I threw together this morning. I've gotten a number of requests for an alp tutorial that walks one through the process of making a workflow with Alfred 2 and alp one step at a time, and I needed a sample to look at as I was working. And lo, "Yourls Stats" was born. It's not especially complex, but it makes use of many of alp's more advanced features—some of which got slightly rewritten as I worked—to do something marginally useful. I thought I'd get it out there in advance of writing the tutorial to see if it had any lingering bugs. Enter "ystat" (or a keyword of your choice) to trigger the workflow. The first time you invoke it, it'll need to be configured; go to your Yourls admin site's "Tools" page and copy your secret signature token, then enter "ystat url=mysite.ly signature=0123456789" into Alfred. You'll note that the workflow guesses the location of the API PHP as you type, and that the feedback item won't be valid till both values are entered. Once they are, hit Return. Your signature token will be stored securely in the Keychain, your URL in cleartext in the workflow's settings JSON. Alfred will pop back up with your custom keyword already entered and begin downloading your Yourls data. Enter a query to search fuzzily through the links' titles and short keywords, and press Return to copy a link to the clipboard. You can download the workflow here, and, as always, do let me know if it breaks. Link to comment
Davide Posted May 26, 2013 Share Posted May 26, 2013 Hi, thanks for this workflow! I would like to reset the configuration. Un- and reinstall the workflow didn't work. Link to comment
phyllisstein Posted May 26, 2013 Author Share Posted May 26, 2013 Shouldn't be a problem: just enter the configuration string again with your new values and the workflow ought to update them. Link to comment
Davide Posted May 26, 2013 Share Posted May 26, 2013 Does not work, fall back search starts immediately after typing "ystat url". Link to comment
phyllisstein Posted May 26, 2013 Author Share Posted May 26, 2013 Aha, right you are. Well spotted. I've just uploaded a new version to http://alfred.daniel.sh/Workflows/YourlsStats.alfredworkflow that should fix the problem. The update is also available through Alleyoop. Link to comment
Davide Posted May 26, 2013 Share Posted May 26, 2013 (edited) Hmm, get now "Network error, no JSON object could be decoded". Also can't reconfigure it. Another question: I'm sure you know the yourls workflow from Andi. I asked him for implementing a custom short url ending but no answer. Would you like to do it? Example: I open Alfred type yourls enter my preferred short url, e.g. alfred Result: a short url like abc.de/alfred Edited May 26, 2013 by Davide Link to comment
phyllisstein Posted May 26, 2013 Author Share Posted May 26, 2013 The networking code hasn't changed—I suspect that the workflow legitimately can't reach whatever site you'd previously configured it with. In which case you may have to delete the configuration file by hand: navigate to ~/Library/Application Support/Alfred 2/Workflow Data/ and delete the directory com.danielsh.alfred.yourlsstats, then enter the configuration command. As for customizing the shortened URLs, unfortunately the Yourls API doesn't provide that functionality yet. Link to comment
Davide Posted May 26, 2013 Share Posted May 26, 2013 Thanks for the API info and the config path. Found my mistake in the settings.json. Everything works fine! Link to comment
Davide Posted May 27, 2013 Share Posted May 27, 2013 (edited) As for customizing the shortened URLs, did you read the custom API Info from yourls 1.6? Edited May 27, 2013 by Davide Link to comment
phyllisstein Posted May 27, 2013 Author Share Posted May 27, 2013 I'm glad it's working again! However, in addition to having very little PHP, I'm not especially interested in implementing something that would require users to engage in that level of dicking around with their personal configurations. Working with the standard features is about as far as I'm inclined to go. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now