Setting up uPnP with minidlna on the freenas nightlies post-09/25/2011

Status
Not open for further replies.
G

gcooper

Guest
NOTE: Here are complete semi-official directions for how to set things up with uPnP with minidlna (it will be added to the GUI eventually).

1. Login as root to FreeNAS box.
2. Execute the following commands:

Code:
mount -wu /
# There's a bug in either FreeNAS or the port that prevents this from being done automatically.
pw user add dlna
# Preserve the sample minidlna.conf file
test -f /usr/local/etc/minidlna.conf.sample || cp /usr/local/etc/minidlna.conf.sample /usr/local/etc/minidlna.conf


3. Copy the following to /usr/local/etc/minidlna.conf (replace the parameters below with something more useful for your install.. see /usr/local/etc/minidlna.conf.sample for hints on what you can change):

Code:
port=8200
media_dir=/mnt/tank
friendly_name=freenas
db_dir=/var/db/minidlna
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
inotify=no
enable_tivo=no
strict_dlna=no
notify_interval=300
serial=12345678
model_number=1


4. Test out your settings

Code:
minidlna -f /usr/local/etc/minidlna.conf


Things should be served up properly now -- otherwise, the console will output one or more relevant failure messages.

5. Making the change permanent

Code:
echo 'minidlna_enable="YES"' >> /conf/base/etc/rc.conf


6. Cleanup

Code:
# DO NOT FORGET THIS!
mount -ru /


Notes:

  • I've gotten things to play properly with my Xbox 360.
  • minidlna crashes on VLC (is most likely a bug with VLC) under FreeBSD and OSX.
  • This won't work with all Samsung TVs as noted by JoeSchmuck on the forums.
  • Sony BlueRay/PS3s are picky and won't play certain MIME types under the "All Media" Section (you might have to pick the appropriate media section in order for this to work properly). I know this for a fact with my Sony BlueRay player (detects the share, but won't let me play media under all media); but I can't confirm with a PS3. MP3s work for sure, but m4as won't work with some Sony BlueRay players.

  • Based on the above compatibility list, something seems fishy with the player support (I can play Xvid on my 360, but not one the Sony BlueRay player; I can't play non-copyright protected iTunes mp4 media on my Sony BlueRay player and Xbox 360; mp3s work on the BlueRay and the 360 after manually rescanning the directory).
  • If one of the other media players plays your device better than minidlna -- please let me know and I'll see if I can port support to minidlna or fix support in FreeBSD! Please note what media type you're having issues with as well as what codec you're having issues with (GSpot is recommended if you're using Windows).
  • Auto-rescanning seems broken because I have to issue minidlna with -R in order for it scan for new files.
 

cubix

Moderator
Joined
May 30, 2011
Messages
81
@gcooper: Any luck getting the nightly builds functioning again for the lazy users? Aka me.
 
G

gcooper

Guest
@gcooper: Any luck getting the nightly builds functioning again for the lazy users? Aka me.

I'll talk to jpaetzel about it. With any luck we will have something going by the end of the week.
 
G

gcooper

Guest
I'm going to add nightly images soon which can be downloaded via torrents, because getting the sourceforge infrastructure up and going again appears to have fallen a bit lower on the priority list here.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
EDIT: Deleted content because people were not reading the rest of this thread and missing the correct way to incorporate minidlna.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
Thanks, sure would be nice to consolidate all this into a single thread.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Thanks, sure would be nice to consolidate all this into a single thread.

I could merge the threads, but I think the OP can also do that and I'm not sure how he wants to handle it. We could close one thread and put a link to the other...
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
I could merge the threads, but I think the OP can also do that and I'm not sure how he wants to handle it. We could close one thread and put a link to the other...

Appreciate the offer, think I'll just include the data in this thread on my next posting or I'll just edit my previous posting and include it all.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
Okay, I've been able to retain the setting after a reboot, here's the fix...

Edit the minidlna.conf file at /conf/base/etc/local vice /usr/local/etc.

This brings me to another problem, minidlna will not start automatically on bootstrap, it fails with the following message...

Code:
Oct  2 16:30:46 freenas root: /etc/rc: WARNING: /var/db/minidlna is not a directory.
Oct  2 16:30:46 freenas root: /etc/rc: WARNING: failed precmd routine for minidlna
I can get past the /var/db/minidlna easy enough but it still fails to start up. It does start by CLI by just typing minidlna. I think the problem is it is not compatible with the rc scripting, meaning it doesn't have a start, stop, etc... command so it fails.

I could be wrong in my above statement, I've been reading a lot today but not sure if I learned it correctly. I did learn how to create an rc compatible script today but have no idea where to put it so it runs at startup.

Any ideas?
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
I did learn how to create an rc compatible script today but have no idea where to put it so it runs at startup.
Normally... There's /etc/rc.local (file), or just put your script in /etc/rc.d (folder), but I think with FreeNAS it needs to be /conf/base/etc/rc.d/ or /conf/base/etc/rc.local (rc.local is usually for custom stuff).
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
Normally... There's /etc/rc.local (file), or just put your script in /etc/rc.d (folder), but I think with FreeNAS it needs to be /conf/base/etc/rc.d/ or /conf/base/etc/rc.local (rc.local is usually for custom stuff).

I did that already, /conf/base/etc/local/rc.d/ seems to be the right location which gets loaded into /usr/local/etc/rc.d during boot. I stuffed that script in many places and it never started up. I can run the script providing I'm in the proper directory and enter "./minidlnascript start" and I do have minidlnascript="YES" in rc.conf. It would be nice if minidlna just started like it should.

Time to call it quits for the evening, getting late on this coast. Thanks for the info, I'm sure I'm doing something wrong. More testing tomorrow and I don't mind provided I'm learning something.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Did you make the owner/group the same as the other scripts and chmod 555 ?
Does it have ". /etc/rc.subr" at the beginning?
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
Fixed !

I traced down the original problem of why minidlna would not start on bootstrap. In the file /conf/base/etc/local/rc.d/minidlna the line
Code:
command_args="-P $pidfile -u $minidlna_uid"
is invalid. Change it to
Code:
command_args=""
.

You also need to create the directory minidlna in "/conf/base/var/db/".
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
Cleaned up installation instructions

DISCLAIMER : This is not all my work, far from it so I'm not taking credit. I have consolidated the info here.

This is a cleaned up look of the work required to get minidlna to be operational.

NOTE: You should be able to download one of the nightly builds and skip step 1. The nightly builds should have MULTIMEDIA already set during the build processes. You will have to do the remaining steps until minidlna in incorporated into the GUI.

1) Replace the following line in build/nano_env:

SW_FEATURES="DEBUG"

with this:

SW_FEATURES="DEBUG MULTIMEDIA"

And call build/do_build.sh as you normally would to produce a build image.

It would be a good idea to have media destinations identified before hand as you will need that info in this procedure.

2) Once you have loaded your system it's time to modify a few things...

Code:
mount -wu /
mkdir /conf/base/var/db/minidlna
pw add user dlna
echo 'minidlna_enable="YES"' >> /conf/base/etc/rc.conf
cd /conf/base/etc/local
ee minidlna.conf
Now edit the media_dir lines to reflect your Video, Audio, and Photos (my test drive is peanuts as you can tell)

Code:
media_dir=V,/mnt/peanuts/movies
media_dir=A,/mnt/peanuts/music
media_dir=P,/mnt/peanuts/pictures
Edit the db_dir line if you like. The default will exist but I placed mine on the actual hard drive like so hoping the database will not need to be recreated in full each time.
Code:
db_dir=/mnt/peanuts/minidlnadb
You don't need to change any other values unless you desire to.
Press ESC and save your file.

3) Now we need to fix the minidlna script file.
Code:
cd rc.d
ee minidlna

Modify 
command_args="-P $pidfile -u $minidlna_uid"

to

command_args="-R"
Press ESC to save the modification.

Save all your work properly
Code:
mount -ro /
And type reboot. Minidlna should start up without issue (as of build 8104).

To rebuild your database you can either reboot your NAS or while logged on as root or SU enter 'service minidlna restart'.

UPDATE: Minidlna (as of 11/18/2011) does not refresh the media automatically. The -R in the command_args will force an update every time minidlna is started. If you do not want the database rebuilt each time then place a '#' (hash) mark before the value '#command_args="-R"' or delete it all together.
 

jerrybme

Dabbler
Joined
Sep 28, 2011
Messages
40
Nice job figuring out why minidlna won't load properly on reboot! Now if I could figure out the same issue for transmission I won't have to ssh in to start those processes after every reboot. ;-)
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,970
Nice job figuring out why minidlna won't load properly on reboot! Now if I could figure out the same issue for transmission I won't have to ssh in to start those processes after every reboot. ;-)

Transmission ? If this is another thread then point me to it. I'm enjoying this learning process.
 
Status
Not open for further replies.
Top