eg-blog

Feed Rss

Archive for the ‘Download / Release Notes’ Category

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 …)

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 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"
		}]
	}]
}]

Download ARM: subsonic4.6_spkv019.spk

Download Intel: subsonic4.6_spkv019_x86.spk

I can’t test the intel version as I don’t have an Intel DiskStation, so please let me know whether it runs or not.

 

If you have already installed another Package you don’t have to install this.

 

This and all other releases will also be hosted at

http://update.10trum.de/packageupdate/getpackages.php

It is the Package Source from the German Synology Forum.

 

The icon in the DSM now disappears if Subsonic is stopped.

For other minor Changes see Change Log.

Download: subsonic4.6_spkv18

  • The .spk Package is no longer tgz but tar
  • backup folder /volumeX/@appstore/subsonic-update-backup/ will now be removed after uninstall
  • Subsonic music folder is set to /volume1/music. Change it to wherever your music is.

Scripts

 INFO
package="Subsonic"
version="4.6-18"
maintainer="Sindre Mehus, syno package maintained at synology-forum.de"
description="Subsonic is a free, web-based media streamer, providing ubiquitous access to your music."
arch="88f6281 88f6282"
firmware="3.1-1594"
package_icon="<base64 code of package center icon, far too long to post it here>"
install_reboot="yes"
preinst (this script and parts of other scripts were copied from scripts published on pcloadletter.co.uk)
#!/bin/sh

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

source /etc/profile

########################################
#check if Jva 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

exit 0
postinst
#!/bin/sh

#--------SUBSONIC postinstall script
#--------package maintained at synology-forum.de

####################################
#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"

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

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

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

#set up symlink for the DSM GUI
if [ -d /usr/syno/synoman/webman/3rdparty ]; then
	ln -s ${SYNOPKG_PKGDEST}/ /usr/syno/synoman/webman/3rdparty/Subsonic
fi

exit 0
preupgrade
#!/bin/sh

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

#variable for process ID
PID=""

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

subsonic_get_pid ()
{
   #use "-f 1"
   PID=`ps |grep java |grep subsonic |cut -d " " -f 1`

   #if PID is <10000 than "-f 1" is empty so use "-f 2"
   if [ -z $PID ]; then
      PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
   fi
}

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

subsonic_get_pid

kill $PID
sleep 5
#delete temp files
rm -r /tmp/subsonic

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

mkdir ${SYNOPKG_PKGDEST}/../subsonic_update_backup
cp ${SYNOPKG_PKGDEST}/subsonic.properties *.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

exit 0
postupgrade
#!/bin/sh

#--------SUBSONIC postupgrade script
#--------package maintained at synology-forum.de

#variable for process ID
PID=""

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

subsonic_get_pid ()
{
   #use "-f 1"
   PID=`ps |grep java |grep subsonic |cut -d " " -f 1`

   #if PID is <10000 than "-f 1" is empty so use "-f 2"
   if [ -z $PID ]; then
      PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
   fi
}

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

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

#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

#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 temp files
rm -r /tmp/subsonic

#sleep 5

###############################
#restore subsonic db index and settings

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 ../subsonic_update_backup
fi

exit 0
preuninst
#!/bin/sh

#--------SUBSONIC preuninstall script
#--------package maintained at synology-forum.de

#variable for process ID
PID=""

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

subsonic_get_pid () 
{
   #use "-f 1"
   PID=`ps |grep java |grep subsonic |cut -d " " -f 1`
   
   #if PID is <10000 than "-f 1" is empty so use "-f 2"
   if [ -z $PID ]; then
      PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
   fi
}

subsonic_get_pid

if [ -z $PID ]; then
	sleep 1
else
	kill $PID
	sleep 5
	#delete temp files
	rm -r /tmp/subsonic
fi

exit 0
postuninst
#!/bin/sh

#--------SUBSONIC postuninstall script
#--------package maintained at synology-forum.de

#remove subsonic daemon user
synouser --del subsonic

#remove DSM icon symlink
rm /usr/syno/synoman/webman/3rdparty/Subsonic

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

#--------Subsonic start-stop-status script
#--------package maintained at synology-forum.de

#variable for process ID
PID=""

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

subsonic_get_pid ()
{
   #use "-f 1"
   PID=`ps |grep java |grep subsonic |cut -d " " -f 1`

   #if PID is <10000 than "-f 1" is empty so use "-f 2"
   if [ -z $PID ]; then
      PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
   fi
}

case "$1" in
   start)
      # 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 temp files
	  rm -r /tmp/subsonic
	  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

Download: subsonic4.6_spkv17

  • Update should now work properly
  • a backup is kept in /volumeX/@appstore/subsonic_update_backup even after uninstall
  • DSM link is dynamic now
  • Subsonic music folder is set to /volume1/music. Change it if your music is somewhere else

Scripts

INFO
package="Subsonic"
version="4.6-17"
maintainer="Sindre Mehus, syno package maintained at synology-forum.de"
description="Subsonic is a free, web-based media streamer, providing ubiquitous access to your music."
arch="88f6281 88f6282"
firmware="3.1-1594"
package_icon="<base64 code of package center icon, far too long to post it here>"
install_reboot="yes"
preinst (this script and parts of other scripts were copied from scripts published on pcloadletter.co.uk)
#!/bin/sh

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

source /etc/profile

########################################
#check if Jva 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

exit 0
postinst
#!/bin/sh

#--------SUBSONIC postinstall script
#--------package maintained at synology-forum.de

####################################
#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"

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

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

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

#set up symlink for the DSM GUI
if [ -d /usr/syno/synoman/webman/3rdparty ]; then
	ln -s ${SYNOPKG_PKGDEST}/ /usr/syno/synoman/webman/3rdparty/Subsonic
fi

exit 0
preupgrade
#!/bin/sh

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

#variable for process ID
PID=""

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

subsonic_get_pid ()
{
   #use "-f 1"
   PID=`ps |grep java |grep subsonic |cut -d " " -f 1`

   #if PID is <10000 than "-f 1" is empty so use "-f 2"
   if [ -z $PID ]; then
      PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
   fi
}

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

subsonic_get_pid

kill $PID
sleep 5
#delete temp files
rm -r /tmp/subsonic

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

mkdir ${SYNOPKG_PKGDEST}/../subsonic_update_backup
cp ${SYNOPKG_PKGDEST}/subsonic.properties *.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

exit 0
postupgrade
#!/bin/sh

#--------SUBSONIC postupgrade script
#--------package maintained at synology-forum.de

#variable for process ID
PID=""

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

subsonic_get_pid ()
{
   #use "-f 1"
   PID=`ps |grep java |grep subsonic |cut -d " " -f 1`

   #if PID is <10000 than "-f 1" is empty so use "-f 2"
   if [ -z $PID ]; then
      PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
   fi
}

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

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

#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

#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 temp files
rm -r /tmp/subsonic

#sleep 5

###############################
#restore subsonic db index and settings

cp -r ${SYNOPKG_PKGDEST}/../subsonic_update_backup/* ${SYNOPKG_PKGDEST}/

#remove backup folder
#remove the # in the next line if you want to delete the backup in the @appstore folder
#rm -r ${SYNOPKG_PKGDEST}/../subsonic_update_backup/

exit 0
preuninstall
#!/bin/sh

#--------SUBSONIC preuninstall script
#--------package maintained at synology-forum.de

#variable for process ID
PID=""

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

subsonic_get_pid ()
{
   #use "-f 1"
   PID=`ps |grep java |grep subsonic |cut -d " " -f 1`

   #if PID is <10000 than "-f 1" is empty so use "-f 2"
   if [ -z $PID ]; then
      PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
   fi
}

subsonic_get_pid

if [ -z $PID ]; then
	sleep 1
else
	kill $PID
	sleep 5
	#delete temp files
	rm -r /tmp/subsonic
fi

exit 0
postuninstall
#!/bin/sh

#--------SUBSONIC postuninstall script
#--------package maintained at synology-forum.de

#remove subsonic daemon user
synouser --del subsonic

#remove DSM icon symlink
rm /usr/syno/synoman/webman/3rdparty/Subsonic

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

#--------Subsonic start-stop-status script
#--------package maintained at synology-forum.de

#variable for process ID
PID=""

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

subsonic_get_pid ()
{
   #use "-f 1"
   PID=`ps |grep java |grep subsonic |cut -d " " -f 1`

   #if PID is <10000 than "-f 1" is empty so use "-f 2"
   if [ -z $PID ]; then
      PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
   fi
}

case "$1" in
   start)
      # 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 temp files
	  rm -r /tmp/subsonic
	  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

Download: subsonic4.6_spkv16

  • ffmpeg and lame are included for transcoding
  • the Subsonic folders are set to /volume1/music/… change them in the Subsonic menu if your music is somewhere else
  • DSM link doesn’t work (it is hard linked to http://192.168.0.3:4040)
  • Update doesn’t work properly

Scripts

INFO
package="Subsonic"
version="4.6 syno_package_v15"
maintainer="Sindre Mehus, syno package maintained at synology-forum.de"
description="Subsonic is a free, web-based media streamer, providing ubiquitous access to your music."
arch="88f6281 88f6282"
firmware="3.1-1594"
preinst (this script and parts of other scripts were copied from scripts published on pcloadletter.co.uk)
#!/bin/sh

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

source /etc/profile

########################################
#check if Jva 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

exit 0
postinst
#!/bin/sh

#--------SUBSONIC postinstall script
#--------package maintained at synology-forum.de

####################################
#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"

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

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

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

#set up symlink for the DSM GUI
if [ -d /usr/syno/synoman/webman/3rdparty ]; then
	ln -s ${SYNOPKG_PKGDEST}/ /usr/syno/synoman/webman/3rdparty/Subsonic
fi

exit 0
preupgrade
#!/bin/sh

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

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

#variable for process ID
PID=""

#use "-f 1"
PID=`ps |grep java |grep subsonic |cut -d " " -f 1`
#if PID is if [ -z $PID ]; then
	PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
fi

if [ -z $PID ]; then
   sleep 1
else
   kill $PID
   sleep 5
fi

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

mkdir ${SYNOPKG_PKGDEST}/../subsonic_update_backup
cp ${SYNOPKG_PKGDEST}/subsonic.properties ${SYNOPKG_PKGDEST}/../subsonic_update_backup/
cp -r ${SYNOPKG_PKGDEST}/db ${SYNOPKG_PKGDEST}/../subsonic_update_backup

exit 0
postupgrade
#!/bin/sh

#--------SUBSONIC postupgrade script
#--------package maintained at synology-forum.de

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

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

#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

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

sleep 60

#stop subsonic
#use "-f 1"
PID=`ps |grep java |grep subsonic |cut -d " " -f 1`

#if PID is if [ -z $PID ]; then
   PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
fi

kill $PID

sleep 5

###############################
#restore subsonic.propierties and db folder

cp ${SYNOPKG_PKGDEST}/../subsonic_update_backup/subsonic.properties ${SYNOPKG_PKGDEST}/
cp -r ${SYNOPKG_PKGDEST}/../subsonic_update_backup/db ${SYNOPKG_PKGDEST}/

#remove backup folder
#clear the next line if you want to keep a backup in the @appstore folder
#rm -r ${SYNOPKG_PKGDEST}/../subsonic_update_backup/

#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

exit 0
preuninstall
#!/bin/sh

#--------SUBSONIC preuninstall script
#--------package maintained at synology-forum.de

#stop Subsonic if it is runing

#variable for process ID
PID=""

#use "-f 1"
PID=`ps |grep java |grep subsonic |cut -d " " -f 1`
#if PID is if [ -z $PID ]; then
	PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
fi

if [ -z $PID ]; then
    sleep 1
else
   kill $PID
   sleep 5
fi

exit 0
postuninstall
#!/bin/sh

#--------SUBSONIC postuninstall script
#--------package maintained at synology-forum.de

#remove subsonic daemon user
synouser --del subsonic

#remove DSM icon symlink
rm /usr/syno/synoman/webman/3rdparty/Subsonic

#remove temp files
rm -r /tmp/subsonic

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

#--------Subsonic start-stop-status script
#--------package maintained at synology-forum.de

#variable for process ID
PID=""

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

subsonic_get_pid ()
{
   #use "-f 1"
   PID=`ps |grep java |grep subsonic |cut -d " " -f 1`

   #if PID is    if [ -z $PID ]; then
      PID=`ps |grep java |grep subsonic |cut -d " " -f 2`
   fi
}

case "$1" in
   start)
      # 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 temp files
	  rm -r /tmp/subsonic
	  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