Murphy Mac - Screencasts and Tutorials » Archive of 'Jul, 2011'

Remote Control Spotify

“I don’t think necessity is the mother of invention. Invention, in my opinion, arises directly from idleness, possibly laziness, to save myself trouble.”
-Agatha Christie

In Murphy’s continuing efforts to avoid leaving the sofa he’s using an iPhone to kick off Spotify on the Mac upstairs and have it stream over Airfoil to an Apple TV connected to a stereo downstairs. It works, it’s pretty simple, and once it’s started there are other options for controlling it. spotify
The key is that Spotify recently added some basic AppleScript support to their Mac app. Not as much as we’d like to see, but enough to get us started. Spotify says they’re just experimenting with AppleScript at this point. (There were workarounds before Spotify added support) We’ll be watching for further enhancements.
This short and simple AppleScript (view entire script) is all you need to get started. It launches Airfoil (an application for redirecting audio from your Mac to remote speakers via Airport Express or Apple TV) and selects Spotify as the audio source application. Then it selects a playlist in Spotify and initiates playback. That’s it. Let’s take a look at the script.
script
The lines in the first block set Spotify as the application Airfoil will pull audio from. As long as you’ve got Spotify in your Applications folder you can copy those lines exactly. The line in the next block references your speaker id, which you probably don’t know. You can get the id by running a very simple script that looks like this. That line will query your remote speaker for its id and display it in the results pane of the Applescript Editor. Be sure to use the name of your Apple TV or Airport Express in the quotes. Once you’ve got the id you shouldn’t need to run that script again.
script
The script pauses to make sure your Mac doesn’t get ahead of the launching applications. Spotify hasn’t provided playlist selection hooks for Applescript yet, but they do provide something almost as good. In the Spotify application you can right-click a playlist or track and get an identifier, just like you see in the screenshot at the top of the post. You want to select Copy Spotify URI. Notice the open location line in the script, it’s not inside the Spotify tell - end tell section because it’s not in the Spotify Applescript dictionary. Regardless, it works to select a playlist and that’s all we really need. The last part of the script tells Spotify to start playing.
So - now we just need the script to run. Murphy is using a Mail rule. He sends himself an email with a subject Mail is watching for. Mail runs the script whenever a message with that subject comes in. Once Spotify is up and running the Speakers app that comes with Airfoil can be used to pause or skip to the next track.
I’d rather have an application on my iPhone, maybe something like TextExpander, that could list Applescript TextExpander snippets on my Mac and kick them off that way. But I don’t know of an app like that. The email kick-off works fine, and it’s quick and easy to use, but at times I might have to use another app to wake the Mac up.
In the past I’ve used Mail to run Applescripts on my Mac. It started with putting my Mac to sleep by email but I’ve also used the strategy for kicking off iTunes (before the Remote app) and for file retrieval.

If you’re looking for more information on Applescript and Airfoil they’ve got some examples on their site.
Interesting: Initially I made a script that opened a Spotify playlist and didn’t include the line to commence playback. It stopped working after a day, I don’t know why. It would play the one track and then stop. The day before it jumped to whatever playlist had been set as the current playlist in the Spotify application and continued playback. Not sure what happened there.

Share/Save/Bookmark

| Permalink

Report a Problem in iTunes

It’s frustrating to see that Apple hasn’t updated the interface for reporting a problem in iTunes. The worst part is that the more content a person has purchased the more difficult it becomes to find a transaction and report it. There aren’t many instances where Amazon could teach Apple about interface design - but this is one of them.

If you go into your account in iTunes and look at your purchase history there’s a link to Report a Problem. If you know what month you made your purchase you’re all set. Otherwise prepare for frustration.

The interface lets you search by month and year. I can’t tell you the month and year when I purchased most of my music. That leaves you to page through the transactions a page at a time, eleven transactions per page. The worst part is the noticeable delay every time you click ‘Next’ and wait for the next page to populate. No exaggeration, 5-10 seconds per click. Further, every time you update an app you’re building more line items, creating page after page to sift through.

Customer service departments have been setting up obstacle courses in their phone systems for years. Now Apple is doing the same thing with their application’s interface. Amazon offers a search field that makes finding an order near instantaneous. They even let me run customized order reports.

I’m not naive, I know Amazon has something to gain by letting me search my orders: re-orders. But Apple doesn’t. I’m not going to buy a song or an app again, so why should Apple make it easy to find my order?

Apple is renowned for its expertise in interface design - making it obvious this lack of customer service is intentional. There’s no excuse for wasting people’s time intentionally.

Want to see for yourself? Visit the store in iTunes. Under your account name at the top right click Account. Then next to Purchases click on See All. You’ll see a button to report a problem.

Share/Save/Bookmark

| Permalink

Auto Mail Redux Part II The Revenge

mailerA long long time ago Murphy showed you how to mail attachments with one click and drag of a file. No addressing, no clicking send.  Drag the file to a Finder folder and it was emailed to a pre-set address.  I used to use it for backing up files into a Gmail account.   You might find it useful for services like Evernote and Flickr as well.

Now we’ll show you how to do it in Automator, with enhancements.  First, the file name(s) of the attachments get added to your email’s subject line automatically.  Second, the sent files are placed in a Finder folder of sent items.  Murphy provided an Automator solution for this task before, but the email subject feature and the filing are new features.

Here’s a screencast that shows how it works.    When you want to send a file simply drag it to the folder and it’s sent.  No additional clicks.  You might create different versions of the Automator application.  For example, one might mail to a Flickr account and another might be used for sending a photo to four grandparents at once.

Feel free to suggest enhancements to the Automator workflow in the comments.  There’s a third party Automator action that can easily get file names without the full path name if that’s what you prefer.

You can see all the actions in the Automator workflow here.

Share/Save/Bookmark

Screencast | Permalink

Pogue

I saw on Daring Fireball today that John Gruber didn’t know, to my surprise, that David Pogue isn’t an employee of The New York Times.
I only knew about Pogue’s status because of an interview I heard two years ago, when Leo Laporte had him on This Week in Tech.  I should probably listen to it again, but I’d be forced to count how many times Pogue says, “dude.” It was interesting to listen to, especially as Pogue pointed out repeatedly and defensively that he’s not a “journalist.” He’s a columnist.  I can say he was defensive, I’m a blogger.
What Pogue calls himself means nothing to me.  But I’d still appreciate it if he revealed his conflicts of interest when he’s reviewing a product.  For The New York Times !
Pogue makes money writing books about Apple software. He builds a bigger name for himself by getting exclusive access to unreleased Apple products, along with other non-journalists like Walt Mossberg. If he starts slamming Apple products or grading them on a tougher curve he can kiss his access to Steve Jobs goodbye. In the interview he more or less admits he’s not going to ask the tough questions because he’ll lose access. And because it’s not his job. (He’s not a journalist.)
Daring Fireball linked to a July 6 post (that I missed) by the New York Times readers’ representative declaring that Pogue’s appearances as a representative of the publication will be curbed.

Arthur S. Brisbane:  ”…my inquiry into it has led to a Times internal review and, as a consequence, Pogue is barred from making any more speeches like this one to public relations professionals.”

I don’t expect much to come of this.  Pogue is an extremely popular piece of New York Times content.  Personally, I find his videos over the top and not as funny or informative as his commenters find them.  Fans jumped to his defense in the July 6 comment thread, with excuses similar to those Pogue made on Leo’s show.  Which was that essentially all tech reporters are cozy with the tech companies.  If Mossberg can collect big paydays for speaking why shouldn’t Pogue?

We all know there will always be certain reporters who get special access.  According to the NYTPicker piece on the subject Pogue actually claims he’s pushed the New York Times to reveal his other endeavors, but failed.

The average New York Times reader and iPad buyer could care less about any of this.  Granted, Pogue isn’t the only one up to these kinds of shenanigans.  But he’s high-profile and with that comes the heat.  Am I turning to Pogue for truth in technology reporting?  No way.  I read him from time to time - but only so I know what everyone else is reading.

Leo Laporte’s interview with Pogue, from the TWiT network.  1:39:20h into the show.

David Pogue’s disclosure, undated, at the New York Times: A Note About Ethics and Disclosure.  You have to click through to his profile to find it, it’s not listed within his columns.

Share/Save/Bookmark

| Permalink

View Airport Express Connections via Command Line

airport expressThese days I need two Airports to cover the house.   There’s an Airport Extreme and an Airport Express that’s wired via Ethernet to extend the network.   The Express was acting a little flaky and I wanted to know if anyone was connecting to it.  (check out Glenn Fleishman’s e-book for in-depth info on optimizing your Apple wireless network.)

One option is using the Airport Utility to see connections to your Apple wireless access points.  But that’s a lot of clicks, and you can’t easily check it from your iPhone or iPad.   Here’s an alternative:  Use an SNMP command to see what’s going on with your Airport Express.

Murphy found a suitable command on Polydistortion.net, shown below:

snmpget -v 2c -c PASSWORD -M /usr/share/snmp/mibs:$HOME/share/mibs \
-m+AIRPORT-BASESTATION-3-MIB MyAirportExpress.local AIRPORT-BASESTATION-3-MIB::wirelessNumber.0

You can delete that backslash at the end of the top line and enter it all as one line in Terminal.  You also want to enter your router’s password in place of password, and your router’s name in place of MyAirportExpress.   Don’t get confused and enter your wifi password or the name of your wireless network.  It’s the name of the router you’re looking for and the administrative password.

When you enter that in Terminal you should get a response that looks something like this:

AIRPORT-BASESTATION-3-MIB::wirelessNumber.0 = INTEGER: 0

The last number represents the number of clients connected to that Airport.  In this case there aren’t any.
I tried using the same command to query my Airport Extreme and had no luck.  I saw reports of people having trouble with SNMP once the last Airport firmware update hit.   Let me know if you have a solution.
The Terminal command was a more direct way for me to get the information I was looking for.  Using an app like TouchTerm SSH I can get the answer from my phone or iPad as well.
Take a look at the brief screencast.  First it quickly demonstrates how many clicks Airport Utility requires to get the information.  Then it shows the Terminal command being executed.
The command is really long.  You could create an alias and save it in your .profile file so it would always be available in your Terminal.  That way you could enter something like “aeusers” in the Terminal instead of the long command.  See Murphy’s post on alias creation for more information.
The page where Murphy found the command for querying the Airport had other commands as well. SNMP (Simple Network Monitoring Protocol) is a cross-platform protocol that’s been around forever - you can do plenty with it. The Airport can also report its information via Syslog, but that’ll have to wait for another day.

Share/Save/Bookmark

Screencast | Permalink