Bliss album art manager package for Synology NAS

bliss-UI

 

Bliss is a Java application written by Dan Gravell which can manage file names, tags and album art for your music collection and which can also enforce their consistency. It is designed to be left running once installed so that albums you add later will have these same policies applied to them automatically. It supports a wide range of music formats, and effortlessly deals with very large collections – apparently even ones containing quite obscure recordings. My own collection didn’t really put this to the test, since it doesn’t contain bootlegs, live sets or rarities plus I had also already obtained cover art for it (from back when CoverFlow first graced the screen of my iPhone 2G).

I could see from referrals to this blog that people were asking Dan for a Synology package which he didn’t have the time to investigate, and so I thought that it would make an interesting little project, especially since a NAS is the ideal device to run Bliss on. Although there was already a Howto post on the Synology forums, that guide only really covered getting the basic functionality of Bliss up and running – it was missing the best bits: the filesystem watching and audio fingerprinting features. These depend on natively compiled binaries, but Bliss doesn’t support running on ARM or PowerPC CPUs, and its Intel binaries don’t work on Synology either (the usual problem – glibc too old). Getting these working provided precisely the sort of challenge I like. Not only were they difficult to compile, but getting them integrated into the various OSGi ‘bundles’ that make up Bliss was quite involved too.

Bliss uses an open source library called Chromaprint, itself part of the wider Acoustid project. The aim is to scan an audio file, to produce a fingerprint of the sound, and then to compare this against an open online database such as MusicBrainz.org to identify music regardless of compression codec used. Its author Lukáš Lalinský explains how it works. It turns out that Chromaprint uses some complex maths functions that FFmpeg can provide (specifically Fourier Transform), and FFmpeg’s shared libraries are already included with Synology DSM. I was able to download the sources that were used to build DSM, which then allowed me to build Chromaprint linked to those existing libraries – resulting in a minuscule 84KB build of fpcalc, rather than the statically compiled ones for various OS and CPU architectures included with Bliss, which weigh in at several megabytes. I think I’m finally ‘getting’ what open source is all about, which is nice since that was my objective in experimenting with my NAS. To prevent fpcalc building and linking to its dynamic library libchromaprint.so and to get it to detect FFmpeg properly I had to carefully inspect the Makefiles to find the correct build syntax:
FFMPEG_DIR=/usr/local/i686-linux-gnu cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON -DBUILD_SHARED_LIBS=NO .
FFMPEG_DIR is the base folder from which CMake will look for lib/libavcodec.so and include/libavcodec/avfft.h.

It’s a bit of a nuisance that on ARM you first have to compile CMake because it doesn’t exist on the Optware ipkg repository, but it was straightforward enough to build. To build the Intel binaries I cross-compiled on a Ubuntu Desktop 12 virtual machine using the Synology toolchain (see the Synology DSM 3rd party developer guide for details).

For watching the filesystem Bliss uses JNotify to hook into the Linux kernel’s inotify subsystem. Getting this compiled was tricky. It seems no one has reported successfully compiling it for an ARM CPU, and JNotify’s author Omry Yadan wasn’t aware of anyone doing this either. The problem is that compilation halts with these errors:

In file included from ../net_contentobjects_jnotify_linux_JNotify_linux.c:43:
../inotify-syscalls.h:35:1: error: "__NR_inotify_init" redefined
In file included from /opt/include/sys/syscall.h:25,
                 from ../inotify-syscalls.h:4,
                 from ../net_contentobjects_jnotify_linux_JNotify_linux.c:43:
/opt/include/asm/unistd.h:344:1: error: this is the location of the previous definition
In file included from ../net_contentobjects_jnotify_linux_JNotify_linux.c:43:
../inotify-syscalls.h:36:1: error: "__NR_inotify_add_watch" redefined
In file included from /opt/include/sys/syscall.h:25,
                 from ../inotify-syscalls.h:4,
                 from ../net_contentobjects_jnotify_linux_JNotify_linux.c:43:
/opt/include/asm/unistd.h:345:1: error: this is the location of the previous definition
In file included from ../net_contentobjects_jnotify_linux_JNotify_linux.c:43:
../inotify-syscalls.h:37:1: error: "__NR_inotify_rm_watch" redefined
In file included from /opt/include/sys/syscall.h:25,
                 from ../inotify-syscalls.h:4,
                 from ../net_contentobjects_jnotify_linux_JNotify_linux.c:43:
/opt/include/asm/unistd.h:346:1: error: this is the location of the previous definition

By searching in a very generic way for a solution I found this post on stackoverflow.com which helped me to patch the header inotify-syscalls.h to get around the problem. Since there is no JDK for ARM embedded systems I included the headers from OpenJDK6 which I took from a Ubuntu VM.

Compiling on Intel also required a fix. I was getting the same error as featured in this post on the JNotify user forum on SourceForge.net:
expected specifier-qualifier-list before ‘pid_t’

Despite some people’s apparent success simply rearranging the order of the includes in net_contentobjects_jnotify_linux_JNotify_linux.c this didn’t help me. I’m not sure quite how I stumbled upon it, but I found the solution staring at me on this page:
The size_t, ssize_t, uid_t, gid_t, off_t and pid_t types are defined as described in sys/types.h

I inserted an additional include in for sys/types.h and it compiled ok. It’s worth pointing out that, although all Intel Synology units are x86-64 architecture, the Oracle JRE for Embedded is x86 (32 bit), so I used the i686 toolchain. Synology DSM’s FFmpeg shared libraries are also 32 bit so my build of fpcalc needed to comply with this. Bliss nonetheless expects the binary to be called fpcalc_linux64 since Bliss is detecting the underlying Linux CPU architecture.

Once I had got past the obstacle of compiling the native code, I needed to liaise back and forth with Dan to understand how Bliss was dealing with its libraries and how I could replace the built-in versions. Originally this was quite a kludge but Dan has since abstracted out the native binaries into their own OSGI bundle fragments which makes things a lot easier, and should allow Bliss to survive an in-app update. The Synology package provides the following architecture-specific jar files (with corresponding edits to their manifest). Thank you to Dan for all the quick answers!

  • net.contentobjects.jnotify.linux.x86-0.94.0.jar
  • net.contentobjects.jnotify.linux.ARM_le-0.94.0.jar
  • net.contentobjects.jnotify.linux.PowerPC-0.94.0.jar
  • com.elsten.bliss.policy.tag.auto.linux.x86-1.0.0.jar – contains fpcalc.
  • com.elsten.bliss.policy.tag.auto.linux.ARM_le-1.0.0.jar
  • com.elsten.bliss.policy.tag.auto.linux.PowerPC-1.0.0.jar

Here are my fixes to JNotify to get the native library part compiled, since they may help someone else:

 

Patch for native compile of JNotify 0.94 on ARM Synology

diff -crB jnotify-vanilla/inotify-syscalls.h jnotify-arm/inotify-syscalls.h
*** jnotify-vanilla/inotify-syscalls.h	2005-11-30 15:07:56.000000000 +0000
--- jnotify-arm/inotify-syscalls.h	2012-09-14 02:43:44.032130098 +0100
***************
*** 32,40 ****
  # define __NR_inotify_add_watch	152
  # define __NR_inotify_rm_watch	156
  #elif defined (__arm__)
! # define __NR_inotify_init	316
! # define __NR_inotify_add_watch	317
! # define __NR_inotify_rm_watch	318
  #elif defined (__SH4__)
  # define __NR_inotify_init	290
  # define __NR_inotify_add_watch	291
--- 32,46 ----
  # define __NR_inotify_add_watch	152
  # define __NR_inotify_rm_watch	156
  #elif defined (__arm__)
! # ifndef __NR_inotify_init
! #  define __NR_inotify_init     316
! # endif
! # ifndef __NR_inotify_add_watch
! #  define __NR_inotify_add_watch 317
! # endif
! # ifndef __NR_inotify_rm_watch
! #  define __NR_inotify_rm_watch 318
! # endif
  #elif defined (__SH4__)
  # define __NR_inotify_init	290
  # define __NR_inotify_add_watch	291
diff -crB jnotify-vanilla/Release/subdir.mk jnotify-arm/Release/subdir.mk
*** jnotify-vanilla/Release/subdir.mk	2011-02-28 18:07:20.000000000 +0000
--- jnotify-arm/Release/subdir.mk	2012-09-14 02:29:00.000000000 +0100
***************
*** 17,23 ****
  %.o: ../%.c
  	@echo 'Building file: $<'
  	@echo 'Invoking: GCC C Compiler'
! 	gcc -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux -O3 -Wall -Werror -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
  	@echo 'Finished building: $<'
  	@echo ' '
  
--- 17,23 ----
  %.o: ../%.c
  	@echo 'Building file: $<'
  	@echo 'Invoking: GCC C Compiler'
! 	gcc -I/volume1/public/temp/jdk_include/ -I/volume1/public/temp/jdk_include/linux -O3 -Wall -Werror -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
  	@echo 'Finished building: $<'
  	@echo ' '
 

Patch for cross compile of JNotify 0.94 for Intel Synology, using Ubuntu Desktop 12

diff -crB jnotify-vanilla/net_contentobjects_jnotify_linux_JNotify_linux.c jnotify-i686/net_contentobjects_jnotify_linux_JNotify_linux.c
*** jnotify-vanilla/net_contentobjects_jnotify_linux_JNotify_linux.c	2011-02-28 18:07:20.000000000 +0000
--- jnotify-i686/net_contentobjects_jnotify_linux_JNotify_linux.c	2012-09-14 00:41:53.455010206 +0100
***************
*** 36,41 ****
--- 36,42 ----
  #include <sys/time.h>
  #include <sys/select.h>
  #include <sys/ioctl.h>
+ #include <sys/types.h>
  #include <errno.h>
  #include <stdio.h>
  #include <unistd.h>
diff -crB jnotify-vanilla/Release/makefile jnotify-i686/Release/makefile
*** jnotify-vanilla/Release/makefile	2011-02-28 18:07:20.000000000 +0000
--- jnotify-i686/Release/makefile	2012-09-14 00:37:56.475007855 +0100
***************
*** 28,34 ****
  libjnotify.so: $(OBJS) $(USER_OBJS)
  	@echo 'Building target: $@'
  	@echo 'Invoking: GCC C Linker'
! 	gcc -shared -o"libjnotify.so" $(OBJS) $(USER_OBJS) $(LIBS)
  	@echo 'Finished building target: $@'
  	@echo ' '
  
--- 28,34 ----
  libjnotify.so: $(OBJS) $(USER_OBJS)
  	@echo 'Building target: $@'
  	@echo 'Invoking: GCC C Linker'
! 	i686-linux-gnu-gcc -shared -o"libjnotify.so" $(OBJS) $(USER_OBJS) $(LIBS)
  	@echo 'Finished building target: $@'
  	@echo ' '
  
diff -crB jnotify-vanilla/Release/subdir.mk jnotify-i686/Release/subdir.mk
*** jnotify-vanilla/Release/subdir.mk	2011-02-28 18:07:20.000000000 +0000
--- jnotify-i686/Release/subdir.mk	2012-09-14 00:37:33.835007731 +0100
***************
*** 17,23 ****
  %.o: ../%.c
  	@echo 'Building file: $<'
  	@echo 'Invoking: GCC C Compiler'
! 	gcc -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux -O3 -Wall -Werror -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
  	@echo 'Finished building: $<'
  	@echo ' '
  
--- 17,23 ----
  %.o: ../%.c
  	@echo 'Building file: $<'
  	@echo 'Invoking: GCC C Compiler'
! 	i686-linux-gnu-gcc -I/usr/local/i686-linux-gnu/include/ -I/usr/lib/jvm/java-6-openjdk-amd64/include/ -I/usr/lib/jvm/java-6-openjdk-amd64/include/linux -O3 -Wall -Werror -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
  	@echo 'Finished building: $<'
  	@echo ' '
 
 

Package instructions

The package can be installed on an unmodified NAS – no hacking or bootstrapping is required. Only Marvell Kirkwood, Intel, and Freescale QorIQ PowerPC CPUs are supported, so please check which CPU your NAS has.

  • Firstly, in the DSM User control panel enable the User Home service.
  • Open the DSM Package Center. In Settings -> Package Sources add my package repository URL which is http://packages.pcloadletter.co.uk
  • Install either one of my Java SE for Embedded Synology packages (Java 6 or Java 7). Only Marvell Kirkwood, Freescale QorIQ, or Intel CPUs are supported. Please read all the notes and instructions on that page carefully.
  • Install Bliss using DSM’s Package Center.
  • The rest is self-explanatory.
 

Package scripts

For information, here are the package scripts so you can see what it’s going to do. You can get more information about how packages work by reading the Synology Package wiki.

installer.sh

#!/bin/sh

#--------BLISS installer script
#--------package maintained at pcloadletter.co.uk

DOWNLOAD_FILE="latest-linux-version"
DOWNLOAD_PATH="http://www.blisshq.com/app"
DOWNLOAD_URL="${DOWNLOAD_PATH}/${DOWNLOAD_FILE}"
DAEMON_USER="`echo ${SYNOPKG_PKGNAME} | awk {'print tolower($_)'}`"
DAEMON_PASS="`openssl rand 12 -base64 2>nul`"
DAEMON_ID="${SYNOPKG_PKGNAME} daemon user"
ENGINE_SCRIPT="bliss.sh"
MIGRATION_FOLDER="${DAEMON_USER}_data_mig"
SYNO_CPU_ARCH="`uname -m`"
NATIVE_BINS_URL="http://packages.pcloadletter.co.uk/downloads/bliss-native-${SYNO_CPU_ARCH}.tgz"   
NATIVE_BINS_FILE="`echo ${NATIVE_BINS_URL} | sed -r "s%^.*/(.*)%\1%"`"
INSTALL_FILES="${DOWNLOAD_URL}"
source /etc/profile

TEMP_FOLDER="`find / -maxdepth 2 -name '@tmp' | head -n 1`"
APP_TEMP="${TEMP_FOLDER}/${SYNOPKG_PKGNAME}"
DAEMON_HOME="`cat /etc/passwd | grep "${DAEMON_ID}" | cut -f6 -d':'`"
PRIMARY_VOLUME="/`echo $TEMP_FOLDER | cut -f2 -d'/'`"


preinst ()
{
  if [ -z ${JAVA_HOME} ]; then
    echo "Java is not installed or not properly configured. JAVA_HOME is not defined. "
    echo "Download and install the Java Synology package from http://wp.me/pVshC-z5"
    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. "
    echo "Download and install the Java Synology package from http://wp.me/pVshC-z5"
    exit 1
  fi
  
  #is the User Home service enabled?
  UH_SERVICE=maybe
  synouser --add userhometest Testing123 "User Home test user" 0 "" ""
  UHT_HOMEDIR=`cat /etc/passwd | sed -r '/User Home test user/!d;s/^.*:User Home test user:(.*):.*$/\1/'`
  if echo $UHT_HOMEDIR | grep '/var/services/homes/' > /dev/null; then
    if [ ! -d $UHT_HOMEDIR ]; then
      UH_SERVICE=false
    fi
  fi
  synouser --del userhometest
  #remove home directory (needed since DSM 4.1)
  [ -e /var/services/homes/userhometest ] && rm -r /var/services/homes/userhometest
  if [ ${UH_SERVICE} == "false" ]; then
    echo "The User Home service is not enabled. Please enable this feature in the User control panel in DSM."
    exit 1
  fi
  #fetch the URL for the latest installer version from blisshq.com  
  _download
  DOWNLOAD_URL=`cat ${TEMP_FOLDER}/${DOWNLOAD_FILE}`
  INSTALL_FILES="${DOWNLOAD_URL} ${NATIVE_BINS_URL}"
  #now fetch the installer
  _download
  exit 0
}

_download ()
{
  cd ${TEMP_FOLDER}
  for WGET_URL in ${INSTALL_FILES}
  do
    WGET_FILENAME="`echo ${WGET_URL} | sed -r "s%^.*/(.*)%\1%"`"
    [ -f ${TEMP_FOLDER}/${WGET_FILENAME} ] && rm ${TEMP_FOLDER}/${WGET_FILENAME}
    wget ${WGET_URL}
    if [[ $? != 0 ]]; then
      if [ -d ${PUBLIC_FOLDER} ] && [ -f ${PUBLIC_FOLDER}/${DOWNLOAD_FILE} ]; then
        cp ${PUBLIC_FOLDER}/${DOWNLOAD_FILE} ${TEMP_FOLDER}
      else     
        echo "There was a problem downloading ${WGET_FILENAME} from the official download link, "
        echo "which was \"${WGET_URL}\" "
        echo "Alternatively, you may download this file manually and place it in the 'public' shared folder. "
        exit 1
      fi
    fi
  done
}


postinst ()
{
  #create daemon user
  synouser --add ${DAEMON_USER} ${DAEMON_PASS} "${DAEMON_ID}" 0 "" ""
  
  #determine the daemon user homedir and save that variable in the user's profile
  #this is needed because new users seem to inherit a HOME value of /root which they have no permissions for
  DAEMON_HOME="`cat /etc/passwd | grep "${DAEMON_ID}" | cut -f6 -d':'`"
  su - ${DAEMON_USER} -s /bin/sh -c "echo export HOME=\'${DAEMON_HOME}\' >> .profile"

  #set working folder (/tmp is very small on Synology)
  #and reduce Java prefs system polling frequency to allow hibernation
  su - ${DAEMON_USER} -s /bin/sh -c "echo export VMARGS=\'-Djava.io.tmpdir=${APP_TEMP} -Djava.util.prefs.syncInterval=86400\' >> .profile"
  
  #once again fetch the URL for the latest installer version from blisshq.com
  #and use it to determine the filename we downloaded during preinst
  _download
  DOWNLOAD_FILE=`cat ${TEMP_FOLDER}/${DOWNLOAD_FILE} | sed -r "s%^.*/(.*)%\1%"`

  #run the installer
  cd ${TEMP_FOLDER}
  echo INSTALL_PATH=${SYNOPKG_PKGDEST} > ${TEMP_FOLDER}/bliss-synology.properties
  java -jar ${TEMP_FOLDER}/${DOWNLOAD_FILE} -options ${TEMP_FOLDER}/bliss-synology.properties
  rm ${TEMP_FOLDER}/bliss-synology.properties
  rm ${TEMP_FOLDER}/${DOWNLOAD_FILE}
  sed -i "s%^#!/bin/bash%#!/bin/sh%" ${SYNOPKG_PKGDEST}/bin/${ENGINE_SCRIPT}
  
  #stow jar files containing Synology versions of native code
  #(libjnotify, and fpcalc from the Chromaprint audio fingerprinting library)
  mkdir ${SYNOPKG_PKGDEST}/syno-native
  cd ${SYNOPKG_PKGDEST}/syno-native
  tar xzf ${TEMP_FOLDER}/${NATIVE_BINS_FILE}

  #change owner of folder tree and temp files
  chown -R ${DAEMON_USER} ${SYNOPKG_PKGDEST}
  chown -R ${DAEMON_USER} ${DAEMON_HOME} 
  [ -d ${APP_TEMP} ] && chown -R ${DAEMON_USER} ${APP_TEMP}

  exit 0
}


preuninst ()
{
  #make sure daemon is stopped
  /var/packages/${SYNOPKG_PKGNAME}/scripts/start-stop-status stop
  sleep 6
  
  exit 0
}


postuninst ()
{
  #remove daemon user
  synouser --del ${DAEMON_USER}
  
  #clean up temp
  [ -d ${TEMP_FOLDER}/Bliss ] && rm -r ${TEMP_FOLDER}/Bliss

  exit 0
}


preupgrade ()
{
  #make sure daemon is stopped
  /var/packages/${SYNOPKG_PKGNAME}/scripts/start-stop-status stop
  sleep 6
  
  #if config data exists back it up
  if [ -d ${DAEMON_HOME}/.bliss ]; then
    mkdir ${SYNOPKG_PKGDEST}/../${DAEMON_USER}_data_migration
    mv ${DAEMON_HOME}/.bliss ${SYNOPKG_PKGDEST}/../${DAEMON_USER}_data_migration
    mv ${DAEMON_HOME}/.java ${SYNOPKG_PKGDEST}/../${DAEMON_USER}_data_migration
  fi

  exit 0
}


postupgrade ()
{
  #use the migrated config data from the previous version
  if [ -d ${SYNOPKG_PKGDEST}/../${DAEMON_USER}_data_migration/.bliss ]; then
    mv ${SYNOPKG_PKGDEST}/../${DAEMON_USER}_data_migration/.bliss ${DAEMON_HOME}
    mv ${SYNOPKG_PKGDEST}/../${DAEMON_USER}_data_migration/.java ${DAEMON_HOME}
    rmdir ${SYNOPKG_PKGDEST}/../${DAEMON_USER}_data_migration
    
    #daemon user has been deleted and recreated so we need to reset ownership (new UID)
    chown -R ${DAEMON_USER} ${DAEMON_HOME}
  fi
  
  exit 0
}
 

start-stop-status.sh

#!/bin/sh

#--------BLISS start-stop-status script
#--------package maintained at pcloadletter.co.uk

DAEMON_USER="`echo ${SYNOPKG_PKGNAME} | awk {'print tolower($_)'}`"
DAEMON_ID="${SYNOPKG_PKGNAME} daemon user"
ENGINE_SCRIPT="bliss.sh"
PIDFILE="${SYNOPKG_PKGDEST}/${SYNOPKG_PKGNAME}.pid"
SYNO_CPU_ARCH="`uname -m`"

_findpid ()
{
  ps -w | grep "^ *[0-9]* ${DAEMON_USER} .*java.*-Djava\.io\.tmpdir=/volume1/@tmp/Bliss" | grep -v "grep" | awk '{ print $1 }'
}


case $1 in
  start)
    PID=`_findpid`
    if [ -n "$PID" ]; then
      echo daemon is already running with pid $PID
      exit 1;
    fi
    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 \
     || echo export TZ=\'${SYNO_TZ}\' >> ${DAEMON_HOME}/.profile
    
    #update the package version number in case of an in-app update
    #find must write out to a file because vars cannot be defined in subshells
    #http://mywiki.wooledge.org/BashFAQ/024
    find ${SYNOPKG_PKGDEST}/felix-cache -name "*.info" > /tmp/bliss-v-check.txt
    while IFS="" read -r FILE_TO_PARSE; do
      if [ -e ${FILE_TO_PARSE} ]; then
        if grep "com.elsten.bliss.bundle" ${FILE_TO_PARSE} > /dev/null; then
          BLISS_BUNDLE_DIR="`dirname ${FILE_TO_PARSE}`"
        fi
      fi
    done < /tmp/bliss-v-check.txt
    #read current version
    BLISS_VERSION=`grep "version" /var/packages/${SYNOPKG_PKGNAME}/INFO | sed -r "s/^.*([0-9]{8}).*$/\1/"`
    if [ -d ${BLISS_BUNDLE_DIR} ]; then
      find ${BLISS_BUNDLE_DIR} -name *.jar > /tmp/bliss-v-check.txt
      while IFS="" read -r FILE_TO_PARSE; do
        if [ -e ${FILE_TO_PARSE} ]; then
          DETECTED_VERSION=`unzip -p ${FILE_TO_PARSE} META-INF/MANIFEST.MF | grep Bundle-Version | cut -f4 -d'.' |  cut -c1-8`
        fi
        if [ ${DETECTED_VERSION} -gt ${BLISS_VERSION} ]; then
          BLISS_VERSION=${DETECTED_VERSION}
        fi
      done < /tmp/bliss-v-check.txt
    fi
    rm /tmp/bliss-v-check.txt
    sed -r -i "s/^version=\"[0-9]{8}/version=\"${BLISS_VERSION}/" /var/packages/Bliss/INFO
    
    #update the CPU-specific repository customizations (in case of an in-app update)
    if [ ${SYNO_CPU_ARCH} == "armv5tel" ]; then
      sed -i "s/jnotify\.linux\.x86/jnotify\.linux\.ARM_le/g" ${SYNOPKG_PKGDEST}/bliss-bundle/repository.xml
      sed -i "s/policy\.tag\.auto\.linux\.x86/policy\.tag\.auto\.linux\.ARM_le/g" ${SYNOPKG_PKGDEST}/bliss-bundle/repository.xml
    fi
    if [ ${SYNO_CPU_ARCH} == "ppc" ]; then
      sed -i "s/jnotify\.linux\.x86/jnotify\.linux\.PowerPC/g" ${SYNOPKG_PKGDEST}/bliss-bundle/repository.xml
      sed -i "s/policy\.tag\.auto\.linux\.x86/policy\.tag\.auto\.linux\.PowerPC/g" ${SYNOPKG_PKGDEST}/bliss-bundle/repository.xml
    fi
    
    #overwrite native lib bundles with syno versions (in case of an in-app update)
    cp ${SYNOPKG_PKGDEST}/syno-native/* ${SYNOPKG_PKGDEST}/bliss-bundle

    #start daemon in background mode
    echo "Starting ${SYNOPKG_PKGNAME} ... "
    su - ${DAEMON_USER} -s /bin/sh -c "cd ${SYNOPKG_PKGDEST}/bin && ./${ENGINE_SCRIPT} > ${SYNOPKG_PKGDEST}/bliss.out 2>&1 &"
    sleep 2
    PID=`_findpid`
    if [ -n "$PID" ]; then
      echo $PID > $PIDFILE
      echo "OK"
    else
      echo "FAIL"
      exit 1
    fi

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

  stop)
    echo -n "Stopping daemon ... "
    if [ -f $PIDFILE ] ; then
      kill `cat $PIDFILE`
      sleep 10
    fi
    PID=`_findpid`
    if [ -n "$PID" ]; then
      echo "Still running, killing PID=$PID ... "
      kill -9 $PID
    fi
    rm -f $PIDFILE
    echo "OK"
    
    #remove DSM icon symlink
    if [ -e /usr/syno/synoman/webman/3rdparty/${SYNOPKG_PKGNAME} ]; then
      rm /usr/syno/synoman/webman/3rdparty/${SYNOPKG_PKGNAME}
    fi

    exit 0
  ;;

  status)
    PID=`_findpid`
    if [ -n "$PID" ]; then
      exit 0
    else
      exit 1
    fi
  ;;

  log)
    echo "${SYNOPKG_PKGDEST}/bliss.out"
    exit 0
  ;;
esac
 

Changelog:

  • 20130213-0009 Updated to Bliss 20130213, and will correctly report version in Package Center after an in-app update
  • 20130131-0008 Updated to Bliss 20130131
  • 20121112-0007 Fixes for DSM 4.2
  • 20121112-006 Updated to Bliss 20121112
  • 20121019-005 Updated to Bliss 20121019
  • 20121002-004 Updated to Bliss 20121002
  • 20120830-003 Added support for Freescale QorIQ PowerPC CPUs used in some Synology x13 series products, PowerPC processors in previous Synology generations with older glibc versions are not supported
  • 20120830-002 Hopefully fixed Java prefs polling issue that prevented NAS hibernation
  • 20120830-001 initial public release

 
 
About these ads

110 thoughts on “Bliss album art manager package for Synology NAS

    1. patters Post author

      Depends whether that package sets up the environment variables properly (PATH, JAVA_HOME), and whether it includes locale and UTF-8 support. If it doesn’t then you’ll have issues.

      Reply
  1. Nicola

    While scanning albums I get lots of “Error while executing oleranceAutomaticFixerPolicyCommand” . (The error is visible if I click under compliance results of each Album “unknown” )

    Reply
  2. Milan

    while installing I get an error: port 3220 is used by an other service. What can I do (i have no idea what service uses 3220)

    Reply
    1. patters Post author

      If you had a previous version on there, or have uninstalled and then are trying to reinstall, Package Center sometimes does this. Usually it’s fine after waiting a minute or two, or failing that you could try rebooting your syno.

      Reply
  3. matt

    really interesting post, shows a lot more patience for trawling through arcane compiler errors and stack overflow answers than I could ever have!

    Reply
  4. Alessandro

    everything was running fine, then today package center reported an update to the package and I tried installing it: first time it failed and I got stuck (couldn’t reinstall), so I rebooted, reinstalled again and this time worked, even though I lost all settings. After starting bliss, package center reported an update again, but version is always the same. What’s going on?

    BTW: putting file http://www.blisshq.com/downloads/bliss-install-20121002.jar in “public” share doesn’t work, the installer script always downloads with wget from blisshq.com.

    Reply
    1. patters Post author

      Looks like Dan has published an in-app update. This is the first time it’s happened since I released the package, and although I liaised with him on how to handle this – it obviously needs work. I’ll investigate…

      Reply
      1. Alessandro

        I tried updating in-app but it says I have the latest version, doesn’t seem that Dan published an update. I debugged a little bit and noticed that your script calls an url on dan’s site to discover the latest jar and then downloads it to install it. After the first installation, when the update notification appears and I run it, the same jar gets downloaded. That’s when I noticed that the update notification was a “false positive”. :)

        BTW: I tried putting the jar downloaded in the public share (same procedure as Java SE runtime installation), but the installer doesn’t care, it always redownloads the same jar again.

  5. patters Post author

    I have released a new version, but it looks like the in-app update stuff didn’t work. I guess I’ll have to freshen the package each time Dan updates for the time being.

    Reply
    1. Alessandro

      I just rechecked in-app update:

      “The current version of bliss is 20121002. You are using the latest version.”

      This is always the case, since I installed bliss using your package. Don’t think dan released any update ’til now.

      What is the trigger of the update icon in DSM for this package? What gets checked in order to tell users to update?

      Reply
      1. Dan Gravell

        Currently the check for the latest version only works each time you restart! So this is likely to be wrong when running “forever” on a Synology NAS.

  6. Harald Fuchs

    i have got a problem with fingerprinting on my synology (Linux foxbox 2.6.32.12 #2647 Wed Sep 26 03:18:29 CST 2012 armv5tel GNU/Linux synology_88f6282_212+).
    I have written an email to dan already and he told me to post in your forum (Dan: “The guy that created the Synology version had to build a new version of the fingerprinter.”)
    i also sent him a part of the logfile which i attached. can you help me with this problem or is there already a solution i can apply?

    2012-11-06 15:39:36,949 (thread BlockingLowPriorityBufferStorageNotificationBus-notification worker) DEBUG Received updated untagged: /volume1/neueMusik/_unsorted/Tocotronic - Kapitulation(1).mp3,/volume1/neueMusik/_unsorted/Anton Karas - Harry Lime (Third Man's Theme).mp3,/volume1/neueMusik/_unsorted/Van Morrisson - Brown Eyed Girl.mp3,/volume1/neueMusik/_unsorted/Jimi Hendrix - The Wind Cries Mary.mp3,/volume1/neueMusik/_unsorted/Aretha Franklin - Respect.mp3 (UntaggedSuggestionStorageNotificationListener.java:70)
    2012-11-06 15:39:42,859 (thread UntaggedSuggestionStorageNotificationListener) ERROR Exception while fingerprinting /volume1/neueMusik/_unsorted/Tocotronic - Kapitulation(1).mp3 (AudioFingerprint.scala:94)
    java.lang.RuntimeException: Nonzero exit value: 2
        at scala.sys.package$.error(package.scala:27)
        at scala.Predef$.error(Predef.scala:66)
        at process.AbstractProcessBuilder.getString(ProcessImpl.scala:140)
        at process.AbstractProcessBuilder.$bang$bang(ProcessImpl.scala:142)
        at com.elsten.bliss.policy.tag.auto.FpCalc$class.exec(AudioFingerprint.scala:88)
        at com.elsten.bliss.policy.tag.auto.FpCalcLinux$.exec(AudioFingerprint.scala:107)
        at com.elsten.bliss.policy.tag.auto.AudioFingerprintFromFile.calc(AudioFingerprint.scala:133)
        at com.elsten.bliss.policy.tag.auto.AudioFingerprint.result(AudioFingerprint.scala:120)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$$anonfun$5.apply(AcoustidLookup.scala:104)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$$anonfun$5.apply(AcoustidLookup.scala:104)
        at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:213)
        at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:60)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:44)
        at scala.collection.TraversableLike$class.filter(TraversableLike.scala:212)
        at scala.collection.mutable.ArrayBuffer.filter(ArrayBuffer.scala:44)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$.forItems(AcoustidLookup.scala:104)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$.forFiles(AcoustidLookup.scala:37)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup.forFiles(AcoustidLookup.scala)
        at com.elsten.bliss.untagged2.AcoustidUntaggedRecognitionStrategy.lookupFileResults(AcoustidUntaggedRecognitionStrategy.java:312)
        at com.elsten.bliss.untagged2.AcoustidUntaggedRecognitionStrategy.doSuggest(AcoustidUntaggedRecognitionStrategy.java:150)
        at com.elsten.bliss.untagged2.AcoustidUntaggedRecognitionStrategy.suggest(AcoustidUntaggedRecognitionStrategy.java:131)
        at com.elsten.bliss.untagged.UntaggedSuggestionStorageNotificationListener$Consumer.run(UntaggedSuggestionStorageNotificationListener.java:43)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
    2012-11-06 15:39:43,011 (thread UntaggedSuggestionStorageNotificationListener) ERROR Exception while fingerprinting /volume1/neueMusik/_unsorted/Anton Karas - Harry Lime (Third Man's Theme).mp3 (AudioFingerprint.scala:94)
    java.lang.RuntimeException: Nonzero exit value: 2
        at scala.sys.package$.error(package.scala:27)
        at scala.Predef$.error(Predef.scala:66)
        at process.AbstractProcessBuilder.getString(ProcessImpl.scala:140)
        at process.AbstractProcessBuilder.$bang$bang(ProcessImpl.scala:142)
        at com.elsten.bliss.policy.tag.auto.FpCalc$class.exec(AudioFingerprint.scala:88)
        at com.elsten.bliss.policy.tag.auto.FpCalcLinux$.exec(AudioFingerprint.scala:107)
        at com.elsten.bliss.policy.tag.auto.AudioFingerprintFromFile.calc(AudioFingerprint.scala:133)
        at com.elsten.bliss.policy.tag.auto.AudioFingerprint.result(AudioFingerprint.scala:120)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$$anonfun$5.apply(AcoustidLookup.scala:104)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$$anonfun$5.apply(AcoustidLookup.scala:104)
        at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:213)
        at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:60)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:44)
        at scala.collection.TraversableLike$class.filter(TraversableLike.scala:212)
        at scala.collection.mutable.ArrayBuffer.filter(ArrayBuffer.scala:44)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$.forItems(AcoustidLookup.scala:104)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$.forFiles(AcoustidLookup.scala:37)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup.forFiles(AcoustidLookup.scala)
        at com.elsten.bliss.untagged2.AcoustidUntaggedRecognitionStrategy.lookupFileResults(AcoustidUntaggedRecognitionStrategy.java:312)
        at com.elsten.bliss.untagged2.AcoustidUntaggedRecognitionStrategy.doSuggest(AcoustidUntaggedRecognitionStrategy.java:150)
        at com.elsten.bliss.untagged2.AcoustidUntaggedRecognitionStrategy.suggest(AcoustidUntaggedRecognitionStrategy.java:131)
        at com.elsten.bliss.untagged.UntaggedSuggestionStorageNotificationListener$Consumer.run(UntaggedSuggestionStorageNotificationListener.java:43)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
    2012-11-06 15:39:43,100 (thread UntaggedSuggestionStorageNotificationListener) ERROR Exception while fingerprinting /volume1/neueMusik/_unsorted/Van Morrisson - Brown Eyed Girl.mp3 (AudioFingerprint.scala:94)
    java.lang.RuntimeException: Nonzero exit value: 2
        at scala.sys.package$.error(package.scala:27)
        at scala.Predef$.error(Predef.scala:66)
        at process.AbstractProcessBuilder.getString(ProcessImpl.scala:140)
        at process.AbstractProcessBuilder.$bang$bang(ProcessImpl.scala:142)
        at com.elsten.bliss.policy.tag.auto.FpCalc$class.exec(AudioFingerprint.scala:88)
        at com.elsten.bliss.policy.tag.auto.FpCalcLinux$.exec(AudioFingerprint.scala:107)
        at com.elsten.bliss.policy.tag.auto.AudioFingerprintFromFile.calc(AudioFingerprint.scala:133)
        at com.elsten.bliss.policy.tag.auto.AudioFingerprint.result(AudioFingerprint.scala:120)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$$anonfun$5.apply(AcoustidLookup.scala:104)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$$anonfun$5.apply(AcoustidLookup.scala:104)
        at scala.collection.TraversableLike$$anonfun$filter$1.apply(TraversableLike.scala:213)
        at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:60)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:44)
        at scala.collection.TraversableLike$class.filter(TraversableLike.scala:212)
        at scala.collection.mutable.ArrayBuffer.filter(ArrayBuffer.scala:44)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$.forItems(AcoustidLookup.scala:104)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup$.forFiles(AcoustidLookup.scala:37)
        at com.elsten.bliss.policy.tag.auto.AcoustidLookup.forFiles(AcoustidLookup.scala)
        at com.elsten.bliss.untagged2.AcoustidUntaggedRecognitionStrategy.lookupFileResults(AcoustidUntaggedRecognitionStrategy.java:312)
        at com.elsten.bliss.untagged2.AcoustidUntaggedRecognitionStrategy.doSuggest(AcoustidUntaggedRecognitionStrategy.java:150)
        at com.elsten.bliss.untagged2.AcoustidUntaggedRecognitionStrategy.suggest(AcoustidUntaggedRecognitionStrategy.java:131)
        at com.elsten.bliss.untagged.UntaggedSuggestionStorageNotificationListener$Consumer.run(UntaggedSuggestionStorageNotificationListener.java:43)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
    
    Reply
    1. patters Post author

      Which version of DSM are you running? It was compiled against DSM 4.1′s FFmpeg libraries if I recall. I may have a workaround (something I did for Serviio) but I still need to update the Synology Bliss package to Dan’s latest release – something I haven’t yet found time to do.

      Reply
      1. Harald Fuchs

        thank you for the quick reply. My version of dsm is 4.1-2647. Maybe you have got time to update the bliss package sometime. Let me know if you need further information. I would be happy to keep bliss running on my box.

  7. Joerg

    I’m very interested on your Chromaprint and fpcalc libaries/binaries for Synology.
    I need fpcalc for fingerprinting with beet (a python mp3 tagger).

    Where can I find the files/libaries?

    Reply
    1. patters Post author

      Hi, sorry about the delay – I forgot to reply to your comment. Install the package, then let it scan some music, preferably a track with an ambiguous name and it will extract fpcalc to /volume1/@tmp/Bliss/fpcalc_linux. If you use it in another project please can you credit me and link back to this page. Thanks.

      Reply
    1. Harald Fuchs

      i’m afraid fingerprinting still does not work. after updating i get the same error in the log. Is there anything else to do but updating the sysno-package? (error: 2012-11-13 08:28:31,617 (thread UntaggedSuggestionStorageNotificationListener) ERROR Exception while fingerprinting /volume1/neueMusik/testfiles/Marvin Gaye – Whats Going On.mp3 (AudioFingerprint.scala:94)
      java.lang.RuntimeException: Nonzero exit value: 2)

      Reply
      1. Dan Gravell

        I’m seeing this a few times too. I’m in the process of gathering info about the Synology models affected. The latest I’ve heard it occurring with is the DS713+

  8. Harald Fuchs

    My version of dsm is 4.1-2647
    Linux foxbox 2.6.32.12 #2647 Wed Sep 26 03:18:29 CST 2012 armv5tel GNU/Linux synology_88f6282_212+

    Reply
    1. patters Post author

      What happens when you run /volume1/@tmp/Bliss/fpcalc_linux
      Try manually fingerprinting a test file. If that works then there’s nothing wrong with the package but perhaps the audio file is corrupt in some way. I have that same DSM version, and with armv5tel CPU.

      Reply
      1. patters Post author

        Can you reboot your syno? The copy of fpcalc in your @tmp folder is the one from before I fixed the package. Let Bliss run for a bit and it will extract it again, then it should work. I’ll need to fix the uninstaller to clean that up.

      2. Harald Fuchs

        After the reboot it seems to work now. but fingerprinting still does not recognize any songs. i wrote an email to dan now. i will keep you informed if i get any news.

      3. gravelld

        I’m watching this thread :) Maybe some extra validation I’ve added to avoid false positives. Once you’ve uploaded the files to the folder I invited you to, Harald, I’ll take a look.

  9. Jim

    Ok i have a DS212+ and i was running the last version just fine, it worked great and i bought the unlimited license, now that i upgraded to the latest package it is no longer running, when i look at the log file through the package center there is a big long list of Java errors starting with “Failed to start shutdown monitor because could’nt open the server socket (ShutdownMonitor.java:36, thread FelixStartLevel) java.net.bindException: Address already in use

    it states that the address already in use sevral times in the log

    I am using your Java package embedded 7 1.7.0_06-010

    not sure what other information might might need to steer me in the right direction.

    Reply
      1. Jim

        I have rebooted a couple of times as well as uninstall and reinstall, how do I copy the log file out, also what command do I use to delete a folde that is not empty using telnet and logged in as root, I am trying the fixes that Dan suggested

      2. Jim

        So i sent Synology support the kernal log file from my system and they said the the Bliss package is running amuck, and that i needed to remove it to get it back to normal, here is what was in the log file i am hoping it means more to you than it does to me.

        The log was flooded with these messages just before you restarted the unit. It looks like these processes were building up in the system and when you restarted, the system attempted to kill them all:

        Nov 19 09:43:29 killps: Kill the process “/volume1/@appstore/java7/jre/bin/java” with /volume1/@appstore/Bliss/felix-cache/bundle13/version0.0/bundle.jar.
        Nov 19 09:43:29 killps: Kill the process “/volume1/@appstore/java7/jre/bin/java” with /volume1/@appstore/Bliss/felix-cache/bundle14/version0.0/bundle.jar.
        Nov 19 09:43:29 killps: Kill the process “/volume1/@appstore/java7/jre/bin/java” with /volume1/@appstore/Bliss/felix-cache/bundle15/version0.0/bundle.jar.
        Nov 19 09:43:29 killps: Kill the process “/volume1/@appstore/java7/jre/bin/java” with /volume1/@appstore/Bliss/felix-cache/bundle16/version0.0/bundle.jar.
        Nov 19 09:43:29 killps: Kill the process “/volume1/@appstore/java7/jre/bin/java” with /volume1/@appstore/Bliss/felix-cache/bundle17/version0.0/bundle.jar.
        Nov 19 09:43:29 killps: Kill the process “/volume1/@appstore/java7/jre/bin/java” with /volume1/@appstore/Bliss/felix-cache/bundle18/version0.0/bundle.jar.
        Nov 19 09:43:29 killps: Kill the process “/volume1/@appstore/java7/jre/bin/java” with /volume1/@appstore/Bliss/felix-cache/bundle19/version0.0/bundle.jar.
        Nov 19 09:43:29 killps: Kill the process “/volume1/@appstore/java7/jre/bin/java” with /volume1/@appstore/Bliss/felix-cache/bundle20/version0.0/bundle.jar.
        Nov 19 09:43:29 killps: Kill the process “/volume1/@appstore/java7/jre/bin/java” with /volume1/@appstore/java7/jre/lib/rt.jar.

      3. Dan Gravell

        Did they provide any more detail other than “running amuck”? That could mean anything.

        BTW, bliss is not fully tested against Java 1.7. It should work, but there are possibilities things could go wrong. Do you have a /tmp/bliss.log file you can send me?

      4. gravelld

        A few other thoughts on the logs Jim has provided…

        The multitude of processes… could these be processes, or could they be threads-as-processes, i.e. the threads started by bliss? bliss will, for instance, assess five albums at the same time, and runs five threads for this.

        Jim also provided a screenshot by email. The pertinent error message, which I have mangled slightly for this comment, was:

        Error accessing file:/volume1/@appstore/Bliss/bliss-bundle/com.elsten.bliss.policy.coverart.lookup.discogs-2.0.1.jar (No such file or directory)

        This file is no longer hosted on blisshq.com – the latest version of the discogs bundle is 2.0.3 and that’s all that is deployed.

      5. Jim

        Since this has not been fully tested on Java 7 i am swapping it out for JAVA 6, i am currently resyncing my crash plan and then will reboot and try ou Bliss again and let you know how it goes.

      6. Jim

        Using java 6 did not make any difference, I’m just about ready to reset the is on my system to see if it works after that, I’m running out of ideas

      7. Jim

        so interesting happenstance, on a while i tried connecting to Bliss and it was actually running even though package center states that the app is not running.

      1. Jim

        So far I can get into where the files that need to be removed are but it won’t let me delete a folder that is not empty and I am trying to figure out how to copy the error message out I may end up taking a screen shot and emailing you

  10. Denis

    Hi (again)

    Some IP-addresses have just tried to bruteforce into my DiskStation :-( Could they in any way use the bliss user to access it? I do also have a plex user and Jomla do you maybe know about them? What is actually the password for the bliss user? And can i see which login (and passwords) they have tried in some kind of log file, couse i’m really interested to know that :-)

    Sorry for the (maybe) off-topic question, but I didn’t knew any other places to ask :-)

    Reply
  11. Andrew Ross

    Hi,

    I have just installed bliss on my Synology DS213air. bliss is reported to be running but I can’t connect either by hostname (diskstation) or directly by IP address. I am able to access the admin interface on port 5000 and there are no rules in the firewall. By way of a bit of diagnostics I ssh’d in to the NAS and note the following:

    ps | grep bliss

    returns with

    8640 bliss 241m S /volume1/@appstore/java7/jre/bin/java -Djava.io.tmpdir=/volume1/@tmp/Bliss -Djava.util.prefs.syncInterval=86400 -Xmx1

    so it looks like it is running.

    A quick netstat | grep 3220

    Returns nothing!

    Quick sanity check netstat | grep 5000

    tcp 0 0 ::ffff:192.168.4.220%18:5000 ::ffff:192.168.4.200%3202210100:53258 ESTABLISHED

    cd /volume1/@appstore/Bliss/bin to run bliss.sh manually returns this:

    ERROR: Error creating bundle cache. (java.lang.Exception: Unable to create bundle cache lock file: java.io.FileNotFoundException: ././../felix-cache/cache.lock (Permission denied))
    java.lang.Exception: Unable to create bundle cache lock file: java.io.FileNotFoundException: ././../felix-cache/cache.lock (Permission denied)
    at org.apache.felix.framework.cache.BundleCache.(BundleCache.java:168)
    at org.apache.felix.framework.Felix.init(Felix.java:629)
    at org.apache.felix.main.Main.main(Main.java:289)
    Could not create framework: org.osgi.framework.BundleException: Error creating bundle cache.
    org.osgi.framework.BundleException: Error creating bundle cache.
    at org.apache.felix.framework.Felix.init(Felix.java:634)
    at org.apache.felix.main.Main.main(Main.java:289)
    Caused by: java.lang.Exception: Unable to create bundle cache lock file: java.io.FileNotFoundException: ././../felix-cache/cache.lock (Permission denied)
    at org.apache.felix.framework.cache.BundleCache.(BundleCache.java:168)
    at org.apache.felix.framework.Felix.init(Felix.java:629)
    … 1 more

    Permissions check

    drwxr-xr-x 9 bliss users 4096 Nov 23 20:21 felix-cache

    which explains why I can’t run bliss as I’m not logged in as a bliss user and I don’t expect that bliss has a shell account so I’m a bit stumped now.

    Any suggestions on how to proceed now please?

    Reply
    1. patters Post author

      Don’t launch it as root ,it will mess up the file and folder permissions for when the daemon user tries to launch. Remove the package, reboot, then re-install, and try again. The log that you can see in Package Center will report all output.

      Reply
      1. Andrew Ross

        When you say don’t launch it as “root”, do you mean don’t launch it as “admin”? admin is the only account I have set up on the box. Should I create a “normal” user account and run it from that?

      2. patters Post author

        You can log in on SSH using the user name ‘root’ which has the same password that you set for the admin account. Running any of the packages manually as a user that’s not the daemon account they normally use will tend to mess things up though by changing the permissions on log and config files such that the daemon user is subsequently unable to access them.

      3. Andrew Ross

        Hi,

        Please ignore my last reply. I reinstalled and rebooted and everything is good. Thanks.

        Andy

  12. brunchto

    Hi,

    I’ve got an error when launching the package after the update. bliss is working if i connect to the bliss 3320 port, but launching package cause an error while repairing. no icon is created in the DSM. and since the package is not “launched” i cannot stop it from the DSM.

    Reply
    1. brunchto

      i always have this problem. i’ve uninstalled package, reboot the syno, then reinstall. but no way to lauch the package. I’ve got a bliss “licence” and i also use crashplan package

      Reply
  13. David

    Removed, reboot, re-installed, still doesn’t work. Does it matter if you are on the LAN when you install it or can I be remote using my external DDNS address? I’m doing this from the Office rather than at home on my LAN

    Reply
      1. David

        I realise that but the fact is it doesn’t work at home on the LAN either, also the Syno is in a DMZ.

  14. Jim

    Dan what does this error mean?

    Error while executing ToleranceAutomaticFixerPolicyCommand

    java.lang.RuntimeException: Exception occured executing MoveAlbumAndInformPlatformCallable
    at com.elsten.bliss.music.conceptual.model.ChangeOnlyAlbumMapper.submit(ChangeOnlyAlbumMapper.java:177)
    at com.elsten.bliss.music.conceptual.model.ChangeOnlyAlbumMapper.moveAlbum(ChangeOnlyAlbumMapper.java:235)
    at com.elsten.bliss.music.policy.fileorg.AggregatedFilePathResponse.execute(AggregatedFilePathResponse.java:89)
    at com.elsten.bliss.music.policy.ToleranceAutomaticFixerPolicyCommand.execute(ToleranceAutomaticFixerPolicyCommand.java:54)
    at com.elsten.bliss.music.conceptual.model.AggregatedPolicyCommand.executeChildPolicy(AggregatedPolicyCommand.java:62)
    at com.elsten.bliss.music.conceptual.model.AggregatedPolicyCommand.execute(AggregatedPolicyCommand.java:45)
    at com.elsten.bliss.music.conceptual.model.AlbumComplianceUpdate.execute(AlbumComplianceUpdate.java:53)
    at com.elsten.bliss.music.conceptual.model.ExclusiveAlbumMusicModelListener$ExclusiveComplianceUpdate.execute(ExclusiveAlbumMusicModelListener.java:127)
    at com.elsten.bliss.music.policy2.PerFixLicensedPolicyCommandExecutor.executeCommand(PerFixLicensedPolicyCommandExecutor.java:101)
    at com.elsten.bliss.music.policy2.InMemoryMusicPolicyDistributor.albumUpdated(InMemoryMusicPolicyDistributor.java:61)
    at com.elsten.bliss.music.policy2.PersistedActivationMusicPolicyDistributor.albumUpdated(PersistedActivationMusicPolicyDistributor.java:105)
    at com.elsten.bliss.music.conceptual.model.ThreadedMusicModelListener$2.run(ThreadedMusicModelListener.java:97)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.NullPointerException: Null tagKey is not allowed
    at com.elsten.bliss.platform.tagindex.JdbmTagIndex$TaggedRecordIndexKeys.(JdbmTagIndex.java:315)
    at com.elsten.bliss.platform.tagindex.JdbmTagIndex.lookupIndexKeys(JdbmTagIndex.java:354)
    at com.elsten.bliss.platform.tagindex.JdbmTagIndex.lookupIndexKeys(JdbmTagIndex.java:348)
    at com.elsten.bliss.platform.tagindex.JdbmTagIndex.removeFromStorageNodeToTaggedRecords(JdbmTagIndex.java:458)
    at com.elsten.bliss.platform.tagindex.JdbmTagIndex.access$4(JdbmTagIndex.java:456)
    at com.elsten.bliss.platform.tagindex.JdbmTagIndex$JdbmTagStoreDataImpl.removeUniDirectional(JdbmTagIndex.java:577)
    at com.elsten.bliss.platform.tagindex.model.UniDirectionalTaggedCommand.remove(UniDirectionalTaggedCommand.java:27)
    at com.elsten.bliss.platform.tagindex.model.TabledTagIndex.deleteQuietly(TabledTagIndex.java:84)
    at com.elsten.bliss.music.conceptual.model.PlatformAlbumMapperImpl.updateTagIndexAndMusicModelFromStorageNodes(PlatformAlbumMapperImpl.java:94)
    at com.elsten.bliss.music.conceptual.model.PlatformAlbumMapperImpl.access$0(PlatformAlbumMapperImpl.java:84)
    at com.elsten.bliss.music.conceptual.model.PlatformAlbumMapperImpl$MoveAlbumAndInformPlatformCallable.call(PlatformAlbumMapperImpl.java:239)
    at com.elsten.bliss.music.conceptual.model.ChangeOnlyAlbumMapper$MoveAlbumCallable.call(ChangeOnlyAlbumMapper.java:1)
    at com.elsten.bliss.music.conceptual.model.ChangeOnlyAlbumMapper.submit(ChangeOnlyAlbumMapper.java:174)
    … 17 more

    Reply
  15. Alessandro Del Prete

    I tried updating Bliss using internal update feature and it didn’t restart.

    I uninstalled now, but before installing again and reconfiguring everything I’d like to know if I’m the only one with this issue and if it is safe to update in-app or I should wait for the package release.

    Thanks.

    Reply
    1. Alessandro Del Prete

      I’ve just reinstalled, latest version installed automagically, database was empty but my previous settings were retained. Great. Now it’s rescanning everything…let’s cross fingers…:)

      Reply
    1. mckaycr

      nevermind, I went to the web address anyway and i can access the gui, so I’m assuming all is good to go

      Reply
    2. Raff

      I’m getting this error, but I can’t access from the web server address, so i know it’s not running.

      tried reinstalling.

      now on dsm4.2 beta 3161 on a 712+

      still won’t run.
      lots of java errors in log, but i followed java 6re instructions?

      Reply
      1. Timothy Taylor

        I have Perl package installed and I am getting the “failed to run package service”
        Are there some logs that will give more info on why the package service will not run?

      2. Timothy Taylor

        Yes, I have a bliss user that was part of the users group. I tried to give it as much privileges as I could but was still not able to get the package service to start.

        I have am using dsm4.2 beta 3161 on a 413j

  16. Jason L

    Hi Patters,
    Bliss is live with Release 20130213 – do you know when the updated Bliss Synology package will be available?
    Thanks, Jason

    Reply
  17. Jason L

    Hi Patters,
    No it does not work unfortunately. If I click on update from within the Bliss web page, it states: The current version of bliss is 20130131. You are using the latest version.
    I usually update via Synology Package Center when it indicates there is an update available. Jason

    Reply
  18. Jason L

    Thanks for that Dan.
    Question – if I update directly from Bliss, would this create a disconnect from the version that Synology thinks it is running within the ‘Synology Package Center’
    As mentioned before, to date, I have always done upgrades via ‘Synology Package Center’

    Reply
      1. patters Post author

        No, it will be fine. Package Center will only offer an upgrade if the repo-hosted version number is greater. If your local version is greater it will be fine. I made the Bliss daemon startup script check the Bliss jar file’s manifest to determine the version, and made it update the Synology package metadata to match every time it starts up. So the version that you see reported in Package Center should change once you run an in-app update (you would need to restart the package to see that). I just tested the in-app update myself and it seems fine apart from that version number update in Package Center – I’ll investigate that…

        Dan – does Bliss only check for updates as it starts then? Would you consider a check once every 24 hours as well?

      2. patters Post author

        Dan – following the in-app update the manifest in bliss-bundle/com.elsten.bliss.bundle-0.0.0.jar is still showing the older version number. Is that because the newer version of Bliss is unpacked elsewhere, or did you forget to update the manifest in the new version?

      3. gravelld

        It should be 0.0.0.201302131248 . I’m wondering if you are receiving a cached version from CloudFront (the CDN)?

  19. Jason L

    Thanks for that Patters – I ran the in-app update and Bliss updated and shows me latest version. I then stopped and restarted Package but still see the old version number (as you described above too)

    Reply
  20. Shivaran

    Hi everybody,

    It seems Bliss doesn’t scan for new music after the initial scan. I have to manually “clear and rescan” the database each time.

    I’ve tried moving the files around; changing permissions… To no avail.
    I’ve sent logs to Dan but he doesn’t seem to find anything wrong with them at first glance.

    Any ideas?

    Reply
  21. Shivaran

    Well, after rebooting/restarting everything, it seems to be working now… Not sure what was happening. Maybe a service hadn’t been started properly or something.

    Anyways, I already thanked Dan for his piece of software but I got to thank patters for the port :)

    Reply
  22. Jim

    Patters is there a way to permanently remove this from from my system? Right now it will not display that it is running in the package centers even though it is, I have even gone as far as to push the reset button 2 times and re-install DSM for scratch then installed everything again but it appears that the Bilss database was still there because it did not need to re scan and i did not have to enter my unlimited fix code either.

    Reply
    1. Dan Gravell

      The bliss database is, by default, in ~/.bliss/data . I can’t remember if the Synology version puts that somewhere other than the home folder. You can remove that manually.

      Reply
    2. Jim

      you’ll have to forgive me i am not so fluent with Linux commands, what command would i use to remove that directory and its contents, and is that the only place to look for remnants of the install?

      Reply
      1. gravelld

        You should be able to do:

        ls /var/services/homes/bliss

        That should list the data folder, a file called settings, activePolicies etc.

        If that is the case do:

        cd /var/services/homes/bliss
        rm -rf data

      2. Jim

        interesting the bliss folder in homes went away after doing an uninstall, but something somewhere is still persisting that has settings and everything else about bliss in it.

      3. Jim

        never mind i guess after resetting my DSM and re installing i needed to install Bliss then uninstall it and then re install it to get everything back to normal again

  23. yorkie71

    I’d really love to get this working on my DS212j, and very nearly did but seem to have stopped now. I followed the installation instructions to the letter and all seemed to install until Bliss tried to run which threw up the “failed to run package service” error. Checked the log and things seemed to be happening but the service was still stopped. When trying to start I get the “failed to run package service” error.

    When going to the web address I was oddly able to load up, configure and start scanning so it seemed to be working even though the app was stopping in the Package Centre.

    I was on the verge of getting the unlimited licence too as Bliss seemed just what I needed.

    Any suggestions on how to get this working please?

    Reply
    1. Jim

      I had a lot of problems with this as well, I ended up resetting my ds and reinstalling it from scratch, though afterwords I found this not nessisarry. In install bliss the you will have to ssh or telnet into your ds and remove and home directorys associated wil bliss. If you look at blisshq.com there are som faqs that list the files your looking for and if you read through this thread there is more information

      Reply
      1. yorkie71

        Thanks Jim. So are you saying that you have managed to get Bliss working fully now?

    2. Jim

      Yup it works now, starting and stopping from dsm as well as when I uninstall and reinstall all settings go to default

      Reply
  24. Rico

    Thanks for creating this package on Synology.
    After an upgrade of the Bliss package (through the package manager of Synology) a new user is created (with a new uid). This brings many permission error messages when moving files with Bliss. Can you please adjust the package, so that when doing an upgrade no longer is the Bliss user deleted?
    Thanks!

    Reply
    1. Thesalan

      Same issue for me on my Synology. I hope this can be fixed soon… With these permission error, I prefer to not update Bliss unless this isn’t fixed

      Reply
  25. erikr

    Hi,

    First off, appreciate the effort you put into making Bliss work on the Synology NAS! :)

    It seems like a great app, just what I need to move on from a desktop version of Media Monkey which I used to automate music library indexing.

    However, is anyone else experiencing a really slow NAS after installing? Not only is the bliss user interface very sluggish, bordering on useless to be honest, but also the actual web admin for the NAS is sluggish. Any ideas?

    This affects the manual updating of for example file structures, takes ages from clicking the fix button to it actually being done.

    Also tried the in-app update button the other day, which completely broke the Bliss package and returned a 404 error in the admin. Maybe this isn’t supposed to be used?

    Accessing the Bliss user interface from a remote location using Synologys DynDNS doesn’t seem to be working, opened up the port 3220 and the Synology Web admin and services is working using the same DynDNS, suggestions?

    Do I need to change any read/write settings for the Bliss user that is being created? Right now it doesn’t have access to any of the folders.

    Hope you got some tips, otherwise I guess I’ll remove it waiting for a future update. Got the unlimited pack though so might try some desktop version of it.

    My specs:

    Synology DS211
    DSM 4.2-3202
    Bliss 2003-02-13-0009

    Reply
    1. Dan Gravell

      Hi @erikr . About the in-app update… this can happen sometimes, it’s still not a seamless process. Deleting then re-installing I think should fix this but maybe patters should confirm that there isn’t any other side effect.

      I know patters is also working on some stuff around the user and permissions on install/uninstall.

      Reply
  26. Antony

    Hi,

    I just thought I would provide a little feedback on a few issues I encountered when installing the Bliss package on my Synology DS1511+/DX510 system.

    First a couple of minor issues with the installation (at least on my setup). The problem I experienced was due to my system setup where I have 2 volumes, volume1 on the DS1511+ and volume2 on the DX510 (used for backups). When I installed Bliss I requested that it be installed on volume1, which was honoured. However due to assumptions in the installer.sh and start-stop-status.sh scripts I ended up with an installation with Bliss’s temporary directory setup to be in volume2 (/volume2/@tmp/Bliss) which is not what I wanted and also prevented Bliss from starting. The following are the patches I made to installer.sh:

    >>> cut here <<nul`”
    +DAEMON_PASS=”`openssl rand 12 -base64 2>/dev/null`”
    DAEMON_ID=”${SYNOPKG_PKGNAME} daemon user”
    ENGINE_SCRIPT=”bliss.sh”
    MIGRATION_FOLDER=”${DAEMON_USER}_data_mig”
    @@ -17,7 +17,7 @@
    INSTALL_FILES=”${DOWNLOAD_URL}”
    source /etc/profile

    -TEMP_FOLDER=”`find / -maxdepth 2 -name ‘@tmp’ | head -n 1`”
    +TEMP_FOLDER=”${SYNOPKG_PKGDEST}/../../@tmp”
    APP_TEMP=”${TEMP_FOLDER}/${SYNOPKG_PKGNAME}”
    DAEMON_HOME=”`cat /etc/passwd | grep “${DAEMON_ID}” | cut -f6 -d’:'`”
    PRIMARY_VOLUME=”/`echo $TEMP_FOLDER | cut -f2 -d’/'`”
    @@ -142,7 +142,7 @@
    synouser –del ${DAEMON_USER}

    #clean up temp
    - [ -d ${TEMP_FOLDER}/Bliss ] && rm -r ${TEMP_FOLDER}/Bliss
    + [ -d ${APP_TEMP} ] && rm -r ${APP_TEMP}

    exit 0
    }
    >>> cut here <<>> cut here <<>> cut here <<<

    to rectify these issues. These changes solved the installation issues I was seeing.

    The final problem I had was with the special build of fpcalc_linux contained in syno-native/com.elsten.bliss.policy.tag.auto.linux.x86-1.0.0.jar (used to override the version supplied in the Bliss installer). I do not know if the problem is also present in the Bliss package from your web site but after I upgraded to the latest Bliss package from blisshq.com I discovered that since the DS1511+ is a 64-bit architecture Bliss was actually using fpcalc_linux64 from com.elsten.bliss.policy.tag.auto.linux.amd64-1.0.0.jar, supplied with the Bliss package. Since this will not run on the Synology due to GLIBC compatibly issues I saw thousands of errors in Bliss's log file. As a simple fix I copied fpcalc_linux from syno-native/com.elsten.bliss.policy.tag.auto.linux.x86-1.0.0.jar to /volume1/@tmp/Bliss and gave it the name fpcalc_linux64.

    Interestingly the lack of a 64-bit version of syno-packages/net.contentobjects.jnotify.linux.x86-0.94.0.jar (i.e. net.contentobjects.jnotify.linux.amd64-0.94.0.jar) does not seem to be causing any issues (but I have not being using Bliss very long).

    [FYI I upgraded Bliss because I saw other errors in the log file unrelated to the above issue with fpcalc_linux and the disappearance of some music files for an unknown reason. On restoring from backup and then upgrading (manually) and restarting Bliss with the above fixes my problems disappeared; no errors in Bliss's log file (apart from what I assume is expected moans about @eaDir) and no disappearing music tracks.]

    Cheers,
    Antony.

    Reply
    1. Antony

      Hmm, my patches seem to have been corrupted, let me try a different approach. In installer.sh the following lines are changed:

      10:DAEMON_PASS=”`openssl rand 12 -base64 2>/dev/null`”
      20:TEMP_FOLDER=”${SYNOPKG_PKGDEST}/../../@tmp”
      145: [ -d ${APP_TEMP} ] && rm -r ${APP_TEMP}

      (and as I tried to say the key change is line 20, the others are some other corrections I made) and in start-stop-status.sh the following line is changed:

      14: ps -w | grep “^ *[0-9]* ${DAEMON_USER} .*java.*-Djava\.io\.tmpdir=.*/@tmp/Bliss” | grep -v “grep” | awk ‘{ print $1 }’

      Reply
    2. patters Post author

      Interesting – thanks for the feedback. I haven’t had any time to keep these packages updated recently. I had been wondering for a while why on earth Synology make the 64bit toolchain available (even for the very first Intel models) because most of the DSM binaries are i686 on the models I used to have access to for testing. I presume it’s only some of the Intel products that are actually using the x64 binaries. I’ll try and sort that out soon.

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s