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

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 7:59 pm

is there anyway to override the behaviour so that it doesnt have to determine the encoding during scanning (can it force from the .mp3 filename for instance). i think part of the problem may be that it seems to take a while to connect.... when i go to http://localhost:8080/sound.mp3 in my browser it takes 4-5 seconds for the "download file" dialog to appear, so maybe the forked-daapd scanner is timing out?

but like you say, i'm not sure i had a file streaming at the time.

the other issue with that scanning process in general i guess is that any offline radio streams wont get picked up by the playlist scanner (say someone doesnt run a stream 24 hours)

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

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 8:15 pm

also how do i kill a previous shairport/hairtunes instance.. i'm getting this error at the moment

Code: Select all

Can't listen on port 5012: Address already in use at ./shairpoirt.pl line 324, <DATA> line 23.
avahi daemon terminated or 'avahi-publish-service' binary not found at ./shairport.pl line 241, <DATA> line 23.
thanks
j

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

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 8:17 pm

I can't think of way you can override this. It's not just the mp3-format which is detected during scanning, it's also bitrate, channels and some more stuff. I suppose the code could be changed to wait with the determination of these till the user actually selects the stream.

But I would suggest you first make sure that the problem is not something else. What do the logs say? You can also try running one of these (depending on whether you have ffmpeg or libav):

ffprobe/avprobe http://localhost:8080/sound.mp3

This should tell you whether ffmpeg/libav is able to detect a stream.

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

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 8:36 pm

jpbaril wrote:When trying to connect to Forked-Daapd my client players get time out and are not able to retrieve the songs 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?
It's difficult to guess the cause of this, but I'd say number 2 would be the more likely candidate, since your library is quite large. To troubleshoot I would suggest the following:
- Make a smaller copy of your library, perhaps the same as it was before you ran into trouble (move the new music to a temporary folder outside your library). Does it now work?
- If you are familiar with SQL, you can do 'sqlite3 /var/cache/forked-daapd/songs3.db'. The database is pretty simple, your library is located in the table 'files' which you can inspect and look for errors.

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

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 8:47 pm

its not just that shairport stream tho. i have other playlists that just arent showing, and as mentioned I've only ever see the scanner pick them up once. normally it just says "No songs" when i select the playlist tab, but on this occasion my 4 playlists showed up

90s Music.m3u
Electronic_ Deep House.m3u
Electronic_ Deep Techno.m3u
Internet Songs.m3u

these were from iTunes originally.

log appears to say

"Database OK with 2157 files and 4 active playlists"

none show up in the Remote app though. i'm just removing "90s Music" for now because theres a lot in in it. the rest just have 2 or 3 internet radio streams.

if one of the streams was down in one of the m3u files, would that stop that whole m3u playlist item working? or just not show one of the streams in it.

i think you're right that really it needs to determine the stream type when the user selects it, and to begin with just list whats in the m3u, if that's possible.

also by the way from the one time i could get to my playlists, I noticed it doesnt pick up any info from EXTINF for the stream name it just shows

Code: Select all

100.189.192.49:8080 (or whatever)
unknown album - unknown artist
i dont know if that's expected behaviour or not.

thanks
j

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

Re: Improved forked-daapd (iTunes server)

Sun Oct 13, 2013 9:05 pm

i'll answer one of my questions there.

i tried it with a library that only contained my playlist files and no music

it'll pick up any items it can connect to per playlist, and not show any that are currently unreachable. so currently for instance it's showing 3 out of 5 of my "Internet Songs.m3u" playlist

i guess this is not ideal for internet streams that don't broadcast 24/7

that leaves a different issue as to why it's bombing out and not picking up my playlists in general when scanning a larger library. maybe it just didnt ever finish scanning. I'll see if i can do any other investigations from the logs

thanks
j

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

Re: Improved forked-daapd (iTunes server)

Mon Oct 14, 2013 2:41 am

turns out i wasn't being patient enough. my library was taking a long time to scan and wasn't getting to the playlists. they are there now and i can add new items.

be good if we had the option to show the stream name defined in EXTINF as the replacement for "Unknown Album - Unknown Artist" that shows under the stream URL

basically what i currently see in remote is

5.135.182.168:8014
Unknown album - Unknown artist


what it'd be good to see is maybe

5.135.182.168:8014
DeepTechno.FM


or maybe

DeepTechno.FM
5.135.182.168:8014


when defined in the M3U as

Code: Select all

#EXTINF:-1, DeepTechno.FM
5.135.182.168:8014
as i'm not seeing it really pick up the names on it's own from the ICYCAST(?) metadata

thanks
J

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

Re: Improved forked-daapd (iTunes server)

Mon Oct 14, 2013 2:58 am

MrRaf1k1 wrote:Now, if you choose as Airplay sink AirPi2 you can hear the stream on http://localhost:8080/sound.mp3 via MediaPlayer. Stable mp3 decoding seems to work.
Ah finally I have this working.. thanks MrRaf1k1/ejurgensen ! Safari (or any app) on iPhone playing to AirPi on Raspberry via AirPlay and then back out through the Remote app as explained above. think it might lose connection between songs though. Will test further. but in theory it's working

thanks
j

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

Re: Improved forked-daapd (iTunes server)

Mon Oct 14, 2013 11:11 pm

Hi,

a couple of questions.

1) is /var/cache/forked-daapd/songs3.db volatile? ie will it get wiped if i turn off my Pi completely?

2) or if i boot my Pi without my library being present will forked-daapd wipe entries from the database because it thinks theyve been removed. something made it try rebuild the whole db again

3) i noticed that there is a directories = { } parameter in forked-daapd's config. can i have directories across multiple disks (basically i'm wondering if i can have my internet playlists on my SD card - so i can do the vlc/airpi combo - and my mp3s on my external USB which may or may not always be turned on. currently since my library is on my external USB, it all has to be switched on and present for the playlists to function. it would be good if maybe the library was on my local SD but I could maybe "link" the itunes media files directory separately?

thanks for any info
j

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

Re: Improved forked-daapd (iTunes server)

Tue Oct 15, 2013 3:52 am

jmp909 wrote: 2) or if i boot my Pi without my library being present will forked-daapd wipe entries from the database because it thinks theyve been removed. something made it try rebuild the whole db again
Yes it will wipe. That happened to me last week as I did not notice my NFS share from my NAS was not mounted.

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

Re: Improved forked-daapd (iTunes server)

Tue Oct 15, 2013 6:57 am

jmp909 wrote:1) is /var/cache/forked-daapd/songs3.db volatile? ie will it get wiped if i turn off my Pi completely?
No, it's a normal file, and it will stay. When forked-daapd restarts it will do a rescan, and during that process items may be deleted, if they are not available. However, as you can see in /etc/init.d/forked-daapd, the server won't start till local_fs and remote_fs have started, so that should protect against deletion before mounting. But if mount fails it will happen like jpbaril said.

Personally, I have my .db file in /run. Doing it like that makes the file volatile, but I don't reboot very often, and having it there speeds up scanning and reduces wear on the SD card. I have an older backup in /var/cache which has pairing info, and after reboot I copy it manually to /run (stopping the server beforehand).
jmp909 wrote:3) i noticed that there is a directories = { } parameter in forked-daapd's config. can i have directories across multiple disks (basically i'm wondering if i can have my internet playlists on my SD card - so i can do the vlc/airpi combo - and my mp3s on my external USB which may or may not always be turned on. currently since my library is on my external USB, it all has to be switched on and present for the playlists to function. it would be good if maybe the library was on my local SD but I could maybe "link" the itunes media files directory separately?
Yes, you can specify multiple directories. Another way to achieve the same is using a symlink:
directories = {"/srv/music"}
/srv/music/external -> /mnt/externalusb/music
/src/music/playlists (regular dir on your SD card)

dhanjel
Posts: 3
Joined: Sat Sep 22, 2012 11:20 am

Re: Improved forked-daapd (iTunes server)

Wed Oct 16, 2013 6:28 pm

I've installed forked-dappd and everything works fine, I can control it from Remote and stream to my different airplay speakers.

What I'm looking for now is a way to play a stream or file on one or more airplay devices using terminal commands.
Is this possible?

My plan is to use this as a "airplay-proxy" for my home automation system (Fibaro), which can invoke for example php-scripts.
So I want to create a page such as:
proxy.php?action=play&media=http://www/file.m3u&output=AirportExpre ... ySpeakers2
proxy.php?action=stop&output=AirportExpress2
And then convert thoose calls to underlying terminal commands to Control forked-daapd.

Is this possible? I have not found any information about it.

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

Re: Improved forked-daapd (iTunes server)

Wed Oct 16, 2013 9:57 pm

dhanjel wrote:What I'm looking for now is a way to play a stream or file on one or more airplay devices using terminal commands. Is this possible?
Yes, but forked-daapd has no CLI, so instead you would need to control forked-daapd the same way Remote does: With the DACP protocol. So you would kind of need to make a PHP implementation of Remote. How complex a task that is depends on how fancy you want your solution. On the command line you could use curl to send the commands, or make PHP send them itself.

There was a previous question about controlling forked-daapd from command line (just starting playback), and here is my reply with an example curl command.

dhanjel
Posts: 3
Joined: Sat Sep 22, 2012 11:20 am

Re: Improved forked-daapd (iTunes server)

Thu Oct 17, 2013 11:59 am

Sounds complicated :(
It works flawless apart from my cli Control thoughts :)

Image

iv4ad8
Posts: 1
Joined: Sun Oct 20, 2013 12:14 pm

Re: Improved forked-daapd (iTunes server)

Sun Oct 20, 2013 12:19 pm

This is great work @ejurgensen! Have you thought about posting your changes somewhere like github? Maybe forking and patching Julien's repo?

Personally I would find it much easier to have some revision control system to keep up to date with your revisions, and maybe post some pulls etc.

Thanks for the hard work, iv4ad8

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

Re: Improved forked-daapd (iTunes server)

Sun Oct 20, 2013 5:01 pm

Thanks, I'm happy it's working for you. I have my own fork on github, you can find it here:

https://github.com/ejurgensen/forked-daapd

You're of course welcome to follow, add issues or fork.

I ended up doing a lot more modifications than I had anticipated. I think there a still a few to come, so I'm thinking about making an apt repository, so it'll be easier for people to upgrade.

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

Re: Improved forked-daapd (iTunes server)

Sun Oct 20, 2013 6:12 pm

Thanks for all your work on this ejurgensen. One thing that would be useful is a filetype exclusion list for the scanner in the configuration. I find it's trying to scan .txt files and .asd (Ableton meta) etc that are lying around in the library. This slows down the scanning, not much but a bit.

Thanks
J

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

Re: Improved forked-daapd (iTunes server)

Tue Oct 29, 2013 9:54 pm

Time for a new version, this one is number 16. It has the following improvements:
- better support for Podcasts, especially if you use Apple Remote
- fix for an artwork memory leak, which could grow quite large
- filetype exclusion list for the scanner in the configuration

If you've added the apt repository to your sources.list you should be able to upgrade with 'apt-get install forked-daapd' or with a regular apt-get upgrade. Otherwise you can download the package from the location mentioned in my original post.

The new version comes with an extended configuration file. Old configs will still work, but if you want the new stuff you'll need to upgrade your config file. dpkg/apt-get should ask you if you want to do that. If you have podcasts or compilations you'll also want to rescan your library after upgrade. You can trigger this by using the 'touch' command on the files you want rescanned - or by deleting your old database while the server is not running (which will cost you your Remote pairings).

Thanks @jmp909 for providing suggestions, solutions and testing.

freultwah
Posts: 2
Joined: Thu Oct 31, 2013 9:36 pm

Re: Improved forked-daapd (iTunes server)

Thu Oct 31, 2013 9:42 pm

One idea that I have got in mind is configurable names for libraries. Right now, they have been hardcoded to use American English (movies, tv shows), but there may be users who prefer the British variety (films, tv programmes/series) or a completely different language. Why not make the names configurable and just use the present names as the default?

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

Re: Improved forked-daapd (iTunes server)

Fri Nov 01, 2013 9:52 am

@freultwah, good idea, I'll add that to my todo-list. You're also welcome to post it is an issue on GitHub.

To my knowledge forked-daapd is not able to serve video, so I wonder why it even has Movies and TV shows? Maybe it breaks something if they aren't present?

freultwah
Posts: 2
Joined: Thu Oct 31, 2013 9:36 pm

Re: Improved forked-daapd (iTunes server)

Fri Nov 01, 2013 7:33 pm

It does support video, just look into filescanner_ffmpeg.c, but it seems to be slightly behind the curve in the file type detection department. I've had success with MPG and MP4 videos, but I think these days ffmpeg picks the latter up differently and it does not really play with forked_daapd anymore. Back when I was patching the MP4 metadata issue in libav/ffmpeg, I asked Julien Blache that as long as I was on a roll, perhaps he needed some video metadata fields picked up for forked_daapd as well, and he replied that the hd_media tag would be useful in the future. So, the software has support for video and that support was meant to be improved. That side of the software probably demands some love and bringing it into line with the ffmpeg 2.x API.

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

Re: Improved forked-daapd (iTunes server)

Sat Nov 02, 2013 2:18 pm

Interesting, I've got to try the video capabilities then! Also interesting to know you've been in touch with Julian back then. He really made some great work.

I won't be using video myself, so I'm not sure how much work I'll do on that part.

traxtopel
Posts: 10
Joined: Tue Nov 05, 2013 11:22 am

Re: Improved forked-daapd (iTunes server)

Tue Nov 05, 2013 11:25 am

Apple released an update to Remote - 4.0.
Does anyone know if the current git works with Remote 4.0?

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

Re: Improved forked-daapd (iTunes server)

Tue Nov 05, 2013 4:33 pm

i've got an iPhone and an iPad. i can update one of them and try if it nobody has else access to trying it on 4.0 currently.

croque
Posts: 7
Joined: Thu Sep 26, 2013 6:52 am

Re: Improved forked-daapd (iTunes server)

Tue Nov 05, 2013 5:33 pm

traxtopel wrote:Apple released an update to Remote - 4.0.
Does anyone know if the current git works with Remote 4.0?
Yes. I'm running current git and Remote 4.0 on an iPad Air and it works.

Return to “Raspbian”