Hi all,
I just migrated from the iTunes integration to the forked-daapd integration and I feel that forked-daapd isn’t getting the recognition it deserves for how great it is, so I thought I’d share my experience. My only regret is not moving from iTunes to forked-daapd years ago.
What?
So, for those who don’t know about forked-daapd, I will give a brief summary. Basically forked-daapd is a media player that emulates iTunes, meaning you can use all your existing iTunes and iTunes remotes to control music. They will all see it as a normal iTunes server. What makes it special is first, how well it does this (more on this in a second), and secondly, the things it adds on to it, like spotify and last-fm integration and ability to cast to other devices like chromecast audio devices.
Why?
So, what was it about iTunes and the iTunes integration in hass that finally made me decide to ditch it for forked-daapd? Many things:
- First, the latest version of iTunes had been giving me all sorts of problems with iTunes deciding not to connect to speakers, stop playing shortly after starting to play, not wanting to work if I made commands too close together, etc. In desperation, I made a whole appdaemon app just to manage all these constraints and continually retry playing the playlist until it worked properly. Sometimes this would take up to 30 seconds. This, of course, pissed me off.
- Second, the server the hass iTunes component uses is no longer maintained. This means that sooner or later it will stop working… We have just been fortunate that daap doesn’t progress as a protocol.
- Third, as mentioned before, forked-daapd can do lots of things that iTunes can’t, like stream to chromecast, scroble to last.fm, and play music from spotify to airplay or chromecast endpoints. It’s also very extensible, so you can add on other stuff which I probably don’t even know about yet.
- Fourth, forked-daapd is a drop in replacement for iTunes. It really surprised me how well it worked. I literally was able just to drop my iTunes library into a folder it could access, change a few items in the config and clean up the folder a bit, and start it up. All of my playlists (I have 40+ smart playlists and another 20+ normal ones) just showed up ready to work. It also sucked in all my airplay and chromecast devices with no manual configuration from my part, and they were all available from the first startup to stream to.
- But the big one for me is what I learned after I installed it. It just works way better than iTunes does. To be honest, I was shocked by how much better some FOSS software works with Apple’s ecosystem than Apple’s own software does. The difference was like night and day, and I started to suspect that Apple was putting bugs into iTunes to force people to move to Apple Music due to how stark the difference was. Let me list a few of these things:
- Choosing airplay speakers is nearly instant and never fails. With iTunes, I had some speakers which would fail most of the time, and the other ones would take many seconds to activate. If I tried playing a playlist before they had changed, it would fail with errors. This doesn’t happen with forked-daapd. It’s been 100% reliable so far.
- The media player doesn’t just stop playing for whatever reason after you ask it to play like iTunes was doing to me. Forked-daapd “just works” ;-).
- Unlike the iTunes integration, forked-daapd will expose all your playlists as sources, meaning that a card like mini-media-player will show them all in a drop down list for you. With the iTunes integration, I had to manually program all of my 60+ playlists into a list which was a hassle.
- Shuffle capability works out of the box, so you don’t have to do hacks like I did with the iTunes integration to make it work.
- You don’t have to manually start iTunes and itunes-api server every time you start up your mac and keep your mac running all the time to access your music. You can turn off your computer and access your music from homeassistant.
So, long story short, I have no regrets moving away from the iTunes integration.
How?
So, how do you do this? Well we are very fortunate that it became a lot easier since forked-daapd was integrated into homeassistant core as a standard integration, and we got the hass.io addon. I will try to give a mini guide from memory below:
- In your homeassistant UI, go to supervisor->addon store->… menu->repositories and in the bottom line, paste in https://github.com/Ulrar/hassio-addons and click add
- Close that dialog and go back to add-on store and search for forked-daapd and install it.
- I recommend you check if there’s anything you want to change in the config file found at share/forked-daapd/forked-daapd.conf. Note that all the confguration happens there, there is nothing you can change from the addon config panel in supervisor. Here’s what I changed in order to make it work with my iTunes library’s smart playlists:
itunes_overrides = true
itunes_smartpl = true
I also changed the name of the library to something friendly and got commented out the podcasts, audiobooks, and compilations sections because I didn’t plan to use them. I think I also changed
rating_updates = false
Because I have rated most of my songs already by hand.
And I added my subnet to
trusted_networks = { "any", "192.168", "fd" }
Because the iTunes remotes wouldn’t properly connect otherwise…
Check all the options, because there might be some that apply to your circumstance.
- Import your music library to the folder defined at:
directories = { "/share/forked-daapd/music" }
Protip: When importing your iTunes library, you will want the folder to look like this:
drwxr-xr-x 12 root root 4096 Dec 27 01:05 'Album Artwork'
prw-r--r-- 1 root root 0 Dec 27 01:05 HomeAssistantAnnounce
drwxr-xr-x 4 root root 4096 Dec 27 01:05 'iPod Games'
-rwxr-xr-x 1 root root 771711 Dec 27 01:05 'iTunes Library-bak.itl'
-rwxr-xr-x 1 root root 983040 Dec 27 01:05 'iTunes Library Extras.itdb'
-rwxr-xr-x 1 root root 210706432 Dec 27 01:05 'iTunes Library Genius.itdb'
-rwxr-xr-x 1 root root 10894005 Dec 27 01:05 'iTunes Library.itl'
-rwxr-xr-x 1 root root 33386446 Dec 27 01:05 'iTunes Library.xml'
drwxr-xr-x 18 root root 4096 Dec 27 01:29 'iTunes Music'
drwxr-xr-x 3 root root 4096 Dec 27 01:29 'Mobile Applications'
drwxr-xr-x 2 root root 4096 Dec 27 01:29 'Previous iTunes Libraries'
-rwxr-xr-x 1 root root 8 Dec 27 01:29 sentinel
Now, many of these folders I’m sure are superfluous and can be deleted. The reason I’m showing you this folder is because it was nested within other iTunes folders which forked-daapd would not import. So you need to get to the folder that has the “iTunes Music” folder in it and place that in the path shown in the config file. Within the “iTunes Music” folder, there should be another folder called just “Music” that contains the actual folders with your music (If you told iTunes to keep your music library organized. If you didn’t do that, I’m not sure what yours would look like, but if you want to make it easy, tell iTunes to keep your music library organized and it should look like mine.
Protip 2: If you find any other .xml files in this folder other than “'iTunes Library.xml”, you will need to get rid of them, or you will likely have duplicate playlists like I did. I had another similar file that was like 6 years old. I deleted it and the duplicate playlists disappeared on the next restart.
Optional extras:
Now, in my case I just copied everything over from iTunes into here, but left iTunes as it was. I’m 30 years into collecting music so the pace of change is pretty small compared to what I’ve already ammassed, so for me it’s enough to just copy it over once a year, the changes are like pissing in a river and hardly noticed. There are some other ways to approach this, and I will link to some guides that explain this:
Option A: You could map your music folder from your mac onto a drive and use forked-daapd to access it from there, that way if you update your music library on the mac, forked-daapd will just pick it up This guide is a bit old and the homeassistant side is outdated since the official integration came, but it still gives you an idea how to do this The hass.io addon and hass.io’s inability to allow you to map network drives would make this rather difficult to do with hass.io. Also, getting hass.io addons to navigate to devices outside of your local disk is difficult so you probably won’t be able to do it with the addon as I described. You’d have to do it in a similar way shown in the video (just ignore the homeassistant integration method he does).
Option B: You could actually make forked-daapd your only music library and point iTunes to it so that it uses it as it’s own libary. This guide explains that process. This sort of does the same thing as the first option above, but instead of having forked-daapd get it’s music from the mac, the mac get’s it’s music from your forked-daapd server. This is a bit too bold for me, I prefer just to keep 2 copies in case something goes wrong… But I’m sure it probably works just fine.
- Now that you’ve hopefully got everything setup right, you should with any luck be able to start up the addon by going to supervisor->dashboard->forked DAAPD->start
- At this point you should be able to access the forked-daapd UI at the address of your home assistant server, port 3689 like this:
http://192.168.1.120:3689
as an example. In my case I wasn’t able to access the UI via the supervisor UI button, but this works okay for me. - Check to see if you’ve got music in the playlists (box with note icon) and artists and songs in the music tab (2 notes icon). If so, you’re good to go. It does take a while to start, so be patient or go watch the log for the addon in supervisor until it’s done scanning your library. Try playing a few songs to various speakers and see if it all works.
- Now you can go to settings and change anything you want, such as to hide some of the buttons you don’t use (like podcasts in my case), connect to last.fm for scrobling or spotify to stream from spotify (you will need a paid subscription for this though). If you need to pair an iTunes remote, you can do that from the remotes section. I also noticed that not all my artwork made it over from iTunes, so I enabled the artwork sources from the Artwork tab and then all the missing artwork got sucked in automatically.
- Once everything is working on the forked-daapd side, you can go add the integration in homeassistant at configuration->integration->+ add integration->forked-daapd. This should create a media player for your library and one for each of the airplay or chromecast destinations that you have in your house, and even one for the server running forked-daapd so that you can play to speakers connected to that if you want.
- Now you should see the forked-daapd box in the integrations and hopefully you can see that there’s a link to the entities it created. In this list you should see one that has the word “server” at the end. That’s the one you will need to control to send the music to the other media players.
- You can use my mini-media-player card as an example of how to set up your card. You will of course have to install the custom card mini-media-player first. mini-media-player is nice because it will put all your playlists as a drop down list which you can choose from. Optionally you can add buttons which go directly to your favorite playlists as I did in my example here
Now you should be rocking and rolling with forked-daapd. I hope you enjoy it as much as I do!
What else?
Well, through the process I came up with a few minor things that I will mention in a wishlist in case any of the devs swing by.
- I wish the icons for my speakers would show up as speaker icons that show as muted when the speakers are deactivated:
Instead of as video endpoints which do not change when muted (all of my speakers except one chromecast are airtunes audio endpoints, so they should really show as speakers instead of video cast endpoints):
- Would be nice if the player would continue playing when a new playlist was chosen. With iTunes, it would just keep playing but the new playlist would start. With forked-daapd the player stops when you choose a playlist and you have to start it again. I also preferred how iTunes would start playing if it wasn’t already playing when you press the playlist button. Forked daapd chooses the playlist but doesn’t start playing.
- I realize this is more an issue with hass.io addons in general, but it would be nice if there were some way to access music libraries on external disks, over SMB shares, etc. rather than having to copy it into the share directory. I wanted to use an external disk but couldn’t get it to work. It looks like I will have to make a special partition on the disk and mount that partition as my share folder to make this work. I can do it but it’s a hassle. SMB would be even worse.
- Having all the music and playlists show up in my media browser would be really a lovely addition :-).
But these are minor things. I’m really over the moon overall with how this solved all the problems I was having with iTunes and it’s integration. Now my music is always online and responds instantly and reliably to my requests. Haven’t had any failures so far. Thanks to the maintainers of the integration and the addon, this became a much easier process thanks to you! Hopefully this little guide makes it even easier for people to access.
Enjoy the music!