mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -07:00
Add back init scripts
Update cherrypy to 3.8.0 Remove unnecessary includes Remove old references to Headphones
This commit is contained in:
parent
4936ad0476
commit
0a170c20e6
22 changed files with 531 additions and 2250 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -6,7 +6,7 @@
|
||||||
*.pyproj
|
*.pyproj
|
||||||
*.sln
|
*.sln
|
||||||
|
|
||||||
# Headphones files #
|
# PlexPy files #
|
||||||
######################
|
######################
|
||||||
*.log
|
*.log
|
||||||
*.db*
|
*.db*
|
||||||
|
|
88
init-scripts/init-alt.freebsd
Executable file
88
init-scripts/init-alt.freebsd
Executable file
|
@ -0,0 +1,88 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# PROVIDE: plexpy
|
||||||
|
# REQUIRE: sabnzbd
|
||||||
|
# KEYWORD: shutdown
|
||||||
|
#
|
||||||
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
||||||
|
# to enable this service:
|
||||||
|
#
|
||||||
|
# plexpy_enable (bool): Set to NO by default.
|
||||||
|
# Set it to YES to enable it.
|
||||||
|
# plexpy_user: The user account PlexPy daemon runs as what
|
||||||
|
# you want it to be. It uses '_sabnzbd' user by
|
||||||
|
# default. Do not sets it as empty or it will run
|
||||||
|
# as root.
|
||||||
|
# plexpy_dir: Directory where PlexPy lives.
|
||||||
|
# Default: /usr/local/plexpy
|
||||||
|
# plexpy_chdir: Change to this directory before running PlexPy.
|
||||||
|
# Default is same as plexpy_dir.
|
||||||
|
# plexpy_pid: The name of the pidfile to create.
|
||||||
|
# Default is plexpy.pid in plexpy_dir.
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
|
||||||
|
name="plexpy"
|
||||||
|
rcvar=${name}_enable
|
||||||
|
|
||||||
|
load_rc_config ${name}
|
||||||
|
|
||||||
|
: ${plexpy_enable:="NO"}
|
||||||
|
: ${plexpy_user:="_sabnzbd"}
|
||||||
|
: ${plexpy_dir:="/usr/local/plexpy"}
|
||||||
|
: ${plexpy_chdir:="${plexpy_dir}"}
|
||||||
|
: ${plexpy_pid:="${plexpy_dir}/plexpy.pid"}
|
||||||
|
: ${plexpy_conf:="${plexpy_dir}/config.ini"}
|
||||||
|
|
||||||
|
WGET="/usr/local/bin/wget" # You need wget for this script to safely shutdown PlexPy.
|
||||||
|
if [ -e "${plexpy_conf}" ]; then
|
||||||
|
HOST=`grep -A64 "\[General\]" "${plexpy_conf}"|egrep "^http_host"|perl -wple 's/^http_host = (.*)$/$1/'`
|
||||||
|
PORT=`grep -A64 "\[General\]" "${plexpy_conf}"|egrep "^http_port"|perl -wple 's/^http_port = (.*)$/$1/'`
|
||||||
|
fi
|
||||||
|
|
||||||
|
status_cmd="${name}_status"
|
||||||
|
stop_cmd="${name}_stop"
|
||||||
|
|
||||||
|
command="${plexpy_dir}/PlexPy.py"
|
||||||
|
command_args="--daemon --quiet --nolaunch --port ${PORT} --pidfile ${plexpy_pid} --config ${plexpy_conf}"
|
||||||
|
|
||||||
|
# Check for wget and refuse to start without it.
|
||||||
|
if [ ! -x "${WGET}" ]; then
|
||||||
|
warn "PlexPy not started: You need wget to safely shut down PlexPy."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure user is root when running this script.
|
||||||
|
if [ `id -u` != "0" ]; then
|
||||||
|
echo "Oops, you should be root before running this!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
verify_plexpy_pid() {
|
||||||
|
# Make sure the pid corresponds to the PlexPy process.
|
||||||
|
pid=`cat ${plexpy_pid} 2>/dev/null`
|
||||||
|
ps -p ${pid} | grep -q "python ${plexpy_dir}/PlexPy.py"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
# Try to stop PlexPy cleanly by calling shutdown over http.
|
||||||
|
plexpy_stop() {
|
||||||
|
if [ ! -e "${plexpy_conf}" ]; then
|
||||||
|
echo "PlexPy' settings file does not exist. Try starting PlexPy, as this should create the file."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Stopping $name"
|
||||||
|
verify_plexpy_pid
|
||||||
|
${WGET} -O - -q --user=${SBUSR} --password=${SBPWD} "http://${HOST}:${PORT}/shutdown/" >/dev/null
|
||||||
|
|
||||||
|
if [ -n "${pid}" ]; then
|
||||||
|
wait_for_pids ${pid}
|
||||||
|
echo "Stopped $name"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
plexpy_status() {
|
||||||
|
verify_plexpy_pid && echo "$name is running as ${pid}" || echo "$name is not running"
|
||||||
|
}
|
||||||
|
|
||||||
|
run_rc_command "$1"
|
66
init-scripts/init.fedora.centos.systemd
Executable file
66
init-scripts/init.fedora.centos.systemd
Executable file
|
@ -0,0 +1,66 @@
|
||||||
|
# PlexPy - Automatic music downloader for SABnzbd
|
||||||
|
#
|
||||||
|
# Service Unit file for systemd system manager
|
||||||
|
#
|
||||||
|
# INSTALLATION NOTES
|
||||||
|
#
|
||||||
|
# 1. Rename this file as you want, ensuring that it ends in .service
|
||||||
|
# e.g. 'plexpy.service'
|
||||||
|
#
|
||||||
|
# 2. Adjust configuration settings as required. More details in the
|
||||||
|
# "CONFIGURATION NOTES" section shown below.
|
||||||
|
#
|
||||||
|
# 3. Copy this file into your systemd service unit directory, which is
|
||||||
|
# often '/lib/systemd/system'.
|
||||||
|
#
|
||||||
|
# 4. Create any files/directories that you specified back in step #2.
|
||||||
|
# e.g. '/etc/plexpy/plexpy.ini'
|
||||||
|
# '/home/sabnzbd/.plexpy'
|
||||||
|
#
|
||||||
|
# 5. Enable boot-time autostart with the following commands:
|
||||||
|
# systemctl daemon-reload
|
||||||
|
# systemctl enable plexpy.service
|
||||||
|
#
|
||||||
|
# 6. Start now with the following command:
|
||||||
|
# systemctl start plexpy.service
|
||||||
|
#
|
||||||
|
# 7. If troubleshooting startup-errors, start by checking permissions
|
||||||
|
# and ownership on the files/directories that you created in step #4.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# CONFIGURATION NOTES
|
||||||
|
#
|
||||||
|
# - The example settings in this file assume that:
|
||||||
|
# 1. You will run PlexPy as user/group: sabnzbd.sabnzbd
|
||||||
|
# 2. You will either have PlexPy installed as a subdirectory
|
||||||
|
# under '~sabnzbd', or that you will have a symlink under
|
||||||
|
# '~/sabnzbd' pointing to your PlexPy install dir.
|
||||||
|
# 3. Your PlexPy data directory and configuration file will be
|
||||||
|
# in separate locations from your PlexPy install dir, to
|
||||||
|
# simplify updates.
|
||||||
|
#
|
||||||
|
# - Option names (e.g. ExecStart=, Type=) appear to be case-sensitive)
|
||||||
|
#
|
||||||
|
# - Adjust ExecStart= to point to:
|
||||||
|
# 1. Your PlexPy executable,
|
||||||
|
# 2. Your config file (recommended is to put it somewhere in /etc)
|
||||||
|
# 3. Your datadir (recommended is to NOT put it in your PlexPy exec dir)
|
||||||
|
#
|
||||||
|
# - Adjust User= and Group= to the user/group you want PlexPy to run as.
|
||||||
|
#
|
||||||
|
# - WantedBy= specifies which target (i.e. runlevel) to start PlexPy for.
|
||||||
|
# multi-user.target equates to runlevel 3 (multi-user text mode)
|
||||||
|
# graphical.target equates to runlevel 5 (multi-user X11 graphical mode)
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=PlexPy - Automatic music downloader for SABnzbd
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/home/sabnzbd/plexpy/PlexPy.py --daemon --config /etc/plexpy/plexpy.ini --datadir /home/sabnzbd/.plexpy --nolaunch --quiet
|
||||||
|
GuessMainPID=no
|
||||||
|
Type=forking
|
||||||
|
User=sabnzbd
|
||||||
|
Group=sabnzbd
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
70
init-scripts/init.freebsd
Executable file
70
init-scripts/init.freebsd
Executable file
|
@ -0,0 +1,70 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# PROVIDE: plexpy
|
||||||
|
# REQUIRE: DAEMON sabnzbd
|
||||||
|
# KEYWORD: shutdown
|
||||||
|
#
|
||||||
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
||||||
|
# to enable this service:
|
||||||
|
#
|
||||||
|
# plexpy_enable (bool): Set to NO by default.
|
||||||
|
# Set it to YES to enable it.
|
||||||
|
# plexpy_user: The user account PlexPy daemon runs as what
|
||||||
|
# you want it to be. It uses '_sabnzbd' user by
|
||||||
|
# default. Do not sets it as empty or it will run
|
||||||
|
# as root.
|
||||||
|
# plexpy_dir: Directory where PlexPy lives.
|
||||||
|
# Default: /usr/local/plexpy
|
||||||
|
# plexpy_chdir: Change to this directory before running PlexPy.
|
||||||
|
# Default is same as plexpy_dir.
|
||||||
|
# plexpy_pid: The name of the pidfile to create.
|
||||||
|
# Default is plexpy.pid in plexpy_dir.
|
||||||
|
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
|
||||||
|
name="plexpy"
|
||||||
|
rcvar=${name}_enable
|
||||||
|
|
||||||
|
load_rc_config ${name}
|
||||||
|
|
||||||
|
: ${plexpy_enable:="NO"}
|
||||||
|
: ${plexpy_user:="_sabnzbd"}
|
||||||
|
: ${plexpy_dir:="/usr/local/plexpy"}
|
||||||
|
: ${plexpy_chdir:="${plexpy_dir}"}
|
||||||
|
: ${plexpy_pid:="${plexpy_dir}/plexpy.pid"}
|
||||||
|
|
||||||
|
status_cmd="${name}_status"
|
||||||
|
stop_cmd="${name}_stop"
|
||||||
|
|
||||||
|
command="/usr/sbin/daemon"
|
||||||
|
command_args="-f -p ${plexpy_pid} python ${plexpy_dir}/PlexPy.py ${plexpy_flags} --quiet --nolaunch"
|
||||||
|
|
||||||
|
# Ensure user is root when running this script.
|
||||||
|
if [ `id -u` != "0" ]; then
|
||||||
|
echo "Oops, you should be root before running this!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
verify_plexpy_pid() {
|
||||||
|
# Make sure the pid corresponds to the PlexPy process.
|
||||||
|
pid=`cat ${plexpy_pid} 2>/dev/null`
|
||||||
|
ps -p ${pid} | grep -q "python ${plexpy_dir}/PlexPy.py"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
# Try to stop PlexPy cleanly by calling shutdown over http.
|
||||||
|
plexpy_stop() {
|
||||||
|
echo "Stopping $name"
|
||||||
|
verify_plexpy_pid
|
||||||
|
if [ -n "${pid}" ]; then
|
||||||
|
wait_for_pids ${pid}
|
||||||
|
echo "Stopped"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
plexpy_status() {
|
||||||
|
verify_plexpy_pid && echo "$name is running as ${pid}" || echo "$name is not running"
|
||||||
|
}
|
||||||
|
|
||||||
|
run_rc_command "$1"
|
18
init-scripts/init.osx
Executable file
18
init-scripts/init.osx
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>Label</key>
|
||||||
|
<string>plexpy</string>
|
||||||
|
<key>ProgramArguments</key>
|
||||||
|
<array>
|
||||||
|
<!-- Modify these two lines if you need to to reflect your python location and PlexPy install location -->
|
||||||
|
<string>/usr/bin/python</string>
|
||||||
|
<string>/Applications/PlexPy/PlexPy.py</string>
|
||||||
|
</array>
|
||||||
|
<key>RunAtLoad</key>
|
||||||
|
<true/>
|
||||||
|
<key>KeepAlive</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
47
init-scripts/init.solaris11
Executable file
47
init-scripts/init.solaris11
Executable file
|
@ -0,0 +1,47 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
|
||||||
|
<!--
|
||||||
|
Created by Manifold
|
||||||
|
--><service_bundle type="manifest" name="plexpy">
|
||||||
|
|
||||||
|
<service name="application/plexpy" type="service" version="1">
|
||||||
|
|
||||||
|
<create_default_instance enabled="true"/>
|
||||||
|
|
||||||
|
<single_instance/>
|
||||||
|
|
||||||
|
<dependency name="network" grouping="require_all" restart_on="error" type="service">
|
||||||
|
<service_fmri value="svc:/milestone/network:default"/>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
|
||||||
|
<service_fmri value="svc:/system/filesystem/local"/>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<method_context>
|
||||||
|
<method_credential user="sabnzbd" group="sabnzbd"/>
|
||||||
|
</method_context>
|
||||||
|
|
||||||
|
<exec_method type="method" name="start" exec="python /opt/plexpy/PlexPy.py --daemon --quiet --nolaunch" timeout_seconds="60"/>
|
||||||
|
|
||||||
|
<exec_method type="method" name="stop" exec=":kill" timeout_seconds="60"/>
|
||||||
|
|
||||||
|
<property_group name="startd" type="framework">
|
||||||
|
<propval name="duration" type="astring" value="contract"/>
|
||||||
|
<propval name="ignore_error" type="astring" value="core,signal"/>
|
||||||
|
</property_group>
|
||||||
|
|
||||||
|
|
||||||
|
<stability value="Evolving"/>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<common_name>
|
||||||
|
<loctext xml:lang="C">
|
||||||
|
PlexPy
|
||||||
|
</loctext>
|
||||||
|
</common_name>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</service>
|
||||||
|
|
||||||
|
</service_bundle>
|
209
init-scripts/init.ubuntu
Executable file
209
init-scripts/init.ubuntu
Executable file
|
@ -0,0 +1,209 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
## Don't edit this file
|
||||||
|
## Edit user configuation in /etc/default/plexpy to change
|
||||||
|
##
|
||||||
|
## Make sure init script is executable
|
||||||
|
## sudo chmod +x /path/to/init.ubuntu
|
||||||
|
##
|
||||||
|
## Install the init script
|
||||||
|
## sudo ln -s /path/to/init.ubuntu /etc/init.d/plexpy
|
||||||
|
##
|
||||||
|
## Create the plexpy daemon user:
|
||||||
|
## sudo adduser --system --no-create-home plexpy
|
||||||
|
##
|
||||||
|
## Make sure /opt/plexpy is owned by the plexpy user
|
||||||
|
## sudo chown plexpy:nogroup -R /opt/plexpy
|
||||||
|
##
|
||||||
|
## Touch the default file to stop the warning message when starting
|
||||||
|
## sudo touch /etc/default/plexpy
|
||||||
|
##
|
||||||
|
## To start PlexPy automatically
|
||||||
|
## sudo update-rc.d plexpy defaults
|
||||||
|
##
|
||||||
|
## To start/stop/restart PlexPy
|
||||||
|
## sudo service plexpy start
|
||||||
|
## sudo service plexpy stop
|
||||||
|
## sudo service plexpy restart
|
||||||
|
##
|
||||||
|
## HP_USER= #$RUN_AS, username to run plexpy under, the default is plexpy
|
||||||
|
## HP_HOME= #$APP_PATH, the location of PlexPy.py, the default is /opt/plexpy
|
||||||
|
## HP_DATA= #$DATA_DIR, the location of plexpy.db, cache, logs, the default is /opt/plexpy
|
||||||
|
## HP_PIDFILE= #$PID_FILE, the location of plexpy.pid, the default is /var/run/plexpy/plexpy.pid
|
||||||
|
## PYTHON_BIN= #$DAEMON, the location of the python binary, the default is /usr/bin/python
|
||||||
|
## HP_OPTS= #$EXTRA_DAEMON_OPTS, extra cli option for plexpy, i.e. " --config=/home/plexpy/config.ini"
|
||||||
|
## SSD_OPTS= #$EXTRA_SSD_OPTS, extra start-stop-daemon option like " --group=users"
|
||||||
|
## HP_PORT= #$PORT_OPTS, hardcoded port for the webserver, overrides value in config.ini
|
||||||
|
##
|
||||||
|
## EXAMPLE if want to run as different user
|
||||||
|
## add HP_USER=username to /etc/default/plexpy
|
||||||
|
## otherwise default plexpy is used
|
||||||
|
#
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: plexpy
|
||||||
|
# Required-Start: $local_fs $network $remote_fs
|
||||||
|
# Required-Stop: $local_fs $network $remote_fs
|
||||||
|
# Should-Start: $NetworkManager
|
||||||
|
# Should-Stop: $NetworkManager
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: starts instance of PlexPy
|
||||||
|
# Description: starts instance of PlexPy using start-stop-daemon
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Script name
|
||||||
|
NAME=plexpy
|
||||||
|
|
||||||
|
# App name
|
||||||
|
DESC=PlexPy
|
||||||
|
|
||||||
|
SETTINGS_LOADED=FALSE
|
||||||
|
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
# Source PlexPy configuration
|
||||||
|
if [ -f /etc/default/plexpy ]; then
|
||||||
|
SETTINGS=/etc/default/plexpy
|
||||||
|
else
|
||||||
|
log_warning_msg "/etc/default/plexpy not found using default settings.";
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_retval() {
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
log_end_msg 0
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
log_end_msg 1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
load_settings() {
|
||||||
|
if [ $SETTINGS_LOADED != "TRUE" ]; then
|
||||||
|
. $SETTINGS
|
||||||
|
|
||||||
|
## The defaults
|
||||||
|
# Run as username
|
||||||
|
RUN_AS=${HP_USER-plexpy}
|
||||||
|
|
||||||
|
# Path to app HP_HOME=path_to_app_PlexPy.py
|
||||||
|
APP_PATH=${HP_HOME-/opt/plexpy}
|
||||||
|
|
||||||
|
# Data directory where plexpy.db, cache and logs are stored
|
||||||
|
DATA_DIR=${HP_DATA-/opt/plexpy}
|
||||||
|
|
||||||
|
# Path to store PID file
|
||||||
|
PID_FILE=${HP_PIDFILE-/var/run/plexpy/plexpy.pid}
|
||||||
|
|
||||||
|
# Path to python bin
|
||||||
|
DAEMON=${PYTHON_BIN-/usr/bin/python}
|
||||||
|
|
||||||
|
# Extra daemon option like: HP_OPTS=" --config=/home/plexpy/config.ini"
|
||||||
|
EXTRA_DAEMON_OPTS=${HP_OPTS-}
|
||||||
|
|
||||||
|
# Extra start-stop-daemon option like START_OPTS=" --group=users"
|
||||||
|
EXTRA_SSD_OPTS=${SSD_OPTS-}
|
||||||
|
|
||||||
|
# Hardcoded port to run on, overrides config.ini settings
|
||||||
|
[ -n "$HP_PORT" ] && {
|
||||||
|
PORT_OPTS=" --port=${HP_PORT} "
|
||||||
|
}
|
||||||
|
|
||||||
|
DAEMON_OPTS=" PlexPy.py --quiet --daemon --nolaunch --pidfile=${PID_FILE} --datadir=${DATA_DIR} ${PORT_OPTS}${EXTRA_DAEMON_OPTS}"
|
||||||
|
|
||||||
|
SETTINGS_LOADED=TRUE
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -x $DAEMON ] || {
|
||||||
|
log_warning_msg "$DESC: Can't execute daemon, aborting. See $DAEMON";
|
||||||
|
return 1;}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
load_settings || exit 0
|
||||||
|
|
||||||
|
is_running () {
|
||||||
|
# returns 1 when running, else 0.
|
||||||
|
if [ -e $PID_FILE ]; then
|
||||||
|
PID=`cat $PID_FILE`
|
||||||
|
|
||||||
|
RET=$?
|
||||||
|
[ $RET -gt 1 ] && exit 1 || return $RET
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_pid () {
|
||||||
|
PID_PATH=`dirname $PID_FILE`
|
||||||
|
[ -d $PID_PATH ] || mkdir -p $PID_PATH && chown -R $RUN_AS $PID_PATH > /dev/null || {
|
||||||
|
log_warning_msg "$DESC: Could not create $PID_FILE, See $SETTINGS, aborting.";
|
||||||
|
return 1;}
|
||||||
|
|
||||||
|
if [ -e $PID_FILE ]; then
|
||||||
|
PID=`cat $PID_FILE`
|
||||||
|
if ! kill -0 $PID > /dev/null 2>&1; then
|
||||||
|
log_warning_msg "Removing stale $PID_FILE"
|
||||||
|
rm $PID_FILE
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_datadir () {
|
||||||
|
[ -d $DATA_DIR ] || mkdir -p $DATA_DIR && chown -R $RUN_AS $DATA_DIR > /dev/null || {
|
||||||
|
log_warning_msg "$DESC: Could not create $DATA_DIR, See $SETTINGS, aborting.";
|
||||||
|
return 1;}
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_updates () {
|
||||||
|
chown -R $RUN_AS $APP_PATH > /dev/null || {
|
||||||
|
log_warning_msg "$DESC: $APP_PATH not writable by $RUN_AS for web-updates";
|
||||||
|
return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
start_plexpy () {
|
||||||
|
handle_pid
|
||||||
|
handle_datadir
|
||||||
|
handle_updates
|
||||||
|
if ! is_running; then
|
||||||
|
log_daemon_msg "Starting $DESC"
|
||||||
|
start-stop-daemon -o -d $APP_PATH -c $RUN_AS --start $EXTRA_SSD_OPTS --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
|
||||||
|
check_retval
|
||||||
|
else
|
||||||
|
log_success_msg "$DESC: already running (pid $PID)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_plexpy () {
|
||||||
|
if is_running; then
|
||||||
|
log_daemon_msg "Stopping $DESC"
|
||||||
|
start-stop-daemon -o --stop --pidfile $PID_FILE --retry 15
|
||||||
|
check_retval
|
||||||
|
else
|
||||||
|
log_success_msg "$DESC: not running"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start_plexpy
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop_plexpy
|
||||||
|
;;
|
||||||
|
restart|force-reload)
|
||||||
|
stop_plexpy
|
||||||
|
start_plexpy
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status_of_proc -p "$PID_FILE" "$DAEMON" "$DESC"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
N=/etc/init.d/$NAME
|
||||||
|
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
18
init-scripts/init.upstart
Executable file
18
init-scripts/init.upstart
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
# plexpy - Automatic music downloader
|
||||||
|
#
|
||||||
|
# This is a session/user job. Install this file into /usr/share/upstart/sessions
|
||||||
|
# if plexpy is installed system wide, and into $XDG_CONFIG_HOME/upstart if
|
||||||
|
# plexpy is installed per user. Change the executable path appropiately.
|
||||||
|
|
||||||
|
start on desktop-start
|
||||||
|
stop on desktop-end
|
||||||
|
|
||||||
|
env CONFIG=""$XDG_CONFIG_HOME"/plexpy"
|
||||||
|
env DATA=""$XDG_DATA_HOME"/plexpy"
|
||||||
|
|
||||||
|
pre-start script
|
||||||
|
[ -d "$CONFIG" ] || mkdir -p "$CONFIG"
|
||||||
|
[ -d "$DATA" ] || mkdir -p "$DATA"
|
||||||
|
end script
|
||||||
|
|
||||||
|
exec PlexPy.py --nolaunch --config "$CONFIG"/config.ini --datadir "$DATA"
|
|
@ -1,25 +0,0 @@
|
||||||
Copyright (c) 2004-2011, CherryPy Team (team@cherrypy.org)
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
* Neither the name of the CherryPy Team nor the names of its contributors
|
|
||||||
may be used to endorse or promote products derived from this software
|
|
||||||
without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
@ -56,7 +56,7 @@ with customized or extended components. The core API's are:
|
||||||
These API's are described in the `CherryPy specification <https://bitbucket.org/cherrypy/cherrypy/wiki/CherryPySpec>`_.
|
These API's are described in the `CherryPy specification <https://bitbucket.org/cherrypy/cherrypy/wiki/CherryPySpec>`_.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "3.6.0"
|
__version__ = "3.8.0"
|
||||||
|
|
||||||
from cherrypy._cpcompat import urljoin as _urljoin, urlencode as _urlencode
|
from cherrypy._cpcompat import urljoin as _urljoin, urlencode as _urlencode
|
||||||
from cherrypy._cpcompat import basestring, unicodestr, set
|
from cherrypy._cpcompat import basestring, unicodestr, set
|
||||||
|
|
4
lib/cherrypy/__main__.py
Normal file
4
lib/cherrypy/__main__.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
import cherrypy.daemon
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
cherrypy.daemon.run()
|
|
@ -209,9 +209,11 @@ class LogManager(object):
|
||||||
If ``traceback`` is True, the traceback of the current exception
|
If ``traceback`` is True, the traceback of the current exception
|
||||||
(if any) will be appended to ``msg``.
|
(if any) will be appended to ``msg``.
|
||||||
"""
|
"""
|
||||||
|
exc_info = None
|
||||||
if traceback:
|
if traceback:
|
||||||
msg += _cperror.format_exc()
|
exc_info = _cperror._exc_info()
|
||||||
self.error_log.log(severity, ' '.join((self.time(), context, msg)))
|
|
||||||
|
self.error_log.log(severity, ' '.join((self.time(), context, msg)), exc_info=exc_info)
|
||||||
|
|
||||||
def __call__(self, *args, **kwargs):
|
def __call__(self, *args, **kwargs):
|
||||||
"""An alias for ``error``."""
|
"""An alias for ``error``."""
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#! /usr/bin/env python
|
|
||||||
"""The CherryPy daemon."""
|
"""The CherryPy daemon."""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -76,7 +75,7 @@ def start(configfiles=None, daemonize=False, environment=None,
|
||||||
engine.block()
|
engine.block()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def run():
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
p = OptionParser()
|
p = OptionParser()
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
|
@ -124,7 +124,7 @@ class ServerAdapter(object):
|
||||||
|
|
||||||
If you need to start more than one HTTP server (to serve on multiple
|
If you need to start more than one HTTP server (to serve on multiple
|
||||||
ports, or protocols, etc.), you can manually register each one and then
|
ports, or protocols, etc.), you can manually register each one and then
|
||||||
start them all with bus.start:
|
start them all with bus.start::
|
||||||
|
|
||||||
s1 = ServerAdapter(bus, MyWSGIServer(host='0.0.0.0', port=80))
|
s1 = ServerAdapter(bus, MyWSGIServer(host='0.0.0.0', port=80))
|
||||||
s2 = ServerAdapter(bus, another.HTTPServer(host='127.0.0.1', SSL=True))
|
s2 = ServerAdapter(bus, another.HTTPServer(host='127.0.0.1', SSL=True))
|
||||||
|
@ -183,7 +183,8 @@ class ServerAdapter(object):
|
||||||
if not self.httpserver:
|
if not self.httpserver:
|
||||||
return ''
|
return ''
|
||||||
host, port = self.bind_addr
|
host, port = self.bind_addr
|
||||||
if getattr(self.httpserver, 'ssl_certificate', None):
|
if getattr(self.httpserver, 'ssl_certificate', None) or \
|
||||||
|
getattr(self.httpserver, 'ssl_adapter', None):
|
||||||
scheme = "https"
|
scheme = "https"
|
||||||
if port != 443:
|
if port != 443:
|
||||||
host += ":%s" % port
|
host += ":%s" % port
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
# Apache2 server conf file for using CherryPy with mod_fcgid.
|
|
||||||
|
|
||||||
# This doesn't have to be "C:/", but it has to be a directory somewhere, and
|
|
||||||
# MUST match the directory used in the FastCgiExternalServer directive, below.
|
|
||||||
DocumentRoot "C:/"
|
|
||||||
|
|
||||||
ServerName 127.0.0.1
|
|
||||||
Listen 80
|
|
||||||
LoadModule fastcgi_module modules/mod_fastcgi.dll
|
|
||||||
LoadModule rewrite_module modules/mod_rewrite.so
|
|
||||||
|
|
||||||
Options ExecCGI
|
|
||||||
SetHandler fastcgi-script
|
|
||||||
RewriteEngine On
|
|
||||||
# Send requests for any URI to our fastcgi handler.
|
|
||||||
RewriteRule ^(.*)$ /fastcgi.pyc [L]
|
|
||||||
|
|
||||||
# The FastCgiExternalServer directive defines filename as an external FastCGI application.
|
|
||||||
# If filename does not begin with a slash (/) then it is assumed to be relative to the ServerRoot.
|
|
||||||
# The filename does not have to exist in the local filesystem. URIs that Apache resolves to this
|
|
||||||
# filename will be handled by this external FastCGI application.
|
|
||||||
FastCgiExternalServer "C:/fastcgi.pyc" -host 127.0.0.1:8088
|
|
|
@ -1,3 +0,0 @@
|
||||||
[/]
|
|
||||||
log.error_file: "error.log"
|
|
||||||
log.access_file: "access.log"
|
|
|
@ -1,14 +0,0 @@
|
||||||
[global]
|
|
||||||
# Uncomment this when you're done developing
|
|
||||||
#environment: "production"
|
|
||||||
|
|
||||||
server.socket_host: "0.0.0.0"
|
|
||||||
server.socket_port: 8088
|
|
||||||
|
|
||||||
# Uncomment the following lines to run on HTTPS at the same time
|
|
||||||
#server.2.socket_host: "0.0.0.0"
|
|
||||||
#server.2.socket_port: 8433
|
|
||||||
#server.2.ssl_certificate: '../test/test.pem'
|
|
||||||
#server.2.ssl_private_key: '../test/test.pem'
|
|
||||||
|
|
||||||
tree.myapp: cherrypy.Application(scaffold.root, "/", "example.conf")
|
|
Binary file not shown.
Before Width: | Height: | Size: 7.3 KiB |
|
@ -1757,7 +1757,7 @@ class HTTPServer(object):
|
||||||
timeout = 10
|
timeout = 10
|
||||||
"""The timeout in seconds for accepted connections (default 10)."""
|
"""The timeout in seconds for accepted connections (default 10)."""
|
||||||
|
|
||||||
version = "CherryPy/3.6.0"
|
version = "CherryPy/3.8.0"
|
||||||
"""A version string for the HTTPServer."""
|
"""A version string for the HTTPServer."""
|
||||||
|
|
||||||
software = None
|
software = None
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,7 +19,6 @@ from xml.dom import minidom
|
||||||
from httplib import HTTPSConnection
|
from httplib import HTTPSConnection
|
||||||
from urlparse import parse_qsl
|
from urlparse import parse_qsl
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
from pynma import pynma
|
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import cherrypy
|
import cherrypy
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue