eg-blog

Feed Rss

Archive for the ‘Subsonic on Synology DS’ Category

Subsonic 4.7 came out on Wednesday, but I am busy till Friday next Week (09-21-2012). I am afraid to tell you that you can’t expect the new package before this date. As Subsonic is a (java based) program and not just a bunch of web sides like ownCloud it requires some more work. This also is a major release and I don’t want to cause any installation bugs, so I will keep testing it a few days and install, update and deinstall it many times in every possible way, which takes a lot of time (and patience). So relax another Week, 4.7 will definitely come out in September.

btw: DSM 4.1 is running fine on my system.

Finally here it is: the new Subsonic package, including new features and many improvements.

I have scripted and tested a lot for this update and this is the result:

1. MashupMod integrated: Thanks to the great work of Subsonic Forum user MadEvil who collected many Mods and created his own MashupMod Subsonic version you now have many many new features (list and support here). As the MashupMod comes along as a stand alone, out of the box version you can either install the regular Subsonic OR the MashupMod version. This version of MashupMod is just a technical preview which might have some bugs and the registration feature is not available. If you want to use your own purchased key do not install the MashupMod, if you want to discover new features, have fun installing it 😉

2. Additional features (MashupMod / MiniSub / Subtunes) are now being downloaded during the install process (if selected) and are not included in the downloadable .spk anymore. This saves time for those who don’t want to install them but requires an Internet connection of your Diskstation during install.

3. Many bug fixes in the script. I have worked out many little bugs in the install script. Updating for example now takes 90secs less then before.

I have also talked to patters from pcloadletter.co.uk again who fixed a time-zone bug (fix version included here) and discovered shineenc which might be a great alternative for ffmpeg for transcoding audio, it is 13 times faster than lame, if we can get it to work…enough challenges for the next package.

Install Notes:

This is still a beta (especially the MashupMod version)!

When you install it: Select „fresh install“ during the install process or uninstall Subsonic before updating. Otherwise you will get a database error in Subsonic. Your database will be deleted and re-created at the first start of Subsonic. All configurations will be reseted!

Ignore the error message at the End of the installation process, just start Subsonic, I really don’t know what causes this, but Subsonic works, so its not that serious.

I have put a lot of work into this package and changed almost every script, if you encounter problems during installing or upgrading please let me know.

Now have fun testing it 😉

Download as usual via German Synology package repo (more info here)

or directly from here:

ARM version: Subsonic4.7b2-024-ARM.spk (37 MB)

x86 version:   Subsonic4.7b2-024-x86.spk (36,2 MB)

Scripts:

preinst:

#!/bin/sh

#--------Subsonic preinstall script
#--------package maintained at synology-forum.de

source /etc/profile

########################################
#check if Java is installed

if [ -z ${JAVA_HOME} ]; then
	echo "Java is not installed or not properly configured. JAVA_HOME is not defined. " > $SYNOPKG_TEMP_LOGFILE
        echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
	exit 1
fi

if [ ! -f ${JAVA_HOME}/bin/java ]; then
	echo "Java is not installed or not properly configured. The Java binary could not be located. " > $SYNOPKG_TEMP_LOGFILE
        echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
	exit 1
fi

#########################################
#check if Subsonic folder is in public folder wehn restore is selected
if [ ! -z ${install_restore} ]; then
	PUBLIC=`cat /usr/syno/etc/smb.conf | sed -r '/\/public$/!d;s/^.*path=(\/volume[0-9]{1,3}\/public).*$/\1/'`

	if [ ! -d $PUBLIC/Subsonic ]; then
		echo "Can't find a folder named 'Subsonic' in your public folder. " > $SYNOPKG_TEMP_LOGFILE
		echo "Please check your public folder and make sure there is a folder called Subsonic (with Capital S) in it. Or select 'No' if you don't want to restore anything and just install Subsonic normally" >> $SYNOPKG_TEMP_LOGFILE
		exit 1
	fi
fi

exit 0

postinst

#!/bin/sh

#--------SUBSONIC postinstall script
#--------package maintained at eg-blog.de

#variable for process ID
PID=""

subsonic_get_pid ()
{
	PID=`ps | grep java | grep subsonic | awk '{print $1}'`
}

####################################
##subsonic user settings

#create subsonic daemon user
synouser --add subsonic `${SYNOPKG_PKGDEST}/Subsonic/passgen 1 20` "Subsonic daemon user" 0 "" ""

#determine the subsonic user homedir and save that variable in the user's profile
#this is needed because librtmp needs to write a file called ~/.swfinfo
#and new users seem to inherit a HOME value of /root which they have no permissions for
SUBSONIC_HOMEDIR=`cat /etc/passwd | sed -r '/Subsonic daemon user/!d;s/^.*:Subsonic daemon user:(.*):.*$/\1/'`
su - subsonic -s /bin/sh -c "echo export HOME=${SUBSONIC_HOMEDIR} >> .profile"

#set ownership of Subsonic folder tree
chown -R subsonic ${SYNOPKG_PKGDEST}

#####################################
##other stuff

#select the right mods / version to download/install
if [ ! -z ${mashupmod_install} ]; then
	#download and install MashupMod
	wget https://dl.dropbox.com/u/33279357/synology_packages/addons/MashupMod_4.7B2030.tgz --no-check-certificate --output-document=${SYNOPKG_PKGDEST}/MashupMod.tgz
	if [ -f ${SYNOPKG_PKGDEST}/MashupMod.tgz ]; then
		tar xzf ${SYNOPKG_PKGDEST}/MashupMod.tgz -C ${SYNOPKG_PKGDEST}
	else
		echo "Error: MashupMod could not be downloaded" > $SYNOPKG_TEMP_LOGFILE
		echo "Please check the internet connection of your Diskstation" >> $SYNOPKG_TEMP_LOGFILE
		exit 1
	fi
	cp -r ${SYNOPKG_PKGDEST}/MashupMod/* ${SYNOPKG_PKGDEST}/Subsonic
	rm -r ${SYNOPKG_PKGDEST}/MashupMod
else
	#install standart Subsonic
	cp -r ${SYNOPKG_PKGDEST}/install_standart/* ${SYNOPKG_PKGDEST}/Subsonic
fi

rm -r ${SYNOPKG_PKGDEST}/install_standart

#make the Subsonic start script executable
chmod +x ${SYNOPKG_PKGDEST}/Subsonic/subsonic.sh

#####################################
##start Subsonic

#set up symlink for the DSM GUI
ln -s ${SYNOPKG_PKGDEST}/Subsonic /usr/syno/synoman/webman/3rdparty/Subsonic

#create custom temp folder so temp files can be bigger
if [ ! -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
	mkdir ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	chown -R subsonic ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
fi
#create symlink to the created directory
if [ ! -L /tmp/subsonic ]; then
	ln -s ${SYNOPKG_PKGDEST}/../../@tmp/subsonic /tmp/
fi

#start subsonic as subsonic user
su - subsonic -s /bin/sh -c /usr/syno/synoman/webman/3rdparty/Subsonic/subsonic.sh

#give it some time to start up
sleep 90

#stop subsonic
subsonic_get_pid
kill $PID
sleep 5

####################################
##download and install additional features
#MiniSub
chown -R root ${SYNOPKG_PKGDEST}
if [ ! -z ${minisub_install} ]; then
	wget https://dl.dropbox.com/u/33279357/synology_packages/addons/MiniSub_2.0.2.tgz --no-check-certificate --output-document=${SYNOPKG_PKGDEST}/MiniSub.tgz
	if [ -f ${SYNOPKG_PKGDEST}/MiniSub.tgz ]; then
		tar xzf ${SYNOPKG_PKGDEST}/MiniSub.tgz -C ${SYNOPKG_PKGDEST}
	else
		echo "Error: MiniSub could not be downloaded" > $SYNOPKG_TEMP_LOGFILE
		echo "Please check the internet connection of your Diskstation" >> $SYNOPKG_TEMP_LOGFILE
		exit 1
	fi

	cp -r ${SYNOPKG_PKGDEST}/MiniSub /usr/syno/synoman/webman/3rdparty/Subsonic/jetty/*/webapp/
	rm -r ${SYNOPKG_PKGDEST}/MiniSub
fi

#Subtunes
if [ ! -z ${subtunes_install} ]; then
	wget https://dl.dropbox.com/u/33279357/synology_packages/addons/Subtunes_0.9.4b.tgz --no-check-certificate --output-document=${SYNOPKG_PKGDEST}/Subtunes.tgz
	if [ -f ${SYNOPKG_PKGDEST}/Subtunes.tgz ]; then
		tar xzf ${SYNOPKG_PKGDEST}/Subtunes.tgz -C ${SYNOPKG_PKGDEST}
	else
		echo "Error: Subtunes could not be downloaded" > $SYNOPKG_TEMP_LOGFILE
		echo "Please check the internet connection of your Diskstation" >> $SYNOPKG_TEMP_LOGFILE
		exit 1
	fi

	cp -r ${SYNOPKG_PKGDEST}/Subtunes /usr/syno/synoman/webman/3rdparty/Subsonic/jetty/*/webapp/
	rm -r ${SYNOPKG_PKGDEST}/Subtunes
fi

chown -R subsonic ${SYNOPKG_PKGDEST}/

####################################

#delete symlink
rm /usr/syno/synoman/webman/3rdparty/Subsonic
#delete temp files
if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
	rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
fi

#########################################
#install user backup from public folder

if [ ! -z ${install_restore} ]; then
	PUBLIC=`cat /usr/syno/etc/smb.conf | sed -r '/\/public$/!d;s/^.*path=(\/volume[0-9]{1,3}\/public).*$/\1/'`
	#copy files
	cp -r $PUBLIC/Subsonic/* ${SYNOPKG_PKGDEST}/Subsonic

	#new files might not be owned by subsonic user
	chown -R subsonic ${SYNOPKG_PKGDEST}/

	#make the Subsonic start script executable
	chmod +x ${SYNOPKG_PKGDEST}/Subsonic/subsonic.sh
fi
exit 0

preupgrade:

#!/bin/sh

#--------Subsonic preupgrade script
#--------package maintained at eg-blog.de

#variable for process ID
PID=""

##############################################
#function to get the process id of Subsonic

subsonic_get_pid ()
{
   PID=`ps | grep java | grep subsonic | awk '{print $1}'`
}

###########################
#stop Subsonic if it is runing

subsonic_get_pid

if [ ! -z $PID ]; then
	kill $PID
	sleep 2
fi

if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
	rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
fi

###########################
#backup subsonic.properties and db Folder

if [ -z ${install_restore} ]; then
	if [ ! -d ${SYNOPKG_PKGDEST}/../subsonic_update_backup ]; then
		mkdir ${SYNOPKG_PKGDEST}/../subsonic_update_backup
		cp ${SYNOPKG_PKGDEST}/Subsonic/subsonic.properties ${SYNOPKG_PKGDEST}/Subsonic/*.index ${SYNOPKG_PKGDEST}/../subsonic_update_backup/
		cp -r ${SYNOPKG_PKGDEST}/Subsonic/db ${SYNOPKG_PKGDEST}/../subsonic_update_backup
		cp -r ${SYNOPKG_PKGDEST}/Subsonic/lucene ${SYNOPKG_PKGDEST}/../subsonic_update_backup
		cp -r ${SYNOPKG_PKGDEST}/Subsonic/thumbs ${SYNOPKG_PKGDEST}/../subsonic_update_backup
	fi
fi

exit 0

postupgrade:

#!/bin/sh

#--------SUBSONIC postupgrade script
#--------package maintained at eg-blog.de

###############################
#restore subsonic db index and settings
if [ ! -z ${normal_update} ]; then
	cp -r ${SYNOPKG_PKGDEST}/../subsonic_update_backup/* ${SYNOPKG_PKGDEST}/Subsonic/
fi

#remove backup folder
#remove the next lines to keep a backup in the @appstore folder
if [ -d ${SYNOPKG_PKGDEST}/../subsonic_update_backup ]; then
	rm -r ${SYNOPKG_PKGDEST}/../subsonic_update_backup
fi

#subsonic may not own all new files
chown -R subsonic ${SYNOPKG_PKGDEST}/

#make the Subsonic start script executable
chmod +x ${SYNOPKG_PKGDEST}/Subsonic/subsonic.sh

exit 0

preuninst:

#!/bin/sh

#--------SUBSONIC preuninstall script
#--------package maintained at eg-blog.de

###############################################
##stop Subsonic if it is running

PID=`ps | grep java | grep subsonic | awk '{print $1}'`
if [ -z $PID ]; then
	sleep 1
else
	kill $PID
	sleep 2
	if [ -d /usr/syno/synoman/webman/3rdparty/Subsonic ]; then
		rm /usr/syno/synoman/webman/3rdparty/Subsonic
	fi

	if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	fi
fi

################################################
#create a backup in public folder in public folder
if [ ! -z ${uninstall_backup} ]; then
	PUBLIC=`cat /usr/syno/etc/smb.conf | sed -r '/\/public$/!d;s/^.*path=(\/volume[0-9]{1,3}\/public).*$/\1/'`
	if [ ! -d $PUBLIC/Subsonic ]; then
		mkdir $PUBLIC/Subsonic
	fi

	cp ${SYNOPKG_PKGDEST}/Subsonic/subsonic.properties *.index $PUBLIC/Subsonic
	cp -r ${SYNOPKG_PKGDEST}/Subsonic/db $PUBLIC/Subsonic
	cp -r ${SYNOPKG_PKGDEST}/Subsonic/lucene $PUBLIC/Subsonic
	cp -r ${SYNOPKG_PKGDEST}/Subsonic/thumbs $PUBLIC/Subsonic
fi

exit 0

postuninst:

#!/bin/sh

#--------SUBSONIC postuninstall script
#--------package maintained at eg-blog.de

#remove subsonic daemon user
synouser --del subsonic

#remove DSM icon symlink
if [ -L /usr/syno/synoman/webman/3rdparty/Subsonic ]; then
	rm /usr/syno/synoman/webman/3rdparty/Subsonic
fi

#remove temp symlink
rm /tmp/subsonic

exit 0

start-stop-status:

#!/bin/sh

#--------Subsonic start-stop-status script
#--------package maintained at eg-blog.de

#variable for process ID
PID=""

##############################################
#function to get the process id of Subsonic

subsonic_get_pid ()
{
	PID=`ps | grep java | grep subsonic | awk '{print $1}'`
}

case "$1" in
   start)
	  ###---copied from patters start-stop-status.sh of his crashplan proe package---
	  DAEMON_ID="${SYNOPKG_PKGNAME} daemon user"
	  DAEMON_HOME="`cat /etc/passwd | grep "${DAEMON_ID}" | cut -f6 -d':'`"

	  #set the current timezone for Java so that log timestamps are accurate
	  #we need to use the modern timezone names so that Java can figure out DST
	  SYNO_TZ=`cat /etc/synoinfo.conf | grep timezone | cut -f2 -d'"'`
	  SYNO_TZ=`grep "^${SYNO_TZ}" /usr/share/zoneinfo/Timezone/tzname | sed -e "s/^.*= //"`
	  grep "^export TZ" ${DAEMON_HOME}/.profile > /dev/null \
	  && sed -i "s%^export TZ=.*$%export TZ='${SYNO_TZ}'%" ${DAEMON_HOME}/.profile \
	  ###---end of copy---------------------------------------------------------------

	  #set up symlinks for the DSM GUI icon
	  #Subsonic main
	  if [ -d /usr/syno/synoman/webman/3rdparty ]; then
		ln -s ${SYNOPKG_PKGDEST}/Subsonic/ /usr/syno/synoman/webman/3rdparty/Subsonic
		#MiniSub
		if [ -d ${SYNOPKG_PKGDEST}/Subsonic/jetty/*/webapp/MiniSub ]; then
			ln -s ${SYNOPKG_PKGDEST}/Subsonic/jetty/*/webapp/MiniSub /usr/syno/synoman/webman/3rdparty/MiniSub
		fi
		#Subtunes
		if [ -d ${SYNOPKG_PKGDEST}/Subsonic/jetty/*/webapp/Subtunes ]; then
			ln -s ${SYNOPKG_PKGDEST}/Subsonic/jetty/*/webapp/Subtunes /usr/syno/synoman/webman/3rdparty/Subtunes
		fi
	  fi
      #create custom temp folder so temp files can be bigger
	  if [ ! -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		mkdir ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
		chown -R subsonic ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	  fi
	  #create symlink to the created directory
	  if [ ! -L /tmp/subsonic ]; then
		ln -s ${SYNOPKG_PKGDEST}/../../@tmp/subsonic /tmp/
	  fi
	  # starting subsonic as subsonic daemon user
      su - subsonic -s /bin/sh -c /usr/syno/synoman/webman/3rdparty/Subsonic/subsonic.sh
      sleep 5
	  exit 0
   ;;
   stop)
      #stop subsonic
	  subsonic_get_pid
      kill $PID
      sleep 2
	  #delete Symlinks and DSM icon
	  if [ -L /usr/syno/synoman/webman/3rdparty/Subsonic ]; then
		rm /usr/syno/synoman/webman/3rdparty/Subsonic
	  fi
	  if [ -L /usr/syno/synoman/webman/3rdparty/MiniSub ]; then
		rm /usr/syno/synoman/webman/3rdparty/MiniSub
	  fi
	  if [ -L /usr/syno/synoman/webman/3rdparty/Subtunes ]; then
		rm /usr/syno/synoman/webman/3rdparty/Subtunes
	  fi
	  if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	  fi
	  exit 0
   ;;
   status)
      subsonic_get_pid
      if [ -z  $PID ]; then
	  #Subsonic is not running
		exit 1
	  else
	  #subsonic is running
		exit 0
      fi
   ;;
   log)
	  echo "${SYNOPKG_PKGDEST}/subsonic.log"
	  exit 0
   ;;
esac

 

install_uifile:

[{
	"step_title": "Restore Backup",
	"items":
	[{
		"type": "singleselect",
		"desc": "Would you like to restore a backup of Subsonic? Create a folder with all relevant files in it, name it Subsonic (with capital S)and place it into your public folder",
		"subitems":
		[{
			"key": "No",
			"desc": "No"
		 },
		 {
			"key": "install_restore",
			"desc": "Yes"
		}]
	}]
},
{
	"step_title": "Add-ons / Mods",
	"items":
	[{
		"type": "multiselect",
		"desc": "Which mods or additional features would you like to download and install? Requires internet connection of your Diskstation",
		"subitems":
		[{
			"key": "minisub_install",
			"desc": "MiniSub html5 web interface (245 KB)"
		},
		{
			"key": "subtunes_install",
			"desc": "Subtunes html5 web interface (3,8 MB)"
		},
		{
			"key": "mashupmod_install",
			"desc": "Mashupmod (29,2MB) (beta/preview: If you don't know, what you are doing, don't install it! More info at eg-blog.de)"
		}]
	}]
}]

upgrade_uifile

[{
	"step_title": "Choose update mode",
	"items":
	[{
		"type": "singleselect",
		"desc": "A previously installed version of Subsonic has been detected. Which update mode would you like to perform?",
		"subitems":
		[{
			"key": "normal_update",
			"desc": "Just update normally (library will be kept)"
		 },
		 {
			"key": "install_restore",
			"desc": "Restore a previously made backup from /public/Subsonic folder"
		 },
		 {
			"key": "install_fresh",
			"desc": "Preform a fresh install. All previously created files of Subsonic will be deleted!"
		}]
	}]
},
{
	"step_title": "Add-ons / Mods",
	"items":
	[{
		"type": "multiselect",
		"desc": "Which mods or additional features would you like to download and install? Requires internet connection of your Diskstation",
		"subitems":
		[{
			"key": "minisub_install",
			"desc": "MiniSub html5 web interface (245 KB)"
		},
		{
			"key": "subtunes_install",
			"desc": "Subtunes html5 web interface (3,8 MB)"
		},
		{
			"key": "mashupmod_install",
			"desc": "Mashupmod (29,2MB) (beta/preview: If you don't know, what you are doing, don't install it! More info at eg-blog.de)"
		}]
	}]
}]

uninstall_uifile:

[{
	"step_title": "Create Backup",
	"items":
	[{
		"type": "singleselect",
		"desc": "Would you like to create a backup of Subsonic in the public folder?",
		"subitems":
		[{
			"key": "no",
			"desc": "No"
		},
		{
			"key": "uninstall_backup",
			"desc": "Yes"
		}]
	}]
}]

 
INFO

package="Subsonic"
version="4.7b2-024"
description="Subsonic is a free, web-based media streamer, providing ubiquitous access to your music."
maintainer="Subsonic is developed by Sindre Mehus (subsonic.org), MiniSub is developed by tsquillario (forum.subsonic.org), Subtunes is develpoed by mattgoldspink1 (code.google.com/p/subtunes/), MashupMod is developed by MadEvil (forum.subsonic.org), Synology package is maintained at eg-blog.de"
arch="88f6281 88f6282"
adminport="4040"
adminurl="/"
firmware="3.1-1594"
helpurl="http://eg-blog.de"
report_url="http://eg-blog.de"
package_icon="base 64 code, too long to post it here"
install_reboot="yes"

 
application.cfg (Subsonic):

text = Subsonic
description = Subsonic Music Streamer
icon_16 = images/icon_16.png
icon_32 = images/icon_32.png
type = popup
protocol = http
port = 4040
path = /
adminonly = false

application.cfg (MiniSub):

text = MiniSub
description = Subsonic Music Streamer - MiniSub html5 interface
icon_16 = images/icon_16.png
icon_32 = images/icon_32.png
type = popup
protocol = http
port = 4040
path = /MiniSub/
adminonly = false

application.cfg (Subtunes):

text = Subtunes
description = Subsonic Music Streamer - Subtunes html5 interface
icon_16 = images/icon_16.png
icon_32 = images/icon_32.png
type = popup
protocol = http
port = 4040
path = /Subtunes/
adminonly = false

 
subsonic.sh (changed)

#!/bin/sh

###################################################################################
# Shell script for starting Subsonic.  See http://subsonic.org.
#
# Author: Sindre Mehus
###################################################################################

###added by gigon, see eg-blog.de for details---------------------------
RAM=$((`free | grep Mem: | sed -e "s/^ *Mem: *\([0-9]*\).*$/\1/"`/1024))
if [ $RAM -le 128 ]; then
    SUBSONIC_MAX_MEMORY=80
elif [ $RAM -le 256 ]; then
    SUBSONIC_MAX_MEMORY=192
elif [ $RAM -gt 256 ]; then
	SUBSONIC_MAX_MEMORY=384
fi
###---------------------------------------------------------------------

SUBSONIC_HOME=/usr/syno/synoman/webman/3rdparty/Subsonic
SUBSONIC_HOST=0.0.0.0
SUBSONIC_PORT=4040
SUBSONIC_HTTPS_PORT=4041
SUBSONIC_CONTEXT_PATH=/

#remove the # in the next line if you want to set the max memory manually
#SUBSONIC_MAX_MEMORY=100

SUBSONIC_PIDFILE=
SUBSONIC_DEFAULT_MUSIC_FOLDER=/volume1/music
SUBSONIC_DEFAULT_PODCAST_FOLDER=/volume1/music/Podcast
SUBSONIC_DEFAULT_PLAYLIST_FOLDER=/volume1/music/playlists

quiet=0

usage() {
    echo "Usage: subsonic.sh [options]"
    echo "  --help               This small usage guide."
    echo "  --home=DIR           The directory where Subsonic will create files."
    echo "                       Make sure it is writable. Default: /var/subsonic"
    echo "  --host=HOST          The host name or IP address on which to bind Subsonic."
    echo "                       Only relevant if you have multiple network interfaces and want"
    echo "                       to make Subsonic available on only one of them. The default value"
    echo "                       will bind Subsonic to all available network interfaces. Default: 0.0.0.0"
    echo "  --port=PORT          The port on which Subsonic will listen for"
    echo "                       incoming HTTP traffic. Default: 4040"
    echo "  --https-port=PORT    The port on which Subsonic will listen for"
    echo "                       incoming HTTPS traffic. Default: 0 (disabled)"
    echo "  --context-path=PATH  The context path, i.e., the last part of the Subsonic"
    echo "                       URL. Typically '/' or '/subsonic'. Default '/'"
    echo "  --max-memory=MB      The memory limit (max Java heap size) in megabytes."
    echo "                       Default: 100"
    echo "  --pidfile=PIDFILE    Write PID to this file. Default not created."
    echo "  --quiet              Don't print anything to standard out. Default false."
    echo "  --default-music-folder=DIR    Configure Subsonic to use this folder for music.  This option "
    echo "                                only has effect the first time Subsonic is started. Default '/var/music'"
    echo "  --default-podcast-folder=DIR  Configure Subsonic to use this folder for Podcasts.  This option "
    echo "                                only has effect the first time Subsonic is started. Default '/var/music/Podcast'"
    echo "  --default-playlist-folder=DIR Configure Subsonic to use this folder for playlists.  This option "
    echo "                                only has effect the first time Subsonic is started. Default '/var/playlists'"
    exit 1
}

# Parse arguments.
while [ $# -ge 1 ]; do
    case $1 in
        --help)
            usage
            ;;
        --home=?*)
            SUBSONIC_HOME=${1#--home=}
            ;;
        --host=?*)
            SUBSONIC_HOST=${1#--host=}
            ;;
        --port=?*)
            SUBSONIC_PORT=${1#--port=}
            ;;
        --https-port=?*)
            SUBSONIC_HTTPS_PORT=${1#--https-port=}
            ;;
        --context-path=?*)
            SUBSONIC_CONTEXT_PATH=${1#--context-path=}
            ;;
        --max-memory=?*)
            SUBSONIC_MAX_MEMORY=${1#--max-memory=}
            ;;
        --pidfile=?*)
            SUBSONIC_PIDFILE=${1#--pidfile=}
            ;;
        --quiet)
            quiet=1
            ;;
        --default-music-folder=?*)
            SUBSONIC_DEFAULT_MUSIC_FOLDER=${1#--default-music-folder=}
            ;;
        --default-podcast-folder=?*)
            SUBSONIC_DEFAULT_PODCAST_FOLDER=${1#--default-podcast-folder=}
            ;;
        --default-playlist-folder=?*)
            SUBSONIC_DEFAULT_PLAYLIST_FOLDER=${1#--default-playlist-folder=}
            ;;
        *)
            usage
            ;;
    esac
    shift
done

# Use JAVA_HOME if set, otherwise assume java is in the path.
JAVA=java
if [ -e "${JAVA_HOME}" ]
    then
    JAVA=${JAVA_HOME}/bin/java
fi

# Create Subsonic home directory.
mkdir -p ${SUBSONIC_HOME}
LOG=${SUBSONIC_HOME}/subsonic_sh.log
rm -f ${LOG}

cd $(dirname $0)
if [ -L $0 ] && ([ -e /bin/readlink ] || [ -e /usr/bin/readlink ]); then
    cd $(dirname $(readlink $0))
fi

${JAVA} -Xmx${SUBSONIC_MAX_MEMORY}m \
  -Dsubsonic.home=${SUBSONIC_HOME} \
  -Dsubsonic.host=${SUBSONIC_HOST} \
  -Dsubsonic.port=${SUBSONIC_PORT} \
  -Dsubsonic.httpsPort=${SUBSONIC_HTTPS_PORT} \
  -Dsubsonic.contextPath=${SUBSONIC_CONTEXT_PATH} \
  -Dsubsonic.defaultMusicFolder=${SUBSONIC_DEFAULT_MUSIC_FOLDER} \
  -Dsubsonic.defaultPodcastFolder=${SUBSONIC_DEFAULT_PODCAST_FOLDER} \
  -Dsubsonic.defaultPlaylistFolder=${SUBSONIC_DEFAULT_PLAYLIST_FOLDER} \
  -Djava.awt.headless=true \
  -verbose:gc \
  -jar subsonic-booter-jar-with-dependencies.jar > ${LOG} 2>&1 &

# Write pid to pidfile if it is defined.
if [ $SUBSONIC_PIDFILE ]; then
    echo $! > ${SUBSONIC_PIDFILE}
fi

if [ $quiet = 0 ]; then
    echo Started Subsonic [PID $!, ${LOG}]
fi

Hi guys (and girls if there are some),

The 2nd beta of Subsonic 4.7 is about to come. It will be more a bux-fixing-release instead of bringing new killer features.

But thats only for Subsonic itself, the package I am currently working on will (hopefully) include the huge Mashup Mod by Subsonic forum user MadEvil.

It is a very big mod package (contains more than 20 individual mods) and I got it running on my DS211+. Now it is all about integrating it into the installation process of the Synology package.

More Information about the Mashup Mod: http://forum.subsonic.org/forum/viewtopic.php?f=8&t=9187 

A preview gallery : http://imgur.com/a/yWZaJ/embed#0

Hi again today,

The Subsonic 4.7 beta 1 package is finally ready. As with every beta there may be some errors or bugs, if you don’t want to risk anything stay with 4.6 and wait for the 4.7 stable release.

What is new?

  • Subsonic 4.7 beta 1 included, infos here
  • Included html5 interfaces MiniSub and Subtunes. You can choose which one you want to install during the installation, upgrade process.
  • Included DSM links to the html5 interfaces
  • I have included an auto-RAM-detection part to the subsonic.sh so you don’t have to configure it by yourself. I copied this from the „serviio-wrapper.sh“ by patters, click here to see the original script. It now sets the max Java heap size automatically depending on the amount of RAM available.
  • Enabled https on port 4041 for save streaming (don’t forget to change your firewall settings for Internet streaming). If you don’t want to have https enabled change line 12 in the /volumeX/@appstore/Subsonic/subsonic.sh to SUBSONIC_HTTPS_PORT=0.
  • minor bug fixes

Upgrading / installation works like before (more info here). If you want to be 100% sure not to lose your database, copy the Subsonic folder to a save place or use the subsonic-backup-creator… Your music folder will not be touched.

Download and install it automatically from the germany Synology package repo (more info here)

or directly from here and install it manually:

ARM version: Subsonic4.7b1-023-ARM.spk (37 MB)

x86 version:   Subsonic4.7b1-023-x86.spk (36,2 MB)

Scripts:

(mehr …)

Hi guys,

Subsonic 4.7 beta 1 is out and I am working on a new package, which will also include Subtunes and MiniSub html5 interface.

Here is a link to the ownCloud 4 release schedule. The new version will come out on Tuesday and I will make a package as soon as I can (I have to work a lot these days…).

Hello everybody and happy easter, I’ve got a little gift for you 😉

Thanks to this comment on my last post I have included a html5 interface called MiniSub, developed by tsquillario from the subsonic forum.

Now you can play your music on every device that supports html5 (for example iOS devices) right out of your browser without installing anything.

To access the html5 interface:

  1. Type in your login name and password
  2. Click „Remember me“
  3. login to your standard Subsonic interface
  4. change the url after the 4040 add /html5/ (hit Enter)
  5. If you don’t want to change the url everytime you can set a bookmark by pressing ctrl+b
  6. If you are not logged in you will be redirected to the standard interface. Just log in (hit „remember me“ to avoid further redirections) and go to the /html5/ directory again.

edit: I made myself a second icon for MiniSub in the DSM (will be included in next release), so I don’t have to change the url all the time. If you know how to connect to your Diskstation via ssh it is quite easy to get yourself an icon, too.

  1. download and unrar the files from the minisub_icon.rar(14KB) to your DS e.g. public folder
  2. Connect to your DS via ssh
  3. type
    mkdir /usr/syno/synoman/webman/3rdparty/MiniSub/
  4. copy the files to the directory e.g.
    cp -r /volume1/public/minisub_icon/* /usr/syno/synoman/webman/3rdparty/MiniSub/
  5. login to your DS
  6. note: the icon will only show up if Subsonic is running

And this is how it looks like on the PC:

and on the iPad

 It will be uploaded to the package sources soon until the you can download it manually:

Subsonic4.6-022-ARM.spk

Subsonic4.6.022-x86.spk

Scripts

(mehr …)

I’ve just updated my DS211+ to DSM 4.0-2198. Afterwards I recognized that I was listening to a pod cast via Subsonic and it didn’t stop while upgrading!

Now, that I’ve been playing around a bit I can say that the package is fully compatible to the new DSM version, so if you haven’t done already: feel free to upgrade.

It looks great and works well. The CloudStation is something I’ve really been waiting for. It was a bit tricky to get ColudStation and Dropbox syncing the same Directory but now it works fine =).

I’ve just added the „bromolow“ and „cedarview“ to the „arch“ line of the INFO file. Now it is compatible to the new big x86 DiskStations.

I did not change anything else (the ARM package is not affected).

Download:

Subsonic4.6-021-x86.spk

First of all, again: If you already have a Subsonic package installed and running fine: Stay where you are!

Subsonic itself is the same and you might loose your settings during update, I still don’t know when and why this happens, the error is not really reproducible.

I’ve changed the installation/update/uninstallation procedure and included a backup and restore option.

  • While installing, you can select whether to restore a Backup of Subsonic (which was created during uninstall or with the Subsonic backup creator) or to perform a fresh install. To restore create a folder named Subsonic (with capital S) in your public folder. If you haven’t got a public folder (on multi-bay-nas) create a new shared folder in the DSM. Now place the backup-ed files into the Subsonic folder.
  • While updating you can select whether to update normally or restore a backup from the public folder.
  • While uninstalling you can select whether to create a backup in the public folder or not. (You don’t have to do anything to the folder if you want to restore it afterwards)

There is also a new ffmpeg version included, but still no x264 support,. If you are a pro and can compile such things properly or if you’ve got a compiled version for ARM or x86 please let me know, thanks ;).

Thanks to patters I’ve included timezone support, so the log files should have the correct time now.

The package will be added to both package sources soon.

You can manually download them here:

Subsonic4.6-020-ARM.spk (32MB)

Subsonic4.6-020-x86.spk (32MB)

Scripts

INFO
package="Subsonic"
version="4.6-020"
description="Subsonic is a free, web-based media streamer, providing ubiquitous access to your music."
maintainer="Sindre Mehus, Synology package maintained at eg-blog.de"
arch="88f6281 88f6282"
adminport="4040"
adminurl="/"
firmware="3.1-1594"
helpurl="http://eg-blog.de"
package_icon="package_icon_in_base64_code_too_long_to_post_it_here"
install_reboot="yes"
preinst
#!/bin/sh

#--------Subsonic preinstall script
#--------package maintained at synology-forum.de

source /etc/profile

########################################
#check if Java is installed

if [ -z ${JAVA_HOME} ]; then
	echo "Java is not installed or not properly configured. JAVA_HOME is not defined. " > $SYNOPKG_TEMP_LOGFILE
        echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
	exit 1
fi

if [ ! -f ${JAVA_HOME}/bin/java ]; then
	echo "Java is not installed or not properly configured. The Java binary could not be located. " > $SYNOPKG_TEMP_LOGFILE
        echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> $SYNOPKG_TEMP_LOGFILE
	exit 1
fi

#########################################
#check if Subsonic folder is in public folder wehn restore is selected
if [ ! -z ${install_restore} ]; then
	PUBLIC=`cat /usr/syno/etc/smb.conf | sed -r '/\/public$/!d;s/^.*path=(\/volume[0-9]{1,3}\/public).*$/\1/'`

	if [ ! -d $PUBLIC/Subsonic ]; then
		echo "Can't find a folder named 'Subsonic' in your public folder. " > $SYNOPKG_TEMP_LOGFILE
		echo "Please check your public folder and make sure there is a folder called Subsonic (with Capital S) in it. Or select 'No' if you don't want to restore anything and just install Subsonic normally" >> $SYNOPKG_TEMP_LOGFILE
		exit 1
	fi
fi

exit 0
postinst
#!/bin/sh

#--------SUBSONIC postinstall script
#--------package maintained at eg-blog.de

#variable for process ID
PID=""

subsonic_get_pid ()
{
	PID=`ps | grep java | grep subsonic | awk '{print $1}'`
}

####################################
#subsonic user settings

#create subsonic daemon user
synouser --add subsonic `${SYNOPKG_PKGDEST}/passgen 1 20` "Subsonic daemon user" 0 "" ""

#determine the subsonic user homedir and save that variable in the user's profile
#this is needed because librtmp needs to write a file called ~/.swfinfo
#and new users seem to inherit a HOME value of /root which they have no permissions for
SUBSONIC_HOMEDIR=`cat /etc/passwd | sed -r '/Subsonic daemon user/!d;s/^.*:Subsonic daemon user:(.*):.*$/\1/'`
su - subsonic -s /bin/sh -c "echo export HOME=${SUBSONIC_HOMEDIR} >> .profile"

#####################################
#other stuff

#make the Subsonic start script executable
chmod +x ${SYNOPKG_PKGDEST}/subsonic.sh

#set ownership of Subsonic folder tree
chown -R subsonic ${SYNOPKG_PKGDEST}

#########################################
#install user backup from public folder

if [ ! -z ${install_restore} ]; then
	PUBLIC=`cat /usr/syno/etc/smb.conf | sed -r '/\/public$/!d;s/^.*path=(\/volume[0-9]{1,3}\/public).*$/\1/'`
	if [ ! -d $PUBLIC/Subsonic ]; then
		echo "Can't find a folder named 'Subsonic' in your public folder." > $SYNOPKG_TEMP_LOGFILE
		echo "Please check your public folder and make sure there is a folder called Subsonic (with Capital S) in it. Or select 'No' if you don't want to restore anything and just install Subsonic normally" >> $SYNOPKG_TEMP_LOGFILE
		exit 1
	else
		#set up symlink for the DSM GUI
		ln -s ${SYNOPKG_PKGDEST}/ /usr/syno/synoman/webman/3rdparty/Subsonic

		#create custom temp folder so temp files can be bigger
		if [ ! -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
			mkdir ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
			chown -R subsonic ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
		fi
		#create symlink to the created directory
		if [ ! -L /tmp/subsonic ]; then
			ln -s ${SYNOPKG_PKGDEST}/../../@tmp/subsonic /tmp/
		fi

		#start subsonic as subsonic user
		su - subsonic -s /bin/sh -c /usr/syno/synoman/webman/3rdparty/Subsonic/subsonic.sh

		#give it some time to start up
		sleep 90

		#stop subsonic
		subsonic_get_pid
		kill $PID
		sleep 5

		#delete symlink
		rm /usr/syno/synoman/webman/3rdparty/Subsonic

		#delete temp files
		if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
			rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
		fi

		#restart Web Station to clear webserver caches
		if [ -f /usr/syno/etc/rc.d/S97apache-user.sh ]; then
			/usr/syno/etc/rc.d/S97apache-user.sh restart
		fi

		#copy files
		cp -r $PUBLIC/Subsonic/* ${SYNOPKG_PKGDEST}/

		#new files might not be owned by subsonic user
		chown -R subsonic ${SYNOPKG_PKGDEST}/

		#make the Subsonic start script executable
		chmod +x ${SYNOPKG_PKGDEST}/subsonic.sh
	fi
fi
exit 0
preupgrade
#!/bin/sh

#--------Subsonic preupgrade script
#--------package maintained at eg-blog.de

#variable for process ID
PID=""

##############################################
#function to get the process id of Subsonic

subsonic_get_pid ()
{
   PID=`ps | grep java | grep subsonic | awk '{print $1}'`
}

###########################
#stop Subsonic if it is runing

subsonic_get_pid

if [ -z $PID ]; then
	kill $PID
	sleep 2
fi

if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
	rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
fi

###########################
#backup subsonic.properties and db Folder

if [ -z ${update_restore} ]; then
	if [ ! -d ${SYNOPKG_PKGDEST}/../subsonic_update_backup ]; then
		mkdir ${SYNOPKG_PKGDEST}/../subsonic_update_backup
		cp ${SYNOPKG_PKGDEST}/subsonic.properties ${SYNOPKG_PKGDEST}/*.index ${SYNOPKG_PKGDEST}/../subsonic_update_backup/
		cp -r ${SYNOPKG_PKGDEST}/db ${SYNOPKG_PKGDEST}/../subsonic_update_backup
		cp -r ${SYNOPKG_PKGDEST}/lucene ${SYNOPKG_PKGDEST}/../subsonic_update_backup
		cp -r ${SYNOPKG_PKGDEST}/thumbs ${SYNOPKG_PKGDEST}/../subsonic_update_backup
	fi
fi

exit 0
postupgrade
#!/bin/sh

#--------SUBSONIC postupgrade script
#--------package maintained at eg-blog.de

#variable for process ID
PID=""

##############################################
#function to get the process id of Subsonic

subsonic_get_pid ()
{
	PID=`ps | grep java | grep subsonic | awk '{print $1}'`
}

################################
#make it working again

#restart Web Station to clear webserver caches
if [ -f /usr/syno/etc/rc.d/S97apache-user.sh ]; then
	/usr/syno/etc/rc.d/S97apache-user.sh restart
fi

###############################
#start and stop subsonic for first initialisation

#set up symlink for the DSM GUI
ln -s ${SYNOPKG_PKGDEST}/ /usr/syno/synoman/webman/3rdparty/Subsonic

#create custom temp folder so temp files can be bigge
if [ ! -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
	mkdir ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	chown -R subsonic ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
fi

#create symlink to the created directory
if [ ! -L /tmp/subsonic ]; then
	ln -s ${SYNOPKG_PKGDEST}/../../@tmp/subsonic /tmp/
fi

#make the Subsonic start script executable
chmod +x ${SYNOPKG_PKGDEST}/subsonic.sh

#subsonic daemon user has been deleted and recreated so we need to reset ownership (new UID)
chown -R subsonic ${SYNOPKG_PKGDEST}/

#start subsonic as subsonic user
su - subsonic -s /bin/sh -c /usr/syno/synoman/webman/3rdparty/Subsonic/subsonic.sh

#give it some time to start up
sleep 90

#stop subsonic
subsonic_get_pid
kill $PID
sleep 5

#delete Symlink
rm /usr/syno/synoman/webman/3rdparty/Subsonic

#delete temp files
if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
	rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
fi

#restart Web Station to clear webserver caches
if [ -f /usr/syno/etc/rc.d/S97apache-user.sh ]; then
	/usr/syno/etc/rc.d/S97apache-user.sh restart
fi

###############################
#restore subsonic db index and settings
if [ ! -z ${update_restore} ]; then
	PUBLIC=`cat /usr/syno/etc/smb.conf | sed -r '/\/public$/!d;s/^.*path=(\/volume[0-9]{1,3}\/public).*$/\1/'`
	if [ ! -d $PUBLIC/Subsonic ]; then
		echo "Can't find a folder named 'Subsonic' found in your public folder." > $SYNOPKG_TEMP_LOGFILE
		echo "Please check your public folder and make sure there is a folder called Subsonic (with Capital S) in it. Or select 'No' if you don't want to restore anything and just install Subsonic normally" >> $SYNOPKG_TEMP_LOGFILE
		exit 1
	else
		cp -r $PUBLIC/Subsonic/* ${SYNOPKG_PKGDEST}/
	fi
else
	cp -r ${SYNOPKG_PKGDEST}/../subsonic_update_backup/* ${SYNOPKG_PKGDEST}/

	#remove backup folder
	#remove the next lines to keep a backup in the @appstore folder
	if [ -d ${SYNOPKG_PKGDEST}/../subsonic_update_backup ]; then
		rm -r ${SYNOPKG_PKGDEST}/../subsonic_update_backup
	fi
fi
#subsonic may not own all new files
chown -R subsonic ${SYNOPKG_PKGDEST}/

#make the Subsonic start script executable
chmod +x ${SYNOPKG_PKGDEST}/subsonic.sh

exit 0
preuninst
#!/bin/sh

#--------SUBSONIC preuninstall script
#--------package maintained at eg-blog.de

#variable for process ID
PID=""

##############################################
#function to get the process id of Subsonic

subsonic_get_pid ()
{
	PID=`ps | grep java | grep subsonic | awk '{print $1}'`
}

subsonic_get_pid

if [ -z $PID ]; then
	sleep 1
else
	kill $PID
	sleep 2
	if [ -d /usr/syno/synoman/webman/3rdparty/Subsonic ]; then
		rm /usr/syno/synoman/webman/3rdparty/Subsonic
	fi

	if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	fi
fi

################################################
#create a backup in public folder in public folder
if [ ! -z ${uninstall_backup} ]; then
	PUBLIC=`cat /usr/syno/etc/smb.conf | sed -r '/\/public$/!d;s/^.*path=(\/volume[0-9]{1,3}\/public).*$/\1/'`
	if [ ! -d $PUBLIC/Subsonic ]; then
		mkdir $PUBLIC/Subsonic
	fi

	cp ${SYNOPKG_PKGDEST}/subsonic.properties *.index $PUBLIC/Subsonic
	cp -r ${SYNOPKG_PKGDEST}/db $PUBLIC/Subsonic
	cp -r ${SYNOPKG_PKGDEST}/lucene $PUBLIC/Subsonic
	cp -r ${SYNOPKG_PKGDEST}/thumbs $PUBLIC/Subsonic
fi

exit 0
postuninst
#!/bin/sh

#--------SUBSONIC postuninstall script
#--------package maintained at eg-blog.de

#remove subsonic daemon user
synouser --del subsonic

#remove DSM icon symlink
if [ -d /usr/syno/synoman/webman/3rdparty/Subsonic ]; then
	rm /usr/syno/synoman/webman/3rdparty/Subsonic
fi

#remove temp symlink
rm /tmp/subsonic

exit 0
start-stop-status
#!/bin/sh

#--------Subsonic start-stop-status script
#--------package maintained at eg-blog.de

#variable for process ID
PID=""

##############################################
#function to get the process id of Subsonic

subsonic_get_pid ()
{
	PID=`ps | grep java | grep subsonic | awk '{print $1}'`
}

case "$1" in
   start)
	  SUBSONIC_HOMEDIR=`cat /etc/passwd | sed -r '/Subsonic daemon user/!d;s/^.*:Subsonic daemon user:(.*):.*$/\1/'`

	  #set the current timezone for Java so that Subsonic log timestamps are accurate
      TZ=`cat /etc/TZ`
      grep "^export TZ" $SUBSONIC_HOMEDIR/.profile > /dev/null \
      && sed -i "s%^export TZ.*$%export TZ="$TZ"%" $SUBSONIC_HOMEDIR/.profile \
      || echo export TZ=${TZ} >> $SUBSONIC_HOMEDIR/.profile

	  #set up symlink for the DSM GUI icon
	  if [ -d /usr/syno/synoman/webman/3rdparty ]; then
		ln -s ${SYNOPKG_PKGDEST}/ /usr/syno/synoman/webman/3rdparty/Subsonic
	  fi
      #create custom temp folder so temp files can be bigger
	  if [ ! -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		mkdir ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
		chown -R subsonic ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	  fi
	  #create symlink to the created directory
	  if [ ! -L /tmp/subsonic ]; then
		ln -s ${SYNOPKG_PKGDEST}/../../@tmp/subsonic /tmp/
	  fi
	  # starting subsonic as subsonic daemon user
      su - subsonic -s /bin/sh -c /usr/syno/synoman/webman/3rdparty/Subsonic/subsonic.sh
      sleep 5
	  exit 0
   ;;
   stop)
      #stop subsonic
	  subsonic_get_pid
      kill $PID
      sleep 2
	  #delete Symlink and DSM icon
	  if [ -d /usr/syno/synoman/webman/3rdparty/Subsonic ]; then
		rm /usr/syno/synoman/webman/3rdparty/Subsonic
	  fi

	  if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
		rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
	  fi
   ;;
   status)
      subsonic_get_pid
      if [ -z  $PID ]; then
	  #Subsonic is not running
		exit 1
	  else
	  #subsonic is running
		exit 0
      fi
   ;;
   log)
	  echo "${SYNOPKG_PKGDEST}/subsonic.log"
	  exit 0
   ;;
esac
install_uifile
[{
	"step_title": "Restore Backup",
	"items":
	[{
		"type": "singleselect",
		"desc": "Would you like to restore a backup of Subsonic? Create a folder with all relevant files in it, name it Subsonic (with capital S)and place it into your public folder",
		"subitems":
		[{
			"key": "install_restore",
			"desc": "Yes"
		},
		{
			"key": "no",
			"desc": "No"
		}]
	}]
}]
upgrade_uifile
[{
	"step_title": "Restore Backup",
	"items":
	[{
		"type": "singleselect",
		"desc": "Would you like to restore a backup of Subsonic? Create a folder with all relevant files in it, name it Subsonic (with capital S)and place it into your public folder",
		"subitems":
		[{
			"key": "update_restore",
			"desc": "Yes, I have a custom backup, please restore it"
		},
		{
			"key": "no",
			"desc": "No, just update and leave Subsonic as it is now (all preferences and the library will be kept)"
		}]
	}]
}]
uninstall_uifile
[{
	"step_title": "Create Backup",
	"items":
	[{
		"type": "singleselect",
		"desc": "Would you like to create a backup of Subsonic in the public folder?",
		"subitems":
		[{
			"key": "uninstall_backup",
			"desc": "Yes"
		},
		{
			"key": "no",
			"desc": "No"
		}]
	}]
}]

Today I’ve made a little script I’d like to share with you. It copies the database files form an installed Subsonic package to the public folder, so you can easily create a backup of Subsonic and store it wherever you want. With the new Subsonic Package I am working on it will be possible to restore this backup while installing or upgrading. Now you can fully uninstall Subsonic, install it again and you don’t have to create users, players or search index again.

Please note:

  • To install and run this package the Subsonic package must be installed and Subsonic has to be running.
  • Don’t run this package while Subsonic is updating the search index. Otherwise the backup files will be corrupt and Subsonic will not start after restore!
  • This script just creates the backup, there is no restore option in here, it will be included in the new Subsonic package.
  • This is not a complete backup of Subsonic. Only the Database files are copied.

It will be available at both package sources I am hosting the Subsonic package on, once the new Subsonic package is out.

Now you can Download it here:

Subsonic-backup-creator.spk (10kb)

Script code:

#!/bin/sh
PUBLIC=`cat /usr/syno/etc/smb.conf | sed -r '/\/public$/!d;s/^.*path=(\/volume[0-9]{1,3}\/public).*$/\1/'`
SUBSONIC=/usr/syno/synoman/webman/3rdparty/Subsonic
if [ -L $SUBSONIC ]; then
 if [ ! -d $PUBLIC/Subsonic ]; then
 mkdir $PUBLIC/Subsonic
 fi
 cp $SUBSONIC/subsonic.properties $SUBSONIC/*.index $PUBLIC/Subsonic
 cp -r $SUBSONIC/db $PUBLIC/Subsonic
 cp -r $SUBSONIC/lucene $PUBLIC/Subsonic
 cp -r $SUBSONIC/thumbs $PUBLIC/Subsonic
fi