Play Apple Podcasts on Sonos

We use Sonos at home to stream radio and music across our apartment. It’s a great system with a pretty decent app, but sadly it lacks AirPlay support to easily get media that’s played on an iPhone or iPad to the speakers. I’m also an avid Podcast listener. I used to use Overcast, briefly switched to PocketCasts for its new Sonos integration, but I’ve currently moved back to Apple’s native Podcast app due to its new design, Siri integration and since I’m kinda hoping it’ll get support for the Watch someday.

Since I use the regular Podcast app, there wasn’t any clear way to AirPlay, sync or access those episodes on Sonos.

At least, not that I knew off.

But, while getting lost in Sonos’ new interface this morning, I discovered something: if you go to the Sonos app > Browse > On my iPhone, it now shows a Podcasts section at the bottom, and you can pick any downloaded episode on your device to play.

Sadly, it doesn’t sync playback status or time stamps (yet). And I have no idea happened to the album art. But I suspect they take it from the same source as Tesla does.

Here’s hoping AirPlay 2 will bring some better way of streaming media to Sonos.

Fixing the iPhone X Control Center

I love my iPhone X. But if I got to change one thing, I’d change the way it gives you access to Control Center.
That upper right corner swipe is quite difficult to do one handed, and completely impossible when you’re a leftie.

I’d love to 3D Touch the home indicator to go to Control Center. Or have it available via multitasking. Or as a view on the right of the home screen similar to notifications on the left.

But for now, I’ve used Accessibility >> AssistiveTouch to embed a Control Center button on the bottom right of the Home Screen. It’s not pretty. But it works.

Demo

Sonos Network Issues

We use Sonos at the office for easy music-access across the entire building. We’ve got 8 Sonos AMPs linked to Bowers And Wilkins built-in ceiling speakers, combined with a couple of Play:3 and Play:1 units for smaller offices. It’s an elegant system. We hooked up one radio, tuned to Studio Brussel to the line-in of one of the AMPs, thus combining one of Belgiums better radio stations with a zero-bandwidth solution. It’s better to share the line-in of an AMP than to have a dozen Sonos devices all streaming high quality internet radio all day.

Users who do want something different can use the build-in Tune-In radio to pick a radio station of their preference. All hooked up to ethernet.

A perfect solution. Or so we thought.

Issues

For a while now we had some serious issues on the network. Switches would randomly lock, internet would grind to a stop and internal network traffic would just drop.

Frustrated and confused, because there was no obvious culprit to be found, I spent last weekend rewiring and checking our entire server-backbone. To make this process easier I decided to turn off any devices that weren’t necessary to work productively.

Accidentally I noticed that the network behaved a lot better after I disconnected the switch that contained all the Sonos devices. And said switch still acted weird even when unpatched from the rest of the network.

Turns out: Managed switches and wired Sonos is a big no-go. If you have more than one Sonos connected via ethernet, things may go wrong.

Since Sonos also talk to each other, they have the downside of possibly creating a Broadcast Storm on your network, and thus taking down a part or all of the network.

Luckily there’s a solution: either use a dumb unmanaged switch (not gonna happen), or adjust the Spanning Tree State settings of your switch(es). So a few configuration changes later, we again have a stable setup.

If you happen to have some managed switches, and think about hardwiring your Sonos to reduce the load on your wi-fi network: file this article for future use. It may save you from spending a sunny afternoon in a server room surrounded by ethernet cables and switches.

Yosemite Open Directory Replicas

Summertime is the ideal time do to some heavy duty system maintenance. Lots of people are out of office, and those that are in house don’t mind a few hours of planned downtime. So today I finally upgraded our root- and fileservers from OS X Mavericks to OS X Yosemite. Finally, because it’s been I year since Yosemite was first released. But since our fileserver is an Open Directory replica of our root server, updating one means updating the other, and combined with all the DiscoveryD issues that plagued OS X these last few months, I didn’t really dare to update any one of them.

Currently, when updating OS X server from one OS to another, we need to update its core OS first, which disables all server services. Only then can you download the new server.app for this new OS, which upgrades all server services and hopefully launches successfully afterwards.

But OS X Server 5.0, which is being developed in tandem with El Capitan, will be the first Server app that can be installed on a previous system, without the need to upgrade OS X first. Getting all our servers on OS X 10.10.4 now, means upgrading from Server 4 to 5 in the fall will be as easy as moving from Server 4.0 to 4.1.

Luckily the upgrades went smoothly this time without any major problems. And in less than three hours, which was far less than I expected.

A quick note on Open Directory Replicas

Our two main servers are replicas of each other to spread the load over multiple servers. But after upgrading them according to Apple’s own guidelines, I somehow still destroyed our Open Directory Master-Slave link.

Turns out: If you have passwords policies on your Open Directory Master, and your diradmin’s password does not comply with these policies, the Open Directory Replication will fail. The solution: either change your diradmin password —and create an avalanche of permission troubles— or easier: temporarily disable your policies before relinking both servers.

Hiding the iTunes Music Store

Shortly after Apple released Apple Music last week plenty of people started posting various tutorials on improving the app’s interface. My favorites so far are:

Music.app

Usage

You can check which songs are downloaded and how much space they use on your iOS device by going to Settings > General > Usage > Manage Storage > Music.

Update For You

By going to Music > Profile icon top left > Choose Artist for you, you can run the Setup process again and select other or better genres and artists.

Change the icon of a Playlist

You can even change the icon of a playlist, replacing the 4×4 grid of album art with a custom photo by opening iTunes on the Mac and dragging a square image on top of the current image. iTunes will even change the header color to match your custom art.

iTunes Store

Cool tweaks, but they only apply to the Music app. What about the iTunes Store? Now that streaming is native on iOS, and integrated into iTunes, I don’t have any use for the music part of the iTunes Store anymore.

Luckily, you can hide music in the app, and put the remaining parts front and center. Which, in my case, means turning the iTunes Store app into a dedicated Movie Store app.

Somehow it’s a shame Apple didn’t fully exploit Apple Music launch to strip the iTunes Store app on iOS into separate parts. If they can put the iBook Store into iBooks, surely they can put the iTunes movie store into Movies.app? Maybe that’s something they’ll do once the Apple TV and video platform are relaunched?

How to hide music in the iTunes Store

  • Open the iTunes Store app
  • Click on the More-ellipsis icon in the toolbar
  • Press Edit top right
  • Drag any of the remaining icons on the Music icon (I picked purchases)
  • Rearrange the toolbar if needed
  • Press Done.

Moving from Spotify to Apple Music

The easiest way to move your Music from Spotify to Apple Music is by downloading and installing the Stamp Music app. This app copies every song and playlist in your Spotify library over to your Apple Music library. Free to try, small in-app purchase if you want to migrate all your data.

How to move your music

  1. Install the Stamp Music app.
  2. Login to Spotify within the app
  3. Choose Apple Music as the destination. The app will ask you for access to your Apple Music Library. Click Allow.
  4. Select the playlist or playlists you want to copy from Spotify to Apple Music
  5. Wait. This could take while depending on the size of your collection.
  6. Enjoy your Music.

Not an Apple Music subscriber yet? Support this blog by clicking this link and start a trial/subscribe.

Remove TestFlight Beta’s

Last year Apple released TestFlight, their in-house beta testing platform that allows Developers to easily distribute beta’s to testers. Throughout the year I tried (and bug reported!) a lot of apps this way, and I collected a nice set of (mostly expired) beta’s.

The months after WWDC are traditionally a beta season, when not only iOS, but also plenty of third party developers, are trying out new things, and bug-fixing their apps to become compatible with the new API changes.

Since most of the TestFlight Apps in my list are currently Expired, and a couple of developers are moving their last iPad only apps to a Universal model, my TestFlight contains a lot of stuff that will probably never be updated.

It’s easy to clear the list though: just swipe to the left on the app, select Unsubscribe, confirm and the app is gone from your list. Extra benefit for the developer: they gain 1 slot in their list of 1000. (Or is it 2000 now?)

Rock Werchter with an Apple Watch

Next week I’ll be enjoying four days of music at Rock Werchter. I love festivals and enjoy both listening to bands I already know (come on Dave Grohl, heal your leg!), and discovering new bands.
Werchter is one of Belgian’s biggest festival and it has multiple stages with bands playing at overlapping times. A few years ago I used to carry a paper program around the park, upgraded to a screenshot of the program on my iPhone’s homescreen a few years later, but this year I thought: why not use my Apple Watch?

Checking when the next band comes up takes only a glance, I’m far less likely to lose my Watch than my iPhone in a crowd (moshpits) and — when it comes to easily glanceable information — the Watch is king.

I decided that, until native apps are available in September, the easiest approach at this moment would be the creation of a separate calendar in iCloud which contains all the performances as events. I can add that calendar as a glance to the Apple Watch (I’ll probably use the Modular watchface) and voila, a Festival schedule on my wrist.

The festival’s website only offers an overview and no downloadable .ics-file, so getting the program on the Watch required some scripting I copied the schedule to Drafts, used a bit of Javacript to prepend each line with a date, and append a location (the stage name) followed by /w to point it to a new Werchter calendar I created in advance.

I ended up with a long list of performances:

  • 25/06 14:00 – 14:50 Marmozets at Main Stage /w
  • 25/06 15:30 – 16:30 Eagles of Death Metal at Main Stage /w
  • 25/06 17:15 – 18:15 Rise Against at Main Stage /w
  • 25/06 19:00 – 20:00 Florence + the Machine at Main Stage /w
  • 25/06 21:00 – 23:30 Foo Fighters at Main Stage /w

Up next: getting this list, which is formatted in a parseable string, into Fantastical. I used this Drafts‘s Action to batch import all the events. After seeing my iPad quickly flipping back and forth between Drafts and Fantastical for a few minutes, everything calmed down and I ended up with a nice overview of all the performances in my Agenda.

So next week while ordering a fresh pint and listening to some awesome band, I can quickly glance at my Watch and see if I how long they’ve got left, and if there’s still time to play that one hit song they didn’t play yet.

After finishing this small project I realised that watchOS 1 only shows the current event on the watchface. If I easily want to see upcoming bands, I either need to open the Calendar or Fantastical app each time.. or install watchOS 2 and use the awesome Time Travel feature. It’s tempting..

Background saving to Dropbox from iOS

Last week Dropbox released a new API endpoint that allows to lazily download files to your Dropbox folder without you needing to wait until the file is uploaded.

We’ve recently introduced a new feature to the Dropbox API: /save_url. This new endpoint lets app developers upload files to Dropbox by just providing a URL, without having to download the file first. – Dropbox Developer Blog

My first thought when I read this was: this is useful on iOS.

An example: I wanted to download Gruber’s Phil Schiller interview to my Dropbox for archiving while browsing on my iPad. Vimeo has a download option on their website, but due to restrictions in iOS this means: download the file in Safari first, wait for it to download completely (5GB!!), and then upload that same file via the Dropbox Extension hoping the thing doesn’t timeout or run out of RAM. In short, doing this is quasi impossible on iOS. and doing this over 3G is just insane, you’ll run out of data before the video has even downloaded completely.

Using the API

To solve this issue and using the new API I came across the following idea: what if I could somehow copy the link of a large file I want to download on iOS and pass it to a service that would trigger a download on Dropbox’s servers without any further user interaction.

This is what I came up with:
I hosted a file on my webserver that uses PHP to CURL a POST string to Dropbox’s servers. I surf to that webpage with a link that contains two parameters: $download_link and $token.

I then created a Workflow action that stores your Dropbox API token as a variable (local on device for security reasons), and captures a link in the clipboard, HTTP encodes it, and stores it as a second variable. The Workflow then generates an url that passes these two strings to my custom webpage, which than submits that data to Dropbox. A few moments later the file appears in your Dropbox folder.

The Webpage

I hosted the following code on my webhost:

  1. Parse http://domain.com?link=(link you want to download)&token=(your Dropbox API token)
  2. Uses the last part of the download link ($end) as a filename.
  3. It tells Dropbox to save the file to /Inbox

<?php
//Parse URL
$download_link = $_GET[‘link’];
$access_token = $_GET[‘token’];

//Set POST variables
$end = end((explode(‘/’, $download_link)));
$url = “https://api.dropbox.com/1/save_url/auto/Inbox/”.$end;
$data = array(‘url’ => $download_link);
$headers = array(‘Authorization: Bearer ‘ . $access_token);

//Open connection
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $data);

//Execute post and close connection.
$result = curl_exec($ch);
curl_close($ch);
?>

Dropbox Token

You can get a temporary Dropbox token by following the steps described on this Dropbox page. It’s a temporary token for personal use only (it maps to your Dropbox), but for this project it serves its purpose.

Testing with a generated access token
If you’d like to test out the Dropbox APIs quickly using your own Dropbox account, you can generate an access token from your newly created app in the App Console by pressing the button that says “Generate” in the OAuth 2 section of your app settings page. Keep in mind that this is only for your own account and you’ll need to use the standard OAuth flow to obtain access tokens for other users.

Screenshot 2015-06-13 14.38.47

Workflow

Since I want to use this script to send very large files from iOS to Dropbox without needing to download the files first, I needed an easy way to generate the correct link and open it in Safari. Which means: Workflow!

The workflow works as follows:

  • First I created a text-field that stores my Dropbox token, and I save it as a variable Token.
  • Then I get the clipboard from my device and HTTP Encode it so I can use it as a parameter value in the link I need to generate.
  • Finally I generate the complete link http://domain.com?link=(link you want to download)&token=(your Dropbox API token).
  • And I open the link in Safari which shows you status message.

The Result

Combining it all together gives me a workflow like this:

  • Go to a webpage and copy a download link to a large file. (A 950MB WWDC movie in this case)
  • Open Workflow and open the select the script.
  • Safari will immediately open with a {pending} message, this means it’s uploading. You can close Safari and do something else.
  • A few moments later the file shows up in Dropbox. (took around 5 minutes)

In conclusion

This workflow will save me a lot of time but there are a few things I would love to improve. Currently this process needs access to a custom webpage to run the Curl command. It would be better if I could just call Curl POST from within Workflow or by triggering another app via an URL- scheme.

Secondly the webpage currently shows the first response you get after doing the POST command, which is a {{pending}} message. It’s a rather ugly result. There are some API calls to ask for the status until you get an {{uploaded}} message, but doing this would make the workflow a lot more complex.

And finally I’d like to expand the workflow so it searches for downloadable links on a webpage, offers them in a list so you can pick one and upload it without needing to manually copy the download link.