QNAP Maraschino

pablogiganti

Nouveau membre
1 Juillet 2015
10
0
0
Hi,
First of all I´d like to apologise for my null french and my pour english.
Secondly I´d like to thank you for the Qpython, Sickrage and Couchpotato versions you build. After some fiddling around I managed to make them work avoiding the SSL problem that was bugging me a lot.
Now I´m looking at installing Maraschino which by the look of it you are currently working on, is that right?
In the meantime, I researched a bit and found a useful post here:
http://forum.qnap.com/viewtopic.php?f=32&t=77644&p=348537&hilit=Maraschino+qpkg+x86#p348537

I followed all steps described by ginie66 (the author) but didn´t managed to start the app. So I then continued reading and found an alternative start up method described by aidy12 but didn't´t managed to start Maraschino either. I´m a total knob in all these stuff but I think the problem relies on the fct that I´m using your version of Python.
This is what aidy 12 suggests:

I added the following to to '/share/MD0_DATA/.qpkg/maraschino/maraschino.sh'. (which I adapted from sickbeard.sh)

Code:
#! /bin/sh

QPKG_NAME=Maraschino
QPKG_DIR=$(/sbin/getcfg $QPKG_NAME Install_Path -f /etc/config/qpkg.conf)
PATH="/opt/bin:/usr/bin/:$PATH"
PID_FILE="/tmp/$QPKG_NAME.pid"
DAEMON=/opt/bin/python2.7
DAEMON_OPTS="Maraschino.py -d --pidfile $PID_FILE"

CheckQpkgEnabled() { #Is the QPKG enabled? if not exit the script 
   if [ $(/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf) = UNKNOWN ]; then
      /sbin/setcfg ${QPKG_NAME} Enable TRUE -f /etc/config/qpkg.conf
   elif [ $(/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf) != TRUE ]; then
      /bin/echo "${QPKG_NAME} is disabled."
      exit 1
   fi
}

ConfigPython(){ #checks if the daemon exists and will link /usr/bin/python to it
   #python dependency checking
   if [ ! -x $DAEMON ]; then
      /sbin/write_log "Failed to start $QPKG_NAME, $DAEMON was not found. Please re-install the Pythton ipkg." 1 
      exit 1
   else
      #link python to /usr/bin/python
      /bin/ln -sf $DAEMON /usr/bin/python
   fi
}

CheckForOpt(){ #Does /opt exist? if not check if it's optware that's installed or opkg, and start the package 
   /bin/echo -n " Checking for /opt..."
   if [ ! -d /opt/bin ]; then
      if [ -x /etc/init.d/Optware.sh ]; then #if optware ,start optware
         /bin/echo "  Starting Optware..."
         /etc/init.d/Optware.sh start
         sleep 2
      elif [ -x /etc/init.d/opkg.sh ]; then #if opkg, start opkg    
         /bin/echo "  Starting Opkg..."      
         /etc/init.d/opkg.sh start
         sleep 2
      else #catch all
         /bin/echo "  No Optware or Opkg found, please install one of them"      
         /sbin/write_log "Failed to start $QPKG_NAME, no Optware or Opkg found. Please re-install one of those packages" 1 
         exit 1
      fi
   else
      /bin/echo "  Found!"
   fi
}

CheckQpkgRunning() { #Is the QPKG already running? if so, exit the script
   if [ -f $PID_FILE ]; then
      #grab pid from pid file
      Pid=$(/bin/cat $PID_FILE)
      if [ -d /proc/$Pid ]; then
         /bin/echo " $QPKG_NAME is already running" 
         exit 1
      fi
   fi
   #ok, we survived so the QPKG should not be running
}

UpdateQpkg(){ # does a git pull to update to the latest code
   /bin/echo "Updating $QPKG_NAME"
   cd $QPKG_DIR && /opt/bin/git reset --hard HEAD && /opt/bin/git pull && cd - && /bin/sync
}

StartQpkg(){
   /bin/echo "Starting $QPKG_NAME"
   cd $QPKG_DIR
   PATH=${PATH} ${DAEMON} ${DAEMON_OPTS}
}

ShutdownQPKG() { #kills a proces based on a PID in a given PID file
   /bin/echo "Shutting down ${QPKG_NAME}... "
   if [ -f $PID_FILE ]; then
      #grab pid from pid file
      Pid=$(/bin/cat $PID_FILE)
      i=0
      /bin/kill $Pid
      /bin/echo -n " Waiting for ${QPKG_NAME} to shut down: "
      while [ -d /proc/$Pid ]; do
         sleep 1
         let i+=1
         /bin/echo -n "$i, "
         if [ $i = 45 ]; then
            /bin/echo " Tired of waiting, killing ${QPKG_NAME} now"
            /bin/kill -9 $Pid
            /bin/rm -f $PID_FILE
            exit 1
         fi
      done
      /bin/rm -f $PID_FILE
      /bin/echo "Done"
   else
      /bin/echo "${QPKG_NAME} is not running?"
   fi
}

case "$1" in
  start)
   CheckQpkgEnabled #Check if the QPKG is enabled, else exit 
   /bin/echo "$QPKG_NAME prestartup checks..."
   CheckQpkgRunning #Check if the QPKG is not running, else exit
   CheckForOpt      #Check for /opt, start qpkg if needed
   ConfigPython    #Check for Python, exit if not found
   UpdateQpkg       #do a git pull
   StartQpkg       #Finally Start the qpkg
   
   ;;
  stop)
     ShutdownQPKG
   ;;
  restart)
   echo "Restarting $QPKG_NAME"
   $0 stop 
   $0 start
   ;;
  *)
   N=/etc/init.d/$QPKG_NAME.sh
   echo "Usage: $N {start|stop|restart}" >&2
   exit 1
   ;;
esac

I then referenced 'maraschino.sh' in '/etc/config/qpkg.conf' instead of 'autorun.sh'.

Code:
[Maraschino]
Name = Maraschino
Version = 1.0
Author = Maraschino
Date = 2013-05-06
Shell = /share/MD0_DATA/.qpkg/maraschino/maraschino.sh
Install_Path = /share/MD0_DATA/.qpkg/maraschino
WebUI = /
Web_Port = 7000
Enable = TRUE

I wonder if modifying maraschino.sh to work with your Qpython version would allow Maraschino to start. If so, can you post your version of this code?

At the end he says “You can test it with 'maraschino.sh start'.” How can I do that?

Thank you very much in advance for your reply.
Pablo
 
It works like a charm. However, I have a few observations:

1. I can´t connect it to Sickrage. I guess that the problem lies in Sickrage´s settings found here General Configuration > Interface > Web Interface

API key = That´s clear. Just generate one and paste in Maraschino
User and Password = I tried entering info there and leaving both fields blank
HTTP port 8081 = I´m not sure about this because, even though 8081 seems to be the default port, your Sickrage fork works on 29989 so I don´t know which port to use in Maraschino. I tired with both but couldn´t connect. I think I tried replacing 8081 with 29989 and the app became unabailable but I´m not sure about it.

2. I don´t use XBMC, I use PLEX. It´s a shame there´s not an option for PLEX although I think I saw a Maraschino version for it.

Thanks,
Pablo