Results 1 to 15 of 19

Thread: [Howto] Install DLNA media servers for Oleg firmware

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [Howto] Install DLNA media servers for Oleg firmware

    After you've installed basic optware to the router using e.g. the Raas image directly or indirectly using my tutorial DLNA could be the next step.

    A router with 128MB RAM (RT-N16, WL-500gP or WL-500W with RAM upgrade) is recommended if you plan to run many other programs as well.

    If you don't know what DLNA is just check the Wiki.

    The basic idea is that media servers (like the router) provide media to media player (like your TV, media player etc.) controlled by controller (like your PDA, mobile etc.)
    There are many different options, the most popular being: mediatomb, minidlna and twonky.
    You can install all, and disable what you don't like.

    mediatomb (special thanks to rathalian and ignatz)
    Original thread

    Just copy-paste as such:
    Code:
    cd /opt/share/file; [ ! -f magic.old ] && mv magic magic.old
    ipkg update; ipkg install readline mediatomb
    mkdir -p /opt/etc/mediatomb
    mkdir -p /usr/local/root/.mediatomb
    flashfs save && flashfs commit && flashfs enable
    sed -i 's/MT_USER="root"/MT_USER="admin"/' /opt/etc/mediatomb.conf
    sed -i 's/MT_ENABLE=false/MT_ENABLE=true/' /opt/etc/default/mediatomb
    cd /opt/share/mediatomb
    cat sqlite3.sql | sqlite3 mediatomb.db
    mv mediatomb.db /opt/etc/mediatomb/
    /opt/etc/init.d/S90mediatomb start
    /bin/ps | grep mediatomb
    MediaTomb web interface: http://192.168.1.1:50500/

    More about MediaTomb: http://mediatomb.cc/

    minidlna (special thanks to shantanugoel)
    Original thread

    If you prefer not to compile it, fetch my compiled version and extract it on the router. minidlna.tar.gz.

    Copy-paste the following script and it will do everything (build also if you did not download the above binary version, however it can take half an hour in case of slow router):
    Code:
    #!/bin/sh
    #written by ecaddict, distributed (conveyed) under GPL version 3 or any later version
    
    MDIR=/mnt/protected/Storage
    DDIR=/opt/var/cache/minidlna
    STARTS=/opt/etc/init.d/S90minidlna
    BDIR=/mnt/dev/minidlna
    #user editable part end
    
    EXSD=/bin/sed
    DCONF=/opt/etc/minidlna.conf
    DBIN=/opt/sbin/minidlna
    LDIR=/opt/var/log
    
    ipkg update
    ipkg install libvorbis libogg libid3tag libexif libjpeg ffmpeg flac
    
    if [ ! -x ${DBIN} ] || [ ! -f /opt/etc/minidlna.conf ]; then
      ipkg install buildroot optware-devel unzip
      ipkg remove wget
      ipkg install wget-ssl
      mkdir -p ${BDIR} && cd ${BDIR}
      wget --no-check-certificate https://github.com/shantanugoel/minidlna-asus/zipball/asus
      unzip asus && rm asus
      cd shantanugoel-minidlna*
      make
      export INSTALLPREFIX=/opt
      export DESTDIR=/opt
      make install
    fi
    
    mkdir -p ${MDIR}
    mkdir -p ${DDIR}
    mkdir -p ${LDIR}
    ${EXSD} -i 's%^media_dir=.*%media_dir='''${MDIR}'''%' ${DCONF}
    ${EXSD} -i 's%^#db_dir.*%db_dir='''${DDIR}'''%' ${DCONF}
    ${EXSD} -i 's%^#log_dir.*%log_dir='''${LDIR}'''%' ${DCONF}
    
    cat > ${STARTS} << __EOF__
    #!/bin/sh
    #written by ecaddict, distributed (conveyed) under GPL version 3 or any later version
    
    CONF=${DCONF}
    EXDL=${DBIN}
    
    NAME="\${EXDL##*/}"
    OPTS="-f \${CONF}"
    
    if [ -z "\$1" ] ; then
        case \${0##*/} in
            S??*) rc="start" ;;
            K??*) rc="stop" ;;
            *) rc="usage" ;;
        esac
    else
        rc="\$1"
    fi
    
    case "\$rc" in
        start)
            if [ ! -x \${EXDL} ];then
              echo -e "\\033[1;31mMinidlna is missing: "\$EXDL"\\033[0m"
              exit 1
            fi
            if [ ! -f \${CONF} ];then
              echo -e "\\033[1;31mConfig file "\$CONF" is missing\\033[0m"
              exit 2
            fi
            if [ -n "\$(pidof \$NAME)" ]; then
              echo -e "\\033[1;33m\$NAME runs already\\033[0m"
              exit 3
            fi
            echo "Starting \$NAME"
            \${EXDL} \${OPTS}
            ;;
        stop)
            if [ -n "\$(pidof \$NAME)" ]; then
                echo "Stopping \$NAME"
                killall \$NAME 2> /dev/null
            fi
            ;;
        restart)
            "\$0" stop
            sleep 5
            "\$0" start
            ;;
        *)
            echo "Usage: \$0 (start|stop|restart|usage)"
            ;;
    esac
    __EOF__
    chmod u+x ${STARTS}
    ${STARTS} start
    installm.tar.gz
    My usual single line install:
    Code:
    cd /tmp && wget -O installm.tar.gz "http://wl500g.info/attachment.php?attachmentid=8471&d=1321546056" && tar xvzf installm.tar.gz && ./install.sh  && rm install*
    Config adjustments in /opt/etc/minidlna.conf

    It has no web IF but you may try (I have not used it):
    http://minidlnawebmin.sourceforge.net/

    twonkymedia (special thanks to wpte)
    Original thread
    Wiki about install.

    Install script (that you may copy-paste as such):
    Code:
    #!/bin/sh
    #written by ecaddict, distributed (conveyed) under GPL version 3 or any later version
    
    INSTDIR=/opt/twonkymedia
    MDIR=/mnt/protected/Storage
    STARTS=/opt/etc/init.d/S90twonkymedia
    TINST=twonkymedia-asus-6.0.37.zip
    MDTD=${MDIR}/twonkymedia
    #user editable part end
    
    EXSD=/bin/sed
    DBIN=${INSTDIR}/twonkymedia
    DCONF=${INSTDIR}/twonky-config/twonkymedia.ini
    CONFD="${DCONF%\/*}"
    DBDIR=${INSTDIR}/db
    ODDIR=${INSTDIR}/online-data
    STDIR=${INSTDIR}/media-statistics
    CB=${INSTDIR}/cgi-bin
    
    ipkg update
    ipkg install libvorbis libogg libid3tag libexif libjpeg unzip
    #ipkg install flac ffmpeg imagemagick
    
    if [ ! -x "${DBIN}" ]; then
      mkdir -p ${INSTDIR} && cd ${INSTDIR}
      mkdir -p ${DBDIR}; mkdir -p ${CONFD}; mkdir -p ${ODDIR}; mkdir -p ${STDIR}
      mkdir -p ${MDTD}
      TVER=$(echo $TINST | ${EXSD} -n 's/[^0-9]*\(.*\).zip/\1/p')
      wget http://www.twonkyforum.com/downloads/${TVER}/${TINST}
      unzip twonkymedia-asus-6.*.zip
      rm -f readme.txt twonkymedia-asus-6.*.zip nas* install.nas
      chmod +x twonkym* cgi-bin/* plugins/* resources/*
      echo "/opt/bin" > ${CB}/ffmpeg.location
      echo "/opt/bin" > ${CB}/convert.location
      echo "/opt/bin" > ${CB}/flac.location
    fi
    
    cat > ${DCONF} << __EOF__
    contentbase=/
    contentdir=+A|${MDIR}
    dbdir=${DBDIR}
    onlinedir=${ODDIR}
    mediastatisticsdir=${STDIR}
    servermanagedmusicdir=${MDTD}
    servermanagedpicturedir=${MDTD}
    servermanagedvideodir=${MDTD}
    friendlyname=Twonky Asus
    httpport=9000
    enableweb=2
    scantime=60
    maxmem=5000
    startupmb=0
    norescale=1
    platform=Asus router
    suppressmenu=divAutoShare
    ip=$(nvram get lan_ipaddr)
    __EOF__
    
    cat > ${STARTS} << __EOF__
    #!/bin/sh
    #written by ecaddict, distributed (conveyed) under GPL version 3 or any later version
    
    SDIR=${INSTDIR}
    CONF=${DCONF}
    EXDL=${DBIN}
    
    NAME="\${EXDL##*/}"
    OPTS="-D -inifile \${CONF}"
    
    if [ -z "\$1" ] ; then
        case \${0##*/} in
            S??*) rc="start" ;;
            K??*) rc="stop" ;;
            *) rc="usage" ;;
        esac
    else
        rc="\$1"
    fi
    
    case "\$rc" in
        start)
            if [ ! -x \${EXDL} ];then
              echo -e "\\033[1;31mTwonkymedia is missing: "\$EXDL"\\033[0m"
              exit 1
            fi
            if [ ! -f \${CONF} ];then
              echo -e "\\033[1;31mConfig file "\$CONF" is missing\\033[0m"
              exit 2
            fi
            if [ -n "\$(pidof \$NAME)" ]; then
              echo -e "\\033[1;33m\$NAME runs already\\033[0m"
              exit 3
            fi
            echo "Starting \$NAME"
            cd \${SDIR} && \${EXDL} \${OPTS} 
            ;;
        stop)
            if [ -n "\$(pidof \$NAME)" ]; then
                echo "Stopping \$NAME"
                killall \$NAME 2> /dev/null
            fi
            ;;
        restart)
            "\$0" stop
            sleep 5
            "\$0" start
            ;;
        *)
            echo "Usage: \$0 (start|stop|restart|usage)"
            ;;
    esac
    __EOF__
    chmod u+x ${STARTS}
    ${STARTS} start
    installt.tar.gz
    My usual single line install:
    Code:
    cd /tmp && wget -O installt.tar.gz "http://wl500g.info/attachment.php?attachmentid=8451&d=1320263226" && tar xvzf installt.tar.gz && ./install.sh && rm install*
    Config adjustment in: /opt/twonkymedia/twonky-config/twonkymedia.ini
    It has a rather slow web interface during media scan, but it works:
    http://192.168.1.1:9000

    It's possible to start and run all 3 at the same time, however most probably you don't need to and it can also use quite some memory and CPU time (even with powerful routers like the RT-N16 with 128MB RAM).
    After tried what works for you, you can disable automatic start by renaming the /opt/etc/init.d/S90... script to DS90... (as only services starting with S... started). stop/start to the scripts work for manual stop/start.

    Unfortunately I cannot answer which works for you as it depends on your player and your preferences.

    Enjoy!
    Last edited by ecaddict; 18-11-2011 at 07:48. Reason: minidlna fixes

Similar Threads

  1. Essential Firmware Questions
    By vladk2k in forum WL-500gP Firmware Discussion
    Replies: 9
    Last Post: 14-10-2009, 11:10
  2. Sony TV with DLNA support
    By zerg in forum WL-500gP Firmware Discussion
    Replies: 2
    Last Post: 09-06-2009, 13:50
  3. New Oleg firmware 1.9.2.7-9 problems?
    By wpte in forum WL-500gP Firmware Discussion
    Replies: 11
    Last Post: 17-04-2008, 23:34
  4. I can't intall firmware
    By SgobbiT in forum WL-500g Q&A
    Replies: 1
    Last Post: 25-12-2006, 19:08
  5. twonky media server, network drive with oleg firmware
    By black_bottom in forum WL-HDD Q&A
    Replies: 3
    Last Post: 22-03-2006, 07:15

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •