jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Sat Sep 28, 2013 11:48 am

Sounds great. What is your actual sound source here? I can see you're putting a stream into sound.mp3, and using Remote to play this out to multiple AirPlay speakers but what's the actual original audio from?

What I was originally talking about was sending audio from an app on the iPhone (eg spotify, shoutcast etc) to a Pi-equivalent of [airfoil speakers->airfoil] which then would play to multiple airplay speakers from the Pi. In order to control outputs and volumes this would need some kind of remote interface to the Pi app.

What you're doing sounds different, it sound like you're using the Pi daapd so that you can control from the Remote app, but in doing so I'm assuming your source audio can't be coming from the iPhone as well?

MrRaf1k1
Posts: 4
Joined: Sat Sep 28, 2013 6:41 am

Re: Improved forked-daapd (iTunes server)

Sat Sep 28, 2013 12:07 pm

jmp909 wrote:Sounds great. What is your actual sound source here? I can see you're putting a stream into sound.mp3, and using Remote to play this out to multiple AirPlay speakers but what's the actual original audio from?

What I was originally talking about was sending audio from an app on the iPhone (eg spotify, shoutcast etc) to a Pi-equivalent of [airfoil speakers->airfoil] which then would play to multiple airplay speakers from the Pi. In order to control outputs and volumes this would need some kind of remote interface to the Pi app.

What you're doing sounds different, it sound like you're using the Pi daapd so that you can control from the Remote app, but in doing so I'm assuming your source audio can't be coming from the iPhone as well?
No, this is exactly the output of the configuration I've done.

In detail:
I run spotify on my iPhone --> choose as Airplay destination AirPi2 (in spotify app) --> Pi receives Airplay --> shairport converts this in raw --> vlc converts this in mp3 --> forked-daapd picks this mp3 and it can be found in remote-app

Now you can control the output and volumes via remote-app from iPhone. I tested this with local connected active speakers and two airplay receivers at the same time (source was iPhone with spotify app).

This isn't starting automatically at the moment you have to choose always the sound.mp3 file in remote-app and the destinations manually.

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

Re: Improved forked-daapd (iTunes server)

Sat Sep 28, 2013 12:28 pm

Cool, you got that working really quickly!

The Remote app controls forked-daapd with the dacp protocol, which is really just the App making some http GET-requests to the server on port 3689 (I think...). So you can probably automate starting playback in a script by using curl and emulating the Remote App. You would need to find the appropriate requests. If you set the forked-daapd loglevel to debug and grep the log for "DAAP request", you should see what they are.

The real iTunes has some authentication stuff which might be difficult to emulate, but that shouldn't give you any trouble with forked-daapd.

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Sat Sep 28, 2013 12:49 pm

Ah I hadn't expected you could do that! That's great, will have to try later

J

MrRaf1k1
Posts: 4
Joined: Sat Sep 28, 2013 6:41 am

Re: Improved forked-daapd (iTunes server)

Sun Sep 29, 2013 11:06 am

ejurgensen wrote:Cool, you got that working really quickly!

The Remote app controls forked-daapd with the dacp protocol, which is really just the App making some http GET-requests to the server on port 3689 (I think...). So you can probably automate starting playback in a script by using curl and emulating the Remote App. You would need to find the appropriate requests. If you set the forked-daapd loglevel to debug and grep the log for "DAAP request", you should see what they are.

The real iTunes has some authentication stuff which might be difficult to emulate, but that shouldn't give you any trouble with forked-daapd.
No, this is not possible. I get back "401 authorization required". I traced the the dacp-packets between iPhone and PI and cannot find any authorization information. It is to much work and maybe not possible for me to reverse engineer daap for creating an emulator so I stuck on this point and give up.

I created a startup script and everything is working as expected. I will have to live with starting of playback manually.

Nevertheless thank you for your quick and helpful information on this. Keep on your good work.

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

Re: Improved forked-daapd (iTunes server)

Sun Sep 29, 2013 5:04 pm

EDIT: This won't work because you cannot be sure session id 100 is always available

You can try this sequence:

Code: Select all

curl "http://localhost:3689/login?pairing-guid=0x1"
curl "http://localhost:3689/ctrl-int/1/playspec?database-spec='dmap.persistentid:0x1'&container-spec='dmap.persistentid:[PLAYLISTID_HEX]'&container-item-spec='dmap.containeritemid:[ITEMID_HEX]'&session-id=100"
The login makes sure that session-id 100 is valid.

You've got to find playlistid and itemid of your sound.mp3, and then convert them to hex. One way of finding the id's:

Code: Select all

sqlite3 /var/cache/forked-daapd/songs3.db
select id,title from playlists;
select id,fname from files where data_kind=1;
.quit
First one should give you playlistid, second one itemid.

Here's an example that worked for me:
curl "http://localhost:3689/ctrl-int/1/playsp ... ion-id=100"
Last edited by ejurgensen on Tue Apr 01, 2014 8:58 pm, edited 1 time in total.

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Sat Oct 05, 2013 12:51 am

hi ejurgensen. i tried build 19 tonight, seems to work much better i think. just one thing though it doesnt allow Remote to see my AppleTV as an Airplay destination.. the log file says Airtunes [email protected]: no pw field in TXT record!

are you able to resolve this at all? i know you fixed the other issue with an exception for the "am" field.

thanks
J

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

Re: Improved forked-daapd (iTunes server)

Sat Oct 05, 2013 4:16 pm

I'll see if I can fix it, but as my own ATV 2 is working I'll need some info about yours. Can you give me the result of this command:

avahi-browse -r _raop._tcp

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Thu Oct 10, 2013 7:23 pm

hi,

here's the output

thanks
j

Code: Select all

+   eth0 IPv4 [email protected]'s AirPort Express              AirTunes Remote Audio local

+   eth0 IPv4 [email protected]'s Pioneer Speaker              AirTunes Remote Audio local

+   eth0 IPv4 [email protected] TV                         AirTunes Remote Audio local

+   eth0 IPv4 [email protected]'s Bedroom AirPort Express      AirTunes Remote Audio local


=   eth0 IPv4 [email protected]'s AirPort Express              AirTunes Remote Audio local
     hostname = [Js-AirPort-Express.local]
     address = [169.254.125.126]
     port = [5000]
     txt = ["sf=0x4" "fv=76400.10" "am=AirPort4,107" "vs=105.1" "tp=TCP,UDP" "vn=65537" "pw=false" "ss=16" "sr=44100" "da=true" "sv=false" "et=0,1" "ek=1" "cn=0,1" "ch=2" "txtvers=1"]

=   eth0 IPv4 [email protected]'s Pioneer Speaker              AirTunes Remote Audio local
     hostname = [Js-Pioneer-Speaker.local]
     address = [192.168.0.19]
     port = [1024]
     txt = ["fv=s1010.1000.0" "am=XW-SMA1" "vs=103.2" "tp=UDP" "vn=65537" "pw=false" "ss=16" "sr=44100" "da=true" "sv=false" "et=0,4" "cn=0,1" "ch=2" "txtvers=1"]


=   eth0 IPv4 [email protected] TV                         AirTunes Remote Audio local
     hostname = [Apple-TV.local]
     address = [192.168.0.7]
     port = [5000]
     txt = ["vv=2" "vs=190.9" "vn=65537" "tp=UDP" "sf=0x44" "pk=7aeca792cf2433078a7aec27792aac6b376be471db31ae5159a2aa377dab47ab" "am=AppleTV3,1" "md=0,1,2" "ft=0x5A7FFFF7,0xE" "et=0,3,5" "da=true" "cn=0,1,2,3"]


=   eth0 IPv4 [email protected]'s Bedroom AirPort Express      AirTunes Remote Audio local
     hostname = [Js-Bedroom-AirPort-Express.local]
     address = [169.254.156.26]
     port = [5000]
     txt = ["sf=0x5" "fv=76400.10" "am=AirPort10,115" "vs=105.1" "tp=TCP,UDP" "vn=65537" "pw=false" "ss=16" "sr=44100" "da=true" "sv=false" "et=0,4" "cn=0,1" "ch=2" "txtvers=1"]
[/size]

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

Re: Improved forked-daapd (iTunes server)

Thu Oct 10, 2013 8:33 pm

This is the interesting part:
txt = ["vv=2" "vs=190.9" "vn=65537" "tp=UDP" "sf=0x44" "pk=7aeca792cf2433078a7aec27792aac6b376be471db31ae5159a2aa377dab47ab" "am=AppleTV3,1" "md=0,1,2" "ft=0x5A7FFFF7,0xE" "et=0,3,5" "da=true" "cn=0,1,2,3"]

Which is quite different from my Apple TV 2:
txt = ["sf=0x4" "am=AppleTV2,1" "vs=105.5" "md=0,1,2" "tp=TCP,UDP" "vn=65537" "pw=false" "ss=16" "sr=44100" "da=true" "sv=false" "et=0,3" "cn=0,1" "ch=2" "txtvers=1"]

I find it kind of amusing that they weren't even able to maintain compatibility in their versioning scheme (apparently going from txtvers -> vv).

Maybe solving the problem is as easy as patching forked-daapd to assume no password if the pw field is missing, so that's what I've done. Can you test it? You can grab it here: http://www.gyfgafguf.dk/temp/forked-daa ... _armhf.deb (just for testing! will be deleted later).

If this doesn't work I'll need to research the ATV3 some more, and maybe try to get my hands on one for testing.

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Thu Oct 10, 2013 9:05 pm

it sees the AppleTV but.. won't play

Code: Select all

raop: Failed to retrieve artwork for.......
raop: ANNOUNCE request failed in session startup: 406 Not Acceptable
player: cannot start playback: no output started
dacp: could not start playback
also

Code: Select all

xcode: Custom get_buffer - not allowed by ffmpeg/libav!
raop: ANNOUNCE request failed in session startup: 406 Not Acceptable
dacp: Speakers de/activation failed
i need to check something though as my AppleTV is currently proxied through plexconnect running on my pc (acting as a DNS router for plex app). i'll disable that and see if that changes anything

thanks

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Thu Oct 10, 2013 9:09 pm

ignore that DNS thing makes no difference. AppleTV running normally now.. same problem

"406 Not Acceptable" when trying to activate the AppleTV output.

it's streaming to my Pioneer Airplay speaker fine though.

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Thu Oct 10, 2013 9:14 pm

out of interest.

if i set directories = "/media/IOMEGA_2TB/iTunes/iTunes\ Media"

should it pick up the files from "Music" *and* "Podcasts" etc folders, or do i need to define the 2 separately in the "directories" object?

also how do i refresh the library? delete the sqlite db and restart? is there no other way to force it?

thanks

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

Re: Improved forked-daapd (iTunes server)

Thu Oct 10, 2013 9:24 pm

Ok, looks like the ATV refuses the connection. I'll need to research some more then.

Yes, all subfolders should be scanned, so your config should be ok with just a single directory entry. Does it not work?

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

Re: Improved forked-daapd (iTunes server)

Thu Oct 10, 2013 9:28 pm

And you can refresh just by restarting forked-daapd, then everything will be rescanned (except playlist files).

edit: on second thought maybe this is wrong. I'll look into it.

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Thu Oct 10, 2013 9:33 pm

hmm Airfoil isnt connecting from my PC either. wonder if something broke with the latest AppleTV update?

actually they fixed it but looks like there was originally an issue
http://weblog.rogueamoeba.com/2013/09/2 ... rsion-6-0/

same error..406

the pandora guys worked out the fix apparently
http://weblog.rogueamoeba.com/2013/09/2 ... atibility/

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Thu Oct 10, 2013 9:48 pm

think it was only picking up one subfolder (Podcasts). i'll delete db and re-pair devices again and see if it refreshes the database

ps as a suggestion it would be good if the "Podcasts" menu in "Remote" could pick up the "Podcasts" folder but i dont know how that's linked up.

The entries are Audiobooks, Composers, Films, Genres, iTunesU, Music Videos, Podcasts, Rentals, Songs, TV Programmes
(its in the "more..." menu aside from the main menu with Playlists, Artists, Search, Albums)

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

Re: Improved forked-daapd (iTunes server)

Fri Oct 11, 2013 9:42 am

Good find on the AirFoil forum! It must be the ATV3 upgrade which is the culprit. I'll write the AirFoil-guys and hopefully they will share the fix.

Another way of forcing a rescan would be to temporarily rename your library folder. When you do that all your music will disappear to forked-daapd, and when you restart the server every entry in the database should be deleted. Afterwards you rename to the original name, and then forked-daapd should do a complete rescan.

I guess there must be some error since your music folder wasn't scanned (permissions perhaps?). Did you find anything in the logs?

I'll put better Podcast handling on my todo list!
Last edited by ejurgensen on Wed Oct 16, 2013 9:37 am, edited 1 time in total.

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Fri Oct 11, 2013 11:30 am

Hi,

i think it's scanned both folders as mentioned now. Hope you can get the ATV3 issue sorted with Jason!

thanks
J

jpbaril
Posts: 13
Joined: Fri Mar 29, 2013 7:20 pm

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 12:47 am

I have a problem since last week.
When trying to connect to Forked-Daapd my client players get time out and are not able to retrieve the songs list.
I tried with iTunes 10.4 on Mac and also two Android apps.

First I was on forked-daapd_0.19.9 and tried to update to forked-daapd_0.19.14 but that did not change anything.

If I delete the DB and restart, then just after that I'm able to retrieve songs as they begin to get scanned.
But not long after that, the same thing happen, it times out.

One Android app, SharePlay, keeps a local cache of the last retrieved songs list, so even if iTunes is no more able to retrieve the list, I'm still able to start songs that are already in the SharePlay list of songs. Yet the list is short because as with iTunes, the app also times out if I try to retrieve a new and more updated list.

A few things happened last week, but I don't know what could have directly affected Forked-Daapd if anything.
First, the NAS to which connects my Raspberry Pi by NFS was offline at some point so the DB got emptied. Did it corrupt something in Forked-Daapd ?
Second, I added many songs to my NAS. Maybe some files create trouble for Forked-Daapd.
Third, my Raspberry runs RASBMC which got updated. Could that have affected Forked-Daapd in some way?

I put Forked-Daapd logs to debug level but by looking at these I could not spot something that looked flagrantly abnormal.

Does someone have an idea of what could cause my problems?

Thank you

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 5:21 pm

MrRaf1k1 wrote: 2. starting a new vlc instance with http-output
$ /usr/bin/vlc -v -I rc --rc-host localhost:7070 --demux=rawaud --rawaud-channels 2 --rawaud-samplerate 44100 /tmp/airpi --sout '#gather:transcode{acodec=mpga,ab=128,channels=2,samplerate=44100}:http{mux=dummy,dst=:8080/sound.mp3}' --sout-keep --repeat &
hi i think maybe because i'm running berryboot i get an error about not being able to find the plugins on /mnt/data/Debian_Wheezy........./usr/lib/vlc/plugins/plugins.dat

any idea how I might get vlc to see the path properly?

i tried linking with ln but that path that vlc sees doesnt seem to be visible by the operating system

thanks
j

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 6:31 pm

also i'm having trouble getting playlist items to show up.

if my media path is "/media/IOMEGA_2TB/iTunes/iTunes\ Media"

where should i put the sound.m3u file, and what should be in it please? i tried putting it in

/media/IOMEGA_2TB/iTunes/iTunes Media/M3U Playlists

with this content

Code: Select all

#EXTM3U
#EXTINF:-1, AirPi Stream
http://localhost:8080/sound/mp3
none of my iTunes playlist items are showing up either

thanks
j

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 7:36 pm

it's started picking the playlists up now...i didnt do anything though, just restarted... maybe it's been taking a while to cache the db and i've not left it running long enough

i've now got an AirPi Stream.m3u file containing

Code: Select all

#EXTM3U
#EXTINF:-1, AirPi Stream 1
http://localhost:8080/sound.mp3
Remote app sees the playlist, but says "no songs" inside it. maybe it's just slow to update the database?

thanks
j

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

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 7:41 pm

jmp909 wrote:where should i put the sound.m3u file, and what should be in it please? i tried putting it in

/media/IOMEGA_2TB/iTunes/iTunes Media/M3U Playlists

with this content

Code: Select all

#EXTM3U
#EXTINF:-1, AirPi Stream
http://localhost:8080/sound/mp3
You can put the m3u anywhere in your library, but you had a typo in your first m3u:

http://localhost:8080/sound/mp3

When forked-daapd scans the file it will use ffmpeg/libav to determine the encoding of the stream. If this fails the stream won't be added. So the typo means nothing gets added. Also, remember to have sound streaming when you add the m3u, so ffmpeg can detect the encoding. I think this might be why you now have an empty playlist.

If you set the log level to debug you should get a pretty verbose account of what is going on - and also what the scanner did when it scanned your playlist.

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 7:56 pm

ah thanks that's a typo here. my actual entry was sound.mp3 not sound/mp3

Return to “Raspbian”