bambataa
Posts: 5
Joined: Tue Sep 26, 2017 8:31 pm

Re: Improved forked-daapd (iTunes server)

Tue Sep 26, 2017 8:49 pm

Many thanks for all of your work on this. I have forked-daapd running on my Pi and I was surprised at how easy it was to set up. I had set aside an hour or two to get things going and it was all working in minutes!

When at home I can successfully see my iTunes library shared from the Pi to my laptop. My only problem is trying to access the library over the internet. My main interest in forked-daapd is being able to access my home iTunes library when out and about so that I can make playlists of tracks to DJ with when I get home. I suppose this is quite a lot of effort to go to but it's interesting too.

From work I am able to ssh into my Pi at home with port 3689 forwarded to 3690. I know it's working ok because I can log into the web admin interface at localhost:3690. However, iTunes on my work Macbook does not find the shared library.

From reading blogs it seems that iTunes needs to see the daapd service being broadcast locally and the following command was recommended:

Code: Select all

dns-sd -P iTunesServer _daap._tcp local 3690 localhost.local 127.0.0.1 &
The command appears to run successfully but doesn't seem to have any effect on iTunes (still can't see the library). I tried running Wireshark and looking for daap packets but there were none. The only thing I can think of is that I need to have port 5353 open on my router for the UDP, so I have opened that this evening and will try again tomorrow when away from home. However, I'm not sure whether that's only needed for usage with remotes?

Is anyone able to shed some light on this? I know it's kind of beyond the forked-daapd remit but I feel like I'm so close to having the setup working as I'd like.

This is with macOS Sierra and iTunes 12.7

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Wed Sep 27, 2017 12:20 pm

I think you're on the right track, to make it show up in iTunes you need to make sure iTunes gets the mdns announcement.

I'm not an expert on mdns, but I'm not sure forwarding forked-daapd's announcement from the LAN will work, perhaps the source address and maybe also port would be wrong?

So you might need to make your own announcement with dns-sd, like you wrote. To match what forked-daapd announces it would need the following content: https://github.com/ejurgensen/forked-da ... ain.c#L253

bambataa
Posts: 5
Joined: Tue Sep 26, 2017 8:31 pm

Re: Improved forked-daapd (iTunes server)

Thu Sep 28, 2017 10:53 am

Thanks for the suggestions. I have found out the mDNS announcement that forked-daapd is making and will check tomorrow to see if mimicking it works. I'll post the commands in case it helps other people.

When using a laptop at home, forked-daapd is working well. However, I am not able to edit or create playlists in iTunes. I suspect that this is due to iTunes' weird way of storing playlists. I exported some from my home laptop to the Pi as .m3u files and they do appear, though missing all but a few songs for some reason. Right-clicking on a track in the shared library to add to a playlist doesn't do anything (doesn't add it to a local playlist on the laptop either). Do you think this is a limitation of iTunes or something I can work around? thanks again.

bambataa
Posts: 5
Joined: Tue Sep 26, 2017 8:31 pm

Re: Improved forked-daapd (iTunes server)

Fri Sep 29, 2017 1:27 pm

OK, mimicking the mDNS announcement works. Here are the steps:

Make sure forked-daapd is running on the Pi and that port 3689/TCP is forwarded on your router.
From a computer on your local network, check that you can see the shared library in iTunes. Then run:

Code: Select all

dns-sd -b _daap._tcp .
This will show you all the broadcasting daap services on your network. You should see one with an instance name that matches the name of your shared library. Then run:

Code: Select all

dns-sd -L "Instance Name" _daap._tcp.
Swap 'Instance Name' for your own instance name but keep the double quotes. It should spit out a series of key-value pairs. These are the details that forked-daapd is broadcasting on your local network. Make a note of them.

When you are away from home and want to remotely connect to forked-daapd, first forward port 3689 from the computer you're using to the Pi:

Code: Select all

ssh [email protected] -L 3689:127.0.0.1:3689
forked-daapd is now accessible on port 3689 on your computer but iTunes won't recognise it. We need to mimic the mDNS announcement that forked-daapd is making on your local network. In a separate terminal on your computer, run:

Code: Select all

dns-sd -P iTunesServer _daap._tcp local 3689 localhost.local 127.0.0.1 [key value pairs]
Replace [key value pairs] with the output you noted above, removing the square brackets. Your shared library should now appear in iTunes (try enabling Home Sharing if not).

This is just the way I did it. It is probably possible to determine the mDNS announcement from the Pi itself so that you can do everything without having to have access to a computer on the local network. I just happened to be at home when doing this.

ejurgensen: would you accept a PR including this somewhere in the README or gitbook, or is it a bit too esoteric? I will probably write it up into a blogpost but thought it would be easier than hoping people find this through searching.

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Fri Sep 29, 2017 9:12 pm

That would be great, just keep it short and sweet. Could you experiment and find out what key-value pairs really need to be there, and if it is possible to just give a fixed recipe - i.e. dropping the steps where you grab the actual txt-string? That would make it more simple. As far as I can tell, most of the values are either fixed or random, so that makes it easy. It is only Machine ID and Database ID that are calculated, and perhaps that isn't strictly required?

bambataa
Posts: 5
Joined: Tue Sep 26, 2017 8:31 pm

Re: Improved forked-daapd (iTunes server)

Sat Sep 30, 2017 2:09 pm

Sure. I'll experiment on Monday.

skecher
Posts: 50
Joined: Sat Dec 19, 2015 9:59 pm

Re: Improved forked-daapd (iTunes server)

Sun Oct 01, 2017 4:10 am

Well, I don't get a valid OpenPGP key when I execute:

wget -q -O - http://www.gyfgafguf.dk/raspbian/forked-daapd.gpg | sudo apt-key add -

How can I get a valid key?
Linux and Raspberry Pi resources: http://caesarsamsi.wordpress.com

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sun Oct 01, 2017 7:45 am

What error do you get? I have just tested on Jessie and Stretch, and they seem to work. Don't know if the webserver might have been down?

skecher
Posts: 50
Joined: Sat Dec 19, 2015 9:59 pm

Re: Improved forked-daapd (iTunes server)

Sun Oct 01, 2017 4:13 pm

Just got it with Stretch. Probably a web server issue.
Linux and Raspberry Pi resources: http://caesarsamsi.wordpress.com

skecher
Posts: 50
Joined: Sat Dec 19, 2015 9:59 pm

Re: Improved forked-daapd (iTunes server)

Sun Oct 01, 2017 4:39 pm

.
Last edited by skecher on Sun Oct 01, 2017 10:52 pm, edited 1 time in total.
Linux and Raspberry Pi resources: http://caesarsamsi.wordpress.com

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sun Oct 01, 2017 6:31 pm

Please don't spam the forum with entire debug logs. Post the relevant part, or link to them externally.

User avatar
rpdom
Posts: 14992
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Improved forked-daapd (iTunes server)

Sun Oct 01, 2017 6:35 pm

ejurgensen wrote:
Sun Oct 01, 2017 6:31 pm
Please don't spam the forum with entire debug logs. Post the relevant part, or link to them externally.
Or at least put them in Code tags so they can be scrolled through.

skecher
Posts: 50
Joined: Sat Dec 19, 2015 9:59 pm

Re: Improved forked-daapd (iTunes server)

Sun Oct 01, 2017 10:50 pm

sorry about that. I'll try and remove
Linux and Raspberry Pi resources: http://caesarsamsi.wordpress.com

skecher
Posts: 50
Joined: Sat Dec 19, 2015 9:59 pm

Re: Improved forked-daapd (iTunes server)

Tue Oct 03, 2017 1:19 am

I gave up on Remote for iTunes by Hyperfine. That one's just not working period, with v 24.2 or 25.0

I found a really good alternative, best of all it's free!

It's called TunesRemote+ for Android. So far it runs well on my Samsung Galaxy S7.

Cheers, Caesar.
Linux and Raspberry Pi resources: http://caesarsamsi.wordpress.com

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Tue Oct 03, 2017 9:29 am

That's good to hear. In my experience Retune is also a very good remote for Android, and I think the developer tests it with forked-daapd.

I will look into what is going on with Hyperfine + mark limited support for it in the list.

skecher
Posts: 50
Joined: Sat Dec 19, 2015 9:59 pm

Re: Improved forked-daapd (iTunes server)

Tue Oct 03, 2017 1:22 pm

I tried retune but the UI was difficult on the eyes.
Linux and Raspberry Pi resources: http://caesarsamsi.wordpress.com

bambataa
Posts: 5
Joined: Tue Sep 26, 2017 8:31 pm

Re: Improved forked-daapd (iTunes server)

Fri Oct 06, 2017 2:40 pm

ejurgensen wrote:
Fri Sep 29, 2017 9:12 pm
That would be great, just keep it short and sweet. Could you experiment and find out what key-value pairs really need to be there, and if it is possible to just give a fixed recipe - i.e. dropping the steps where you grab the actual txt-string? That would make it more simple. As far as I can tell, most of the values are either fixed or random, so that makes it easy. It is only Machine ID and Database ID that are calculated, and perhaps that isn't strictly required?
It turns out that only 'ffid' is required. I'll do a PR for the README.

Steve_p
Posts: 1
Joined: Sat Oct 07, 2017 3:30 pm

Re: Improved forked-daapd (iTunes server)

Sat Oct 07, 2017 3:34 pm

Hi - seeking a little help...

v25 of forked-daapd installed and working on Stretch until I installed Homebridge, at which point it would no longer start. Have removed Homebridge and forked-daapd and reinstalled the latter only and still cannot get it running. journal -xe reports:

Oct 07 15:24:44 raspberrypi systemd[1]: forked-daapd.service: Start request repeated too quickly.
Oct 07 15:24:44 raspberrypi systemd[1]: Failed to start DAAP/DACP (iTunes) and MPD server, supporting AirPlay and Spotify.
-- Subject: Unit forked-daapd.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit forked-daapd.service has failed.
--
-- The result is failed.
Oct 07 15:24:44 raspberrypi systemd[1]: forked-daapd.service: Failed with result 'exit-code'.

Grateful for any pointers. Thanks

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sun Oct 08, 2017 6:06 am

Does it start if you do it manually, i.e. by running ''sudo /usr/sbin/forked-daapd -f'? If not what does it log?

skecher
Posts: 50
Joined: Sat Dec 19, 2015 9:59 pm

Re: Improved forked-daapd (iTunes server)

Sun Oct 29, 2017 9:22 pm

Is there a way to sort the Songs list? It currently sorts by Artist name, but it should be sorted by Song name.

Thanks, Caesar.
Linux and Raspberry Pi resources: http://caesarsamsi.wordpress.com

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sun Oct 29, 2017 9:36 pm

The client requests the sort order in the request to forked-daapd. In your case, the client is Hyperfine Remote and it is not requesting any sort order. I think that is a bug in Hyperfine. Apple Remote will for instance make this request when it asks for the song list:
/databases/1/containers/1/items?meta=dmap.itemname....daap.songdisabled&type=music&sort=name&include-sort-headers=1&query=('com.apple.itunes.extended-media-kind:1','com.apple.itunes.extended-media-kind:32')&session-id=123

You could consider raising it as an issue to Hyperfine. It should be an easy fix for them.

skecher
Posts: 50
Joined: Sat Dec 19, 2015 9:59 pm

Re: Improved forked-daapd (iTunes server)

Sun Oct 29, 2017 9:38 pm

OK Thanks! Hmm, couldn't you make sorting by song a default if nothing is requested?
Linux and Raspberry Pi resources: http://caesarsamsi.wordpress.com

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sun Oct 29, 2017 9:47 pm

Yes, but if I change the default from artist to song it might break another client. Basically, I can't know for sure how a client is planning on listing the results of a query.

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sun Oct 29, 2017 9:51 pm

I also notice that iTunes itself is returning in the same order as forked-daapd (artist order).

skecher
Posts: 50
Joined: Sat Dec 19, 2015 9:59 pm

Re: Improved forked-daapd (iTunes server)

Sun Oct 29, 2017 10:13 pm

One additional inbound firewall port is needed to enable speaker selection:

Oct 29 15:04:44 airplay kernel: [ 2553.289520] [UFW BLOCK] IN=wlan0 SRC=192.168.1.76 DST=192.168.1.4 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=5280 PROTO=UDP SPT=6002 DPT=58750 LEN=40

command: sudo ufw allow 58750

technically you only need to open UDP protocol, but heh ...
Linux and Raspberry Pi resources: http://caesarsamsi.wordpress.com

Return to “Raspbian”