Finally…
The second major release for the time I am working on these packages is out.
What is new?
From the package site I only added an own install/start/stop log to the package center, but Subsonic itself has many new features (Change log here). It now scans my library with about 45k songs in under 10 minutes and has the MiniSub html5 interface on board (in Subsonic go to More -> MiniSub). You can still have direct Access to it with adding /mini after your Subsonic URL or Add an icon to your DSM during update process. Also Madevil has finished his MashupMod so i included this again.
What do I have to consider?
As far as my testing went today I can say that the library of 4.6 and 4.7 are incompatible so you will loose all your settings. (It isn’t that bad because file searching is now about 10 times faster than in 4.6). If you want to backup and restore your users read this article in the Subsonic Forum (thanks to MoBO).
With installing the MashupMod version you will get many benefits but you can not register your Subsonic to get the <name>.subsonic.org address.
Also MashupMod requires Java 7 wich hasn’t been released for Atom based Diskstations, yet. You have to stick to the normal 4.7 version. I disabled the option to install MashupMod on x86 Systems.
As there is no Java package for the new PPC Diskstations DS213+ and DS413 you can not install any Java programs there, including Subsonic.
Now have fun with it the effort of upgrading is totally worth it.
The update button will appear in you package center soon (check my Subsonic install instructions on how to do this). You want to download and install it it manually? Here you go:
https://www.dropbox.com/sh/pylh8ilr0fi80ub/XAixHmKbKd/stable
btw. it runs fine on DSM 4.1…
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
echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "Download and install the Java Synology package from http://wp.me/pVshC-z5" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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 "Can't find a folder named 'Subsonic' in your public folder. " >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
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_PKGDEST}/subsonic_package.log
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 "" ""
echo "$(date +%m%d%y%H%M%S): create subsonic daemon user" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
#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}
echo "$(date +%m%d%y%H%M%S): set ownership of Subsonic folder tree" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
#####################################
##other stuff
#select the right mods / version to download/install
if [ ! -z ${mashupmod_install} ]; then
#download and install MashupMod
echo "$(date +%m%d%y%H%M%S): download and install MashupMod" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
wget https://dl.dropbox.com/u/33279357/synology_packages/addons/MashupMod_4.7B3125SE.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}
echo "$(date +%m%d%y%H%M%S): extracted MashupMod" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
rm ${SYNOPKG_PKGDEST}/MashupMod.tgz
echo "$(date +%m%d%y%H%M%S): copied Mashupmod and deleted downloaded files" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
else
#install standard Subsonic
cp -r ${SYNOPKG_PKGDEST}/install_standard/* ${SYNOPKG_PKGDEST}/Subsonic
echo "$(date +%m%d%y%H%M%S): copied standard Subsonic files" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
rm -r ${SYNOPKG_PKGDEST}/install_standard
#make the Subsonic start script executable
chmod +x ${SYNOPKG_PKGDEST}/Subsonic/subsonic.sh
#####################################
##start Subsonic
echo "$(date +%m%d%y%H%M%S): start Subsonic for first initialisation" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
#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
sleep 5
subsonic_get_pid
if [ ! -z $PID ]; then
echo "$(date +%m%d%y%H%M%S): started Subsonic successfully. PID is: $PID" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
else
echo "Error: Can not start Subsonic during install" > $SYNOPKG_TEMP_LOGFILE
echo "$(date +%m%d%y%H%M%S): Error: Can not start Subsonic during install" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
exit 1
fi
#give it some time to start up
sleep 90
#stop subsonic
kill $PID
sleep 5
echo "$(date +%m%d%y%H%M%S): Stopped Subsonic" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
####################################
##download and install additional features
echo "$(date +%m%d%y%H%M%S): Download and install additional Features" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
#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
echo "$(date +%m%d%y%H%M%S): Downloaded Subtunes" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
tar xzf ${SYNOPKG_PKGDEST}/Subtunes.tgz -C ${SYNOPKG_PKGDEST}
echo "$(date +%m%d%y%H%M%S): extracted Subtunes" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
else
echo "$(date +%m%d%y%H%M%S): Error: Subtunes could not be downloaded" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
echo "$(date +%m%d%y%H%M%S): Please check the internet connection of your Diskstation" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
rm ${SYNOPKG_PKGDEST}/Subtunes.tgz
echo "$(date +%m%d%y%H%M%S): copied Subtunes and deleted downloaded files" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
#MiniSub Link
if [ ! -z ${minisub_link} ]; then
echo "$(date +%m%d%y%H%M%S): create MiniSub DSM link" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
if [ -f ${SYNOPKG_PKGDEST}/Subsonic/MiniSublink/config ]; then
cp ${SYNOPKG_PKGDEST}/Subsonic/MiniSublink/config /usr/syno/synoman/webman/3rdparty/Subsonic/jetty/*/webapp/mini/
cp -r ${SYNOPKG_PKGDEST}/Subsonic/images/* /usr/syno/synoman/webman/3rdparty/Subsonic/jetty/*/webapp/mini/
fi
fi
rm -r ${SYNOPKG_PKGDEST}/Subsonic/MiniSublink
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
echo "$(date +%m%d%y%H%M%S): restore previously made backup fron public folder" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "$(date +%m%d%y%H%M%S): ----installation complete----" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "$(date +%m%d%y%H%M%S): stopping subsonic" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "$(date +%m%d%y%H%M%S): create backup of Subsonic db in temporary backup dir" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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 ${install_update} ]; then
echo "$(date +%m%d%y%H%M%S): restore from temporary backup dir" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "$(date +%m%d%y%H%M%S): remove temporary backup dir" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "$(date +%m%d%y%H%M%S): ----update complete----" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "$(date +%m%d%y%H%M%S): stopping Subsonic" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "$(date +%m%d%y%H%M%S): Create a backup of Subsonic in public folder" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "$(date +%m%d%y%H%M%S): remove Subsonic user" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "$(date +%m%d%y%H%M%S): ----uninstall complete----" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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}'`
}
get_time()
{
TIME=$(date +%m%d%y%H%M%S)
}
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
echo "$(date +%m%d%y%H%M%S): Subsonic DSM link created" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
#MiniSub
if [ -d ${SYNOPKG_PKGDEST}/Subsonic/jetty/*/webapp/mini ]; then
ln -s ${SYNOPKG_PKGDEST}/Subsonic/jetty/*/webapp/mini /usr/syno/synoman/webman/3rdparty/Subsonic_MiniSub
echo "$(date +%m%d%y%H%M%S): MiniSub DSM link created" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
#Subtunes
if [ -d ${SYNOPKG_PKGDEST}/Subsonic/jetty/*/webapp/Subtunes ]; then
ln -s ${SYNOPKG_PKGDEST}/Subsonic/jetty/*/webapp/Subtunes /usr/syno/synoman/webman/3rdparty/Subsonic_Subtunes
echo "$(date +%m%d%y%H%M%S): Subtunes DSM link created" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
else
echo "$(date +%m%d%y%H%M%S) : Error: Directory for Subsonic DSM link was not found" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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
echo "$(date +%m%d%y%H%M%S): Temp directory created" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
#create symlink to the created directory
if [ ! -L /tmp/subsonic ]; then
ln -s ${SYNOPKG_PKGDEST}/../../@tmp/subsonic /tmp/
echo "$(date +%m%d%y%H%M%S): Temp directory link created" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
# starting subsonic as subsonic daemon user
echo "$(date +%m%d%y%H%M%S): starting Subsonic as subsonic daemon user" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
su - subsonic -s /bin/sh -c /usr/syno/synoman/webman/3rdparty/Subsonic/subsonic.sh
sleep 10
echo "$(date +%m%d%y%H%M%S): started Subsonic as subsonic daemon user" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
subsonic_get_pid
echo "$(date +%m%d%y%H%M%S): PID is: $PID" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
echo "$(date +%m%d%y%H%M%S): ----subsonic is running----" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
exit 0
;;
stop)
#stop subsonic
subsonic_get_pid
kill $PID
echo "$(date +%m%d%y%H%M%S) : killed Subsonic PID: $PID" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
sleep 2
#delete Symlinks and DSM icon
if [ -L /usr/syno/synoman/webman/3rdparty/Subsonic ]; then
rm /usr/syno/synoman/webman/3rdparty/Subsonic
echo "$(date +%m%d%y%H%M%S): Subsonic DSM link deleted" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
if [ -L /usr/syno/synoman/webman/3rdparty/Subsonic_MiniSub ]; then
rm /usr/syno/synoman/webman/3rdparty/Subsonic_MiniSub
echo "$(date +%m%d%y%H%M%S): MiniSub DSM link deleted" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
if [ -L /usr/syno/synoman/webman/3rdparty/Subsonic_Subtunes ]; then
rm /usr/syno/synoman/webman/3rdparty/Subsonic_Subtunes
echo "$(date +%m%d%y%H%M%S): Subtunes DSM link deleted" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
if [ -d ${SYNOPKG_PKGDEST}/../../@tmp/subsonic ]; then
rm -r ${SYNOPKG_PKGDEST}/../../@tmp/subsonic
echo "$(date +%m%d%y%H%M%S): Temp files deleted" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
if [ -L /tmp/subsonic ]; then
rm /tmp/subsonic
echo "$(date +%m%d%y%H%M%S): Temp link deleted" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
fi
echo "$(date +%m%d%y%H%M%S): ----subsonic is stopped----" >> ${SYNOPKG_PKGDEST}/subsonic_package.log
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_package.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": "subtunes_install",
"desc": "Subtunes html5 web interface (3,8 MB)"
},
{
"key": "mashupmod_install",
"desc": "Mashupmod (30MB) (it is not beta anymore but be aware of what you are doing: check eg-blog.de!)"
},
{
"key": "minisub_link",
"desc": "Create a link in DSM to MiniSub. MiniSub is a html5 based webinterface included in Subsonic"
}]
}]
}]
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": "install_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": "subtunes_install",
"desc": "Subtunes html5 web interface (3,8 MB)"
},
{
"key": "mashupmod_install",
"desc": "Mashupmod (30MB)
It is not beta anymore but be aware of what you are doing: check eg-blog.de!"
},
{
"key": "minisub_link",
"desc": "Create a link in DSM to MiniSub.
MiniSub is a html5 based webinterface included in Subsonic"
}]
}]
}]
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.7-026"
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"
Config (Subsonic):
{
".url": {
"de.eg-blog.subsonic": {
"type": "url",
"allUsers": true,
"title": "Subsonic",
"desc": "Subsonic Music Streamer",
"icon": "images/icon_48.png",
"protocol": "http",
"url": "/",
"port": "4040"
}
}
}
Config (MiniSub):
{
".url": {
"de.eg-blog.subsonic.MiniSub": {
"type": "url",
"allUsers": true,
"title": "MiniSub",
"desc": "Subsonic Music Streamer - MiniSub html5 interface",
"icon": "icon_48.png",
"protocol": "http",
"url": "/mini/",
"port": "4040"
}
}
}
Config (Subtunes):
{
".url": {
"de.eg-blog.subsonic.Subtunes": {
"type": "url",
"allUsers": true,
"title": "Subtunes",
"desc": "Subsonic Music Streamer - Subtunes html5 interface",
"icon": "icons/icon_48.png",
"protocol": "http",
"url": "/Subtunes/",
"port": "4040"
}
}
}
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