Setting up the multimedia (BT, DLNA/uPnP, iTunes) bits in 8.0.3-RELEASE_MULTIMEDIA

Discussion in 'Configuration' started by gcooper, Jan 4, 2012.

  1. gcooper New Member

    Member Since:
    Sep 23, 2011
    Message Count:
    416
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Former iXsystems Software Developer
    gcooper, Jan 4, 2012

    SKIP TO POST # 15 (DLNA), # 45 (BT) or # 64 (iTunes)! These directions are busted :/..

    The following guide is intermediate and is aimed towards individuals who want to look at the multimedia components in FreeNAS that will be present in 8.2.0 as plugins, but with a stable codebase until the official 8.2.0 release is done.

    This writeup assumes the following:

    1. You want to test out the BT, DLNA/uPnP, iTunes applications before the official plugins are released for 8.2.0.
    2. You aren't afraid to go on to the command line/shell (use ee/vi, etc) to get things to work.
    3. You can do basic troubleshooting to get things, or provide enough information in order to get things to work.

    The examples in this email assume the following:

    1. The username is "gcooper".
    2. The path to the location where the media files is stored is housed somewhere on '/mnt/tank'.

    The flow of the writeup is as follows:

    * FAQs
    * Bittorrent (Transmission)
    - Copying over the Files
    - Modifying the Sample File
    - Enabling Transmission at Boot
    - Controlling Transmission Remotely
    * DLNA/uPnP (minidlna)
    * iTunes (firefly)
    * References

    ==========
    FAQs
    ==========

    * Q: Why isn't this stuff in the GUI yet?
    * A: We're working on it and it'll be in 8.2.0+. Please be patient.

    * Q: Why did you rewrite FreeNAS 8.x? FreeNAS 0.7 did this and more!
    * A: Perhaps it was more featureful in this area, but it wasn't extensible. This is off-topic and not relevant.

    * Q: Why are you using software A.B.C (ex. minidlna) instead of X.Y.Z (e.g. mediatomb, serviio)?
    * A: This has been hashed over in several threads prior to this; as such I suggest that you search in the forums before asking this question. If you want to discuss importing a different piece of software and standardizing "the" defacto plugin on that software, please PM me with your request and a working procedure and/or end-to-end documentation on how to integrate it into FreeNAS using command line arguments and/or a set of configuration files. I'd like to avoid Serviio if at all possible though because it's Java based and Java requires X11 stuff in order to function (my goal is to remove all of the X11 components from FreeNAS eventually).

    * Q: But mediatomb/transmission/etc already has a GUI? Why aren't you using that?
    * A: That works for general purpose machines/users, but we want the software to cleanly tie into FreeNAS.

    * Q: Why aren't you using Fuppes? It's in FreeNAS 0.7?
    * A: The website's been dead for quite a while and it appears to be an inactive project. FreeNAS and some of the developers involved aren't interested in taking on any more projects at this time :).

    ==========
    Bittorrent
    ==========

    ---------------------------------
    Preconditions
    ---------------------------------

    1. You need to create a user with a home directory on persistent storage (e.g. '/mnt/tank/home/gcooper').

    ---------------------------------
    Copying Over the Files
    ---------------------------------

    1. Login as the user that will be running transmission, e.g. "gcooper".
    2. Issue the following commands to copy the file over the sample settings.json file, modifying according to your user's settings, and create some directories for Transmission:

    Code (text):
    1.  
    2. mkdir -p "$HOME/.config/transmission-daemon"
    3. mkdir -p "$HOME/transmission/incomplete"
    4. mkdir -p "$HOME/transmission/complete"
    5. cp /usr/local/etc/transmission/home/settings.json $HOME/.config/transmission-daemon/.
    6. sed -e '' -i '' "s,/mnt/tank/home,`dirname $HOME`,g" \
    7.        -e 's,myuser,'`whoami`',g' $HOME/.config/transmission-daemon/settings.json
    8.  
    ---------------------------------
    The Sample File
    ---------------------------------

    A sample settings.json file is present in $HOME/.config/transmission-daemon/settings.json ; some settings
    that you might want to change are as follows:

    peer-port : the port used for incoming BitTorrent requests. You probably want to change this and make sure to open up the firewall / NAT on your router/switch if needed to to your NAS box.
    speed-limit-down : download speed limit
    speed-limit-down-enabled : download speed limit toggle
    speed-limit-up : upload speed limit
    speed-limit-up-enabled : upload speed limit toggle

    ---------------------------------
    Enabling Transmission at Boot
    ---------------------------------

    Run the following commands as root:

    Code (text):
    1.  
    2. mount -wu /
    3. sed -i '' \
    4.     -e 's/\(transmission_enable="\)NO"/\1YES"/' \
    5.     -e 's/\(transmission_user="\)myuser/\1'`whoami`'\"/g' /etc/rc.conf
    6. sed -i '' \
    7.     -e 's/\(transmission_enable="\)NO"/\1YES"/' \
    8.     -e 's/\(transmission_user="\)myuser/\1'`whoami`'\"/g' /conf/base/etc/rc.conf
    9. mount -ru /
    10.  
    ---------------------------------
    Controlling Transmission Remotely
    ---------------------------------

    Remote control is a really cool feature in transmission. You can login from authorized boxes while the daemon runs in the background grinding away on torrents

    You can control (add torrents, monitor download stats, change settings, etc) the transmission daemon on your FreeNAS box by connecting via one of the clients noted here (look for Transmission-remote-*): http://www.transmissionbt.com/resources/ . The author recommends "transmission-remote-dotnet" for Windows users.

    The key to enabling the remote control feature is to change
    Code (text):
    1. rpc-enabled
    to
    Code (text):
    1. true
    in settings.json. The author suggests setting a value for
    Code (text):
    1. rpc-username
    and changing
    Code (text):
    1. rpc-password
    to something more meaningful.

    ---------------------------------
    Testing Your Changes
    ---------------------------------

    The best way to test your changes is to execute the following as root:

    Code (text):
    1.  
    2. transmission-daemon -f
    3.  
    This will run transmission in the foreground so you can monitor progress when adding files to daemon.

    Once you're satisfied with your results, enter in "Control-C" to exit from the daemon (this will potentially interrupt any torrent service being done at the time), and then enter in the following command as root:
    Code (text):
    1. service transmission start
    and
    Code (text):
    1. service transmission status
    to verify that the daemon is running. Congratulations -- you now have a working torrent client on FreeNAS!

    ==========
    DLNA/uPnP
    ==========

    ---------------------------------
    Preconditions
    ---------------------------------

    1. You need to create a user with a home directory on persistent storage (e.g. '/mnt/tank/home/gcooper').

    ---------------------------------
    Copying Over the Files
    ---------------------------------

    1. Login as the user that will be housing the config files, e.g. "gcooper".
    2. Issue the following commands to copy the file over the sample minidlna.conf file, modifying according to your user's settings, and create some directories for Minidlna:

    Code (text):
    1.  
    2. mkdir -p "$HOME/var/db/minidlna"
    3. mount -wu /
    4. cp /conf/base/usr/local/etc/minidlna.conf $HOME/.
    5. sed -i '' -e "s,/mnt/tank/home,`dirname $HOME`,g" \
    6.             -e "s/myuser/`whoami`/g" \
    7.             $HOME/minidlna.conf
    8.  
    ---------------------------------
    The Sample File
    ---------------------------------

    A sample minidlna.conf file is present in $HOME/minidlna.conf ; some settings that you might want to change are as follows:

    db_dir : directory where the minidlna media database will live.
    media_dir : directory where media files can be grabbed from.

    ---------------------------------
    Enabling minidlna at Boot
    ---------------------------------

    Run the following commands as root:

    Code (text):
    1.  
    2. mount -wu /
    3. sed -i '' \
    4.     -e 's/\(minidlna_enable="\)NO"/\1YES"/' \
    5.     -e "s,\(minidlna_flags=.*\)/mnt/tank/home/myuser/\(.*\),\1$HOME\2,g" /etc/rc.conf
    6. sed -i '' \
    7.     -e 's/\(minidlna_enable="\)NO"/\1YES"/' \
    8.     -e "s,\(minidlna_flags=.*\)/mnt/tank/home/myuser/\(.*\),\1$HOME\2,g" /conf/base/etc/rc.conf
    9. mount -ru /
    10.  
    ---------------------------------
    Testing Your Changes
    ---------------------------------

    The best way to test your changes is to execute the following as root:

    Code (text):
    1.  
    2. mt-daapd -d -f $HOME/minidlna.conf
    3.  
    This will run firefly in the foreground so you can monitor progress when adding files to daemon.

    Once you're satisfied with your results, enter in "Control-C" to exit from the daemon, and then enter in the following command as root:
    Code (text):
    1. service minidlna start
    and
    Code (text):
    1. service minidlna status
    to verify that the daemon is running. Congratulations -- you now have a working DLNA server running on FreeNAS!

    ==========
    iTunes
    ==========

    ---------------------------------
    Preconditions
    ---------------------------------

    1. You need to create a user with a home directory on persistent storage (e.g. '/mnt/tank/home/gcooper').

    ---------------------------------
    Copying Over the Files
    ---------------------------------

    1. Login as the user that will be housing the config files, e.g. "gcooper".
    2. Issue the following commands to copy the file over the sample mt-daapd.conf file, modifying according to your user's settings, and create some directories for Firefly:

    Code (text):
    1.  
    2. mkdir -p "$HOME/var/db/mt-daapd"
    3. chown daapd "$HOME/var/db/mt-daapd"
    4. mount -wu /
    5. cp /conf/base/usr/local/etc/mt-daapd.conf $HOME/.
    6. sed -i '' -e "s,/mnt/tank/home,`dirname $HOME`,g" \
    7.             -e "s/myuser/`whoami`/g" \
    8.             $HOME/mt-daapd.conf
    9.  
    ---------------------------------
    The Sample File
    ---------------------------------

    A sample mt-daapd.conf file is present in $HOME/mt-daapd.conf ; some settings that you might want to change are as follows:

    admin_pw : administrator password.
    db_parms : path for the where the iTunes/Firefly database should be.
    mp3_dir : directory for where the mp3s, etc can be found.
    servername : name of the iTunes share.

    ---------------------------------
    Enabling mt-daapd at Boot
    ---------------------------------

    Run the following commands as root:

    Code (text):
    1.  
    2. mount -wu /
    3. sed -i '' \
    4.     -e 's/\(mt_daapd_enable="\)NO"/\1YES"/' \
    5.     -e "s,\(mtdaapd_flags=.*\)/mnt/tank/home/myuser/\(.*\),\1$HOME\2,g" /etc/rc.conf
    6. sed -i '' \
    7.     -e 's/\(mt_daapd_enable="\)NO"/\1YES"/' \
    8.     -e "s,\(mtdaapd_flags=.*\)/mnt/tank/home/myuser/\(.*\),\1$HOME\2,g" /conf/base/etc/rc.conf
    9. mount -ru /
    10.  
    ---------------------------------
    Testing Your Changes
    ---------------------------------

    The best way to test your changes is to execute the following as root:

    Code (text):
    1.  
    2. mt-daapd -c $HOME/mt-daapd.conf -f
    3.  
    This will run firefly in the foreground so you can monitor progress when adding files to daemon.

    Once you're satisfied with your results, enter in "Control-C" to exit from the daemon, and then enter in the following command as root:
    Code (text):
    1. service mt-daapd start
    and
    Code (text):
    1. service mt-daapd status
    to verify that the daemon is running. Congratulations -- you now have a working iTunes server running on FreeNAS!

    ==========
    References
    ==========

    ---------------------------------
    BitTorrent (Transmission)
    ---------------------------------

    1. Editing config files in Transmission - https://trac.transmissionbt.com/wiki/EditConfigFiles

    ---------------------------------
    DLNA/uPNP (Minidlna)
    ---------------------------------

    1. http://forums.freenas.org/showthrea...dlna-on-the-freenas-nightlies-post-09-25-2011

    ---------------------------------
    Daapd/iTunes (firefly)
    ---------------------------------

    1. http://forums.freenas.org/showthrea...efly-on-the-freenas-nightlies-post-09-25-2011
  2. dziring Member

    Member Since:
    Aug 17, 2011
    Message Count:
    34
    Likes Received:
    1
    Trophy Points:
    8
    Occupation:
    Manager, Procurement Contracts
    Location:
    Roseville, California, United States
    dziring, Jan 7, 2012

    A couple of observations:
    1. Your mkdir command creates ~/transmission/completed but the settings file expects the directory to be called 'complete'
    2. The sed command didn't work for me, but I didn't try to debug. I just replaced the /mnt/tank/home/myuser with the correct user home path, and "myuser" with the right username.
  3. dziring Member

    Member Since:
    Aug 17, 2011
    Message Count:
    34
    Likes Received:
    1
    Trophy Points:
    8
    Occupation:
    Manager, Procurement Contracts
    Location:
    Roseville, California, United States
    dziring, Jan 7, 2012

    Next observation (and a small cry for help):

    I had success with running the transmission-daemon in the foreground, but as soon as I tried to start it as a service, I got the following:

    Starting transmission.
    TERM: Undefined variable.
    /usr/local/etc/rc.d/transmission: WARNING: failed to start transmission

    The only major difference between my setup and the sample above, that I can think of, is that my user home directory is /mnt/pool/zeke instead of /mnt/tank/home/zeke, and I believe i corrected for that in the settings file.


    --
    EDIT: My own fault. Stupid typo.
  4. sonisame72 New Member

    Member Since:
    Aug 14, 2011
    Message Count:
    25
    Likes Received:
    0
    Trophy Points:
    0
    sonisame72, Jan 7, 2012

    I see the user home directory and transmission/minidlna settings.json and db directory are sitting on a disk(mnt). If one enables minidlna and transmission on boot, what does this do to disk spindown? Will these processes keep spinning disk all day?


    PS gcooper, I cant get mkv's to work on ps3 or my sharp tv (as seen by other users also) using minidlna either. I get unsupported file format error. Other than that ps3 seems to be working file with all other hd files( .ts/.tp).
  5. MrWGT New Member

    Member Since:
    Jan 6, 2012
    Message Count:
    7
    Likes Received:
    0
    Trophy Points:
    0
    MrWGT, Jan 8, 2012

    Is the file mt-daapd.conf not located at /conf/base/etc/local/mt-daapd.conf instead of /conf/base/usr/local/etc/mt-daapd.conf? So the command should look like
    Code (text):
    1.  
    2. mkdir -p "$HOME/var/db/mt-daapd"
    3. chown daapd "$HOME/var/db/mt-daapd"
    4. mount -wu /
    5. cp [b]/conf/base/etc/local/mt-daapd.conf[/b] $HOME/.
    6. sed -i '' -e "s,/mnt/tank/home,`dirname $HOME`,g" \
    7.             -e "s/myuser/`whoami`/g" \
    8.             $HOME/mt-daapd.conf
    ?

    Gerd
  6. fka New Member

    Member Since:
    Jan 9, 2012
    Message Count:
    15
    Likes Received:
    0
    Trophy Points:
    0
    fka, Jan 9, 2012

    using MrWGTs suggestion I can get firefly to run, scan my mp3s and generate a db. But only when logged in as root and only after editing /usr/local/etc/mt-daapd.conf (edit lost post reboot.)

    Code (text):
    1.  
    2. [root@NAS] ~# service mt-daapd start
    3. Starting firefly.
    4. Error reading config file (/usr/local/etc/mt-daapd.conf)
    5. /usr/local/etc/rc.d/mt-daapd: WARNING: failed to start firefly

    If i try to start logged in as my mt-daapd user i get:
    Code (text):
    1.  
    2. [FKA@NAS] ~> service mt-daapd start -y
    3. /etc/rc.conf.local: cannot create /var/tmp/rc.conf.freenas: Permission denied
    4.  
    Without -y i get:
    Code (text):
    1.  
    2. [FKA@NAS] ~> service mt-daapd start
    3. Starting firefly.
    4. You are not root.  This is almost certainly wrong.  If you are
    5. sure you want to do this, use the -y command-line switch
    6. /usr/local/etc/rc.d/mt-daapd: WARNING: failed to start firefly
    just to avoid permissions problems FKA is the owner of the volume ..

    Logged in as root I get:

    Code (text):
    1. [root@NAS] ~# service mt-daapd start
    2. Starting firefly.
    3. [root@NAS] ~# service mt-daapd status
    4. firefly is running as pid 2596.
    However even though I can get firefly to run logged in as root and iTunes sees the share, iTunes just hangs (with no network activity) at "Loading FreeNAS svn ... "

    Code (text):
    1.  
    2. Jan  9 20:03:33 NAS mt-daapd[2428]: Config entry general/compress is deprecated.  Please review the sample config
    3. Jan  9 20:03:33 NAS mt-daapd[2428]: Firefly Version svn-1696: Starting with debuglevel 5
    4. Jan  9 20:03:33 NAS mt-daapd[2428]: Plugin loaded: rsp/svn-1696
    5. Jan  9 20:03:33 NAS mt-daapd[2428]: Plugin loaded: ssc-script/svn-1696
    6. Jan  9 20:03:33 NAS mt-daapd[2428]: Plugin loaded: daap/svn-1696
    7. Jan  9 20:03:33 NAS mt-daapd[2428]: Starting rendezvous daemon
    8. Jan  9 20:03:33 NAS mt-daapd[2428]: Starting signal handler
    9. Jan  9 20:03:33 NAS mt-daapd[2430]: Initializing database
    10. Jan  9 20:03:34 NAS mt-daapd[2430]: Starting web server from /usr/local/share/mt-daapd/admin-root on port 3689
    11. Jan  9 20:03:34 NAS mt-daapd[2430]: Registering rendezvous names
    12. Jan  9 20:03:34 NAS mt-daapd[2430]: Serving 6422 songs.  Startup complete in 1 seconds
    13. Jan  9 20:03:34 NAS mt-daapd[2430]: Rescanning database
    14. Jan  9 20:03:56 NAS mt-daapd[2430]: Error reading: Unknown error
    15. Jan  9 20:03:56 NAS last message repeated 9 times
    16. Jan  9 20:03:58 NAS mt-daapd[2430]: Starting playlist scan
    17. Jan  9 20:03:58 NAS mt-daapd[2430]: Updating playlists
    18. Jan  9 20:03:59 NAS mt-daapd[2430]: Scanned 6422 songs (was 6422) in 25 seconds
    I'm assuming the problem i have is because mt-daapd is being started from root as apposed to the mt-daapd user?
    Any help/advice would be much appreciated.

    Cheers
    FKA
  7. MrWGT New Member

    Member Since:
    Jan 6, 2012
    Message Count:
    7
    Likes Received:
    0
    Trophy Points:
    0
    MrWGT, Jan 9, 2012

    1) The last problem (iTunes hangs) is due to changes in iTunes which are not compatible with the supplied firefly version. I've seen post (search google for "itunes firefly freebsd") stating that there is a solution - not checked so far.

    2) I started my setup according to thread http://forums.freenas.org/showthrea...efly-on-the-freenas-nightlies-post-09-25-2011. After that all worked but after a reboot the changes to /usr/local/etc/mt-daapd.conf are lost. I figured out that the content of /conf/base/etc/local/mt-daapd.conf is copied to /usr/local/etc/mt-daapd.conf at startup so changes made in the /conf/base... file are "reboot save".

    3) After a reboot the user "daapd" was lost so i just added the user daapd using gui and now firefly is running ok after a reboot.

    Gerd

    freenas-803-firefly-setup.jpg
  8. fka New Member

    Member Since:
    Jan 9, 2012
    Message Count:
    15
    Likes Received:
    0
    Trophy Points:
    0
    fka, Jan 9, 2012

    thanks for the reply

    I'd forgotten about /conf/base/etc/local from when i messed around with openvpn !

    Id read this thread https://discussions.apple.com/thread/3372281?start=150&tstart=0 but only to the point where 10.5.1 is reported to fix the problem .... reading on 10.5.2 breaks it again !!

    Oh well maybe apple will get it together in time for FreeNAS 8.2 !

    Cheers
    D
  9. gcooper New Member

    Member Since:
    Sep 23, 2011
    Message Count:
    416
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Former iXsystems Software Developer
    gcooper, Jan 9, 2012

    1. Thanks. I'll update the directions in a bit.
    2. I'll fix that nasty sed.
  10. gcooper New Member

    Member Since:
    Sep 23, 2011
    Message Count:
    416
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Former iXsystems Software Developer
    gcooper, Jan 9, 2012

    You discovered a gap in the directions for all 3 'recipes'. You need to be the user when creating the files, but be root when starting the services. Will fix this item in the directions!
  11. dziring Member

    Member Since:
    Aug 17, 2011
    Message Count:
    34
    Likes Received:
    1
    Trophy Points:
    8
    Occupation:
    Manager, Procurement Contracts
    Location:
    Roseville, California, United States
    dziring, Jan 9, 2012

    I missed saying this in my earlier post, but Thanks for preparing this post. It's much appreciated.
  12. fka New Member

    Member Since:
    Jan 9, 2012
    Message Count:
    15
    Likes Received:
    0
    Trophy Points:
    0
  13. Skaven New Member

    Member Since:
    Oct 25, 2011
    Message Count:
    31
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Ung Pirat Falun
    Location:
    Falun, Sweden, Sweden
    Skaven, Jan 10, 2012

    hello i´m normoly using Linux systems so I'm new on BSD, i haw a problem whit a step my question is this 1 command? or is it 3 commands?
    cp /usr/local/etc/transmission/home/settings.json $HOME/.config/transmission-daemon/.
    sed -e '' -i '' "s,/mnt/tank/home,`dirname $HOME`,g" \
    -e 's,myuser,'`whoami`',g' $HOME/.config/transmission-daemon/settings.json

    is this 1 or is it 3 commands?

    like
    step 1
    cp /usr/local/etc/transmission/home/settings.json $HOME/.config/transmission-daemon/.
    Enter

    step 2
    sed -e '' -i '' "s,/mnt/tank/home,`dirname $HOME`,g" \
    Enter

    step 3
    -e 's,myuser,'`whoami`',g' $HOME/.config/transmission-daemon/settings.json
    Enter

    os is only 1 step?
    cp /usr/local/etc/transmission/home/settings.json $HOME/.config/transmission-daemon/.
    sed -e '' -i '' "s,/mnt/tank/home,`dirname $HOME`,g" \
    -e 's,myuser,'`whoami`',g' $HOME/.config/transmission-daemon/settings.json
    Enter

    ?

    and my user account home folder is /mnt/Internet_Disk/user/home/golab so should i edit the command sed -e '' -i '' "s,/mnt/tank/home,`dirname $HOME`,g" \ to be sed -e '' -i '' "s,/mnt/Internet_Disk/user/home/golab,`dirname $HOME`,g" \


    and when is do cp /usr/local/etc/transmission/home/settings.json $HOME/.config/transmission-daemon/. should i do it whit root to my account golab ? when i do it when i log din whit go lab i get permission denied
  14. dziring Member

    Member Since:
    Aug 17, 2011
    Message Count:
    34
    Likes Received:
    1
    Trophy Points:
    8
    Occupation:
    Manager, Procurement Contracts
    Location:
    Roseville, California, United States
    dziring, Jan 10, 2012

    Half way in between. It's two commands. One is the cp command, copying settings.json to the right location.
    The other is a sed command intended to replace "/mnt/tank/home" with the correct home directory for your system, and "myuser" with the user under which transmission is being installed.

    I found it easier to do this by hand, but that's just me.
  15. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,095
    Likes Received:
    50
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Jan 10, 2012

    MiniDLNA Procedure by Joe

    Minimum Requirements: 8.0.3-MULTIMEDIA installed, establish your media directories and populate them with something to use.
    **Look at the bottom of this posting for upgrade instructions**

    This procedure does not require a specific user account however you must log in as root. You may use the Console or I prefer SSH.

    Assumptions:
    "pool" reference = your hard drive pool name. This must change based on your pool name.
    "dlna" reference is the directory your configuration and minidlna database resides in and can remain this name.


    1. Log in as root (SSH or Console)
    2. Enter the following commands:
    Code (text):
    1.  
    2. mount -wu /
    3. mkdir -p /mnt/pool/dlna/var/db/minidlna
    4. cd /mnt/pool/dlna
    5. cp /conf/base/etc/local/minidlna.conf .
    6. ee minidlna.conf
    7.  
    3. At this point you need to edit the "media_dir=" lines to point to your media directories and remove the hash # mark from the beginning of each line you change to enable it.

    You can choose listing a single directory for everything if you like:
    media_dir=/mnt/pool/media

    or individually:
    media_dir=V,/mnt/pool/movies
    media_dir=A,/mnt/pool/music
    media_dir=P,/mnt/pool/photos

    You need to update the db_dir path:
    db_dir=/mnt/pool/dlna/var/db/minidlna

    NOTE: Use as many lines as you need to add, you are not limited to a single media destination. Example:
    media_dir=A,/mnt/pool/Jennifer/music
    media_dir=A,/mnt/pool/Daisy/music

    You can also select the name of your DLNA Server:
    friendly_name=Media Server

    When done hit the Escape key and select save.

    This concludes the main setup and it will be retained even after you perform an update to your FreeNAS version.

    ------

    Now to activate the service.

    4. We must update the one file that is restored on every reboot in order to ensure the system runs.
    Code (text):
    1.  
    2. cd /conf/base/etc
    3. ee rc.conf
    4.  
    Scroll down to where you read minidlna_enable="NO" and change it to "YES"

    5. Change the next line from minidlna_flags="-f /mnt/tank/home/myuser/minidlna.conf" to
    Code (text):
    1. minidlna_flags="-f /mnt/pool/dlna/minidlna.conf"
    NOTE: change 'pool' to your pool mount point as in the above setup.

    Press Escape and save the file.

    6. At this point you could type 'mount -ro /' and then 'reboot' and the system should run, BUT we could test this first to ensure you have the paths correct to your files...

    7. Lets update the current rc.conf as well so we can test if this works before rebooting.
    Code (text):
    1.  
    2. cd /etc
    3. ee rc.conf
    4.  
    Scroll down to where you read minidlna_enable="NO" and change it to "YES"

    8. Change the next line from minidlna_flags="-f /mnt/tank/home/myuser/minidlna.conf" to
    Code (text):
    1. minidlna_flags="-f /mnt/pool/dlna/minidlna.conf"
    Press Escape and save the file.

    9. Now to close the boot system drive (MUST DO THIS)
    Code (text):
    1.  
    2. mount -ro /
    3.  
    10. To test run the system type
    Code (text):
    1.  
    2. service minidlna start
    3.  
    If you have a lot of media files you should see your hard drive in heavy use as it builds up the database of available media.

    Other commands are:
    service minidlna restart
    service minidlna stop

    Once your hard drive has slowed down, test out your DLNA service and watch a movie, play a song, look at a photo.
    Last thing, reboot the NAS and make sure minidlna runs. If it doesn't then you need to revisit the /conf/base/etc/rc.conf file and make sure it's correct. Remember you need to mount -uw / before you can change it and mount -ro / after the changes.

    Some Additional Information...

    1) All your configuration information is stored on your pool. This means that if/when you update your FreeNAS installation, you only need to perform the activation part above (editing /conf/base/etc/rc.conf).

    2) MiniDLNA currently does not automatically update the database when you add a file. This is a FreeBSD limitation. To recognize new files you can reboot the system, restart minidlna manually, or set up a CRON job to restart the service periodically. This goes beyond this How-To. With any luck there will be a fix but I'm not holding my breath.

    3) MiniDLNA does not transcode. This means that if the media is not in a format that the player can play, it will fail. A PS3 will play many formats but not all. Many new Blu-Ray players will play many formats. Some players don't support DNLA at all.

    If you have a problem with this procedure, please provide specific feedback and if the procedure is incorrect, I'll change it. If you need assistance, I'll do my best to provide it.

    -Joe

    EDIT: If you are upgrading from 8.0.3 or 8.0.4 to a newer version of 8.0.4 and you have already had MiniDLNA configured IAW these instructions, you only need to do the following steps.
    Code (text):
    1.  
    2. mount -uw /
    3.  
    Now do steps 4, 5, and 9, then wait 5 seconds (let the flash drive finish writing) and type reboot.
  16. Skaven New Member

    Member Since:
    Oct 25, 2011
    Message Count:
    31
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Ung Pirat Falun
    Location:
    Falun, Sweden, Sweden
    Skaven, Jan 11, 2012



    so u mean the command should be? sed -e '' -i '' "s,/mnt/Internet_Disk/user/home,`dirname $HOME`,g" \ -e 's,golab,'`whoami`',g' $HOME/.config/transmission-daemon/settings.json

    because i get the error


    [golab@freenas] ~> sed -e '' -i '' "s,/mnt/Internet_Disk/user/home,`dirname $HOME`,g" \ -e 's,golab,'`whoami`',g' $HOME/.config/transmission-daemon/settings.json
    sed: s,/mnt/Internet_Disk/user/home,/mnt/Internet_Disk/user/home,g: No such file or directory
    [golab@freenas] ~>
  17. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,095
    Likes Received:
    50
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Jan 11, 2012

    Try this:
    Code (text):
    1.  
    2. step 1
    3. cp /usr/local/etc/transmission/home/settings.json $HOME/.config/transmission-daemon/.
    4. Enter
    5.  
    6. step 2
    7. sed -e '' -i '' "s,/mnt/tank/home,`dirname $HOME`,g"
    8. Enter
    9.  
    10. step 3
    11. -e 's,myuser,'`whoami`',g' $HOME/.config/transmission-daemon/settings.json
    12. Enter
    13.  
    Note that on step 2 I removed the "\" which means to process the next line (if I understand it correctly).
    The data at the beginning needs to be the same as the original "s,/mnt/......" or "s,myuser" as it's a search function for the code you are changing, the second part of that string is what it changes to.

    Hope this helps.

    P.S. I don't believe you can run the lines together as a single line, you are missing the carriage returns.
  18. Skaven New Member

    Member Since:
    Oct 25, 2011
    Message Count:
    31
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Ung Pirat Falun
    Location:
    Falun, Sweden, Sweden
    Skaven, Jan 11, 2012

    this is what i haw now dun i haw started from beginning


    [golab@freenas] ~> mkdir -p "$HOME/.config/transmission-daemon"
    [golab@freenas] ~> mkdir -p "$HOME/transmission/incomplete"
    [golab@freenas] ~> mkdir -p "$HOME/transmission/complete"
    [golab@freenas] ~> cp /usr/local/etc/transmission/home/settings.json $HOME/.config/transmission-daemon/.
    cp: /usr/local/etc/transmission/home/settings.json: Permission denied
    [golab@freenas] ~> su
    Password:
    [golab@freenas] /mnt/Internet_Disk/user/home/golab# cp /usr/local/etc/transmission/home/settings.json /mnt/Internet_Disk/user/home/golab/.config/transmission-daemon/.
    [golab@freenas] /mnt/Internet_Disk/user/home/golab# exit
    exit
    [golab@freenas] ~> sed -e '' -i '' "s,/mnt/Internet_Disk/user/home,`dirname $HOME`,g"
    sed: s,/mnt/Internet_Disk/user/home,/mnt/Internet_Disk/user/home,g: No such file or directory
    [golab@freenas] ~> sed -e '' -i '' "s,/mnt/Internet_Disk/user/home,`dirname $HOME`,g"


    but what i´m doing wrong? way is s, and ,g in the home string? what do the do?
  19. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,095
    Likes Received:
    50
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Jan 11, 2012

    This is the first time I've tried to setup transmission but here is what I'd do to get past your problems.

    You did the right thing going to SU to copy the file. now you need to edit the file. The sed lines were designed to make it easy provided they work. Manually edit as follows (I hope I got this right)

    cd /mnt/Internet_Disk/user/home/golab/.config/transmission-daemon
    ee settings.json

    Now you must change the path to your files in two locations. (download directory and incomplete directory) Press Escape and save your work.

    Hopefully that will get you over this bump in the road. You will still need to finish the main procedure to enable the service.

    EDIT: If you get an error during boot noting RC.CONF, make sure you change /conf/base/etc/rc.conf
  20. revoman New Member

    Member Since:
    Jan 11, 2012
    Message Count:
    2
    Likes Received:
    0
    Trophy Points:
    0
    revoman, Jan 11, 2012

    Since we're talking multimedia

    So I just updated my FreeNAS 8 box to a multicore system and have a bunch of CPU cycles free. I would like the ability to run the Handbrake CLI from a FreeNAS plugin. I am a Web/Java developer and could help with the front end if there was support for getting the binaries to build. I would probably start with the ability to manually start the process from the plugin but later add the ability to configure a folder (or multiple for different profiles) toscan for new files and then execute a predetermined profile against the files, one at a time.

    Is this something anyone else would be interested in. And would it make sense to put in this type of a release?

    -Nate
    P.S. I read a thread about Java being a poor choice for FreeNAS because it required X11. That is not true, I've run many java applications on headless systems. The Open-JDK provides a "headless" install package for linux. And the SUN jvm can be run in headless mode with the "-Djava.awt.headless=true" command line argument. Now if the java app in question is written to use windowing toolkits than that changes it. Anyhow, my 2 cents.

Share This Page