print to podcast

The VipRiser can produce more then just a PDF thanks to its ability to customize processing workflow using  a plugin.

Listening to your print-outs

I do a lot of reading in my work (and my private) life and I always wished I could turn some of that text into spoken word so that I can take it with me out biking or hiking rather then staring at it on my screen at home. The OS X had text to speech functionality built-in since 10.4 (I think), however only with the Mavericks the quality of the voice is good enough for it to be truly usable. If you are into this kind of thing, that is :-).

There are different ways how to turn text into a voice track already. One of them being Add to iTunes as a Spoken Track service, but I use VipRiser for that. One big advantage is that whatever text I can print, I can listen to.

Setting up a workflow

I thought ‘print to speech’ is kind of interesting workflow, therefore I added it as a sample into the VipRiser distribution itself. You can install it from Preferences.

screen-shot43188

The plugins (workflows) will appear in the menu along with Folder, Kindle etc. and you can use them as VipRiser’s destination.

Customizing the ‘PDF to Podcast’ workflow

Although this sample workflow is derived from the real one I personally use, it is meant to be further customized by the end user. You can look inside by going to the Plugins directory (use Open button) and opening the workflow in the Automator.

screen-shot43272

The Automator workflows can get quite complex. This is great if you a programmer but understandably scary if you are not. Luckily there are many good resources for the Automator on the web to help you along, therefore I will not go into deep technical details here.

What does it do

In short:

  1. extract text from the PDF
  2. reflow the text
  3. turn text into an audio file
  4. add it to the iTunes

The reflow of the text is one of the tricky point. The problem is that words extracted from a PDF will most likely be broken up to satisfy given layout. The text to speech cannot deal with this on its own. The shell script step (a perl script) attempts to take care of this by ‘un-breaking’ broken words and clean up the extracted text somewhat. …I do not expect anyone to understand this code 🙂 However, this part is directly influences the quality of text to speech conversion as extracted text may contain stuff that should not be spoken at all (e.g. headers, side notes) or that may not be in form of senses and paragraph (e.g. tables, lists). Getting this right very much depends on kind of documents you want to process.

How to use it

  1. set the destination to the workflow (e.g. Sample – PDF to podcast)
  2. print
  3. the MP3 file will be added to the iTunes (playlist is configurable in the last step)

TIP: What works really great is printing articles out of the reader mode in the Safari.

Advertisements

Shell commands as a link

Trigger Terminal Command As a Link

What I usually do is I keep a list of commands I frequently execute (e.g. mvn build, git update) in a text file accompanying whatever I work on at the moment, along with notes and references.

Each time I would want to run a command, I had to copy + switch to Terminal + paste. It is not exactly intellectually challenging process but it gets a bit tedious after while. Therefore I decided to automate it by creating custom terminal: URL protocol scheme which enables me to execute any script with click of a mouse.

1. define terminal scheme

screen-shot26536

2. create handler

screen-shot26549

This is very simple AppleScript handler. All it does it tells Terminal to activate and then runs a command which is passed in the URL. …and don’t forget to return 1 upon success.

3. activate the new URL scheme

Click the Save and Activate button and hide LinCastor application, leaving it running in the background.

Using the new ‘terminal:’ scheme

For this demonstration I regular TextEdit. However, most applications supporting embedded links should work with this.

Create link (Edit -> Edit Link…)

screen-shot26609

Enter shell command a link’s destination, with prefix terminal: You can split the lines using pressing <atl + enter> key. Although links can be few K in size, this method is not intended to do more then to trigger a few commands. If you need something more complex, think about putting it into a proper shell script file and trigger it from the link instead.

The resulting link should look something like this:

screen-shot26686

When you click it, command ‘ls -lrt’ (which lists a directory) should execute in your Terminal.

A word of caution!

Executing arbitrary command by clicking on a link is powerful thing to do. Since a link can be embedded in any HTML (web site, email, chat), be careful where it comes from and who is sending it to you before you click it.

VipRiser running ‘face-less’

Version 0.9 adds support for running VipRiser without any user interface, with new notification mechanism to help an user see what’s going on under the hood.