diff options
Diffstat (limited to 'multimedia/sickchill')
-rw-r--r-- | multimedia/sickchill/README | 32 | ||||
-rw-r--r-- | multimedia/sickchill/config.ini | 3 | ||||
-rw-r--r-- | multimedia/sickchill/doinst.sh | 27 | ||||
-rw-r--r-- | multimedia/sickchill/rc.sickchill | 171 | ||||
-rw-r--r-- | multimedia/sickchill/sickchill.SlackBuild | 138 | ||||
-rw-r--r-- | multimedia/sickchill/sickchill.conf | 6 | ||||
-rw-r--r-- | multimedia/sickchill/sickchill.info | 10 | ||||
-rw-r--r-- | multimedia/sickchill/slack-desc | 19 |
8 files changed, 406 insertions, 0 deletions
diff --git a/multimedia/sickchill/README b/multimedia/sickchill/README new file mode 100644 index 0000000000..bd6ad6e1f8 --- /dev/null +++ b/multimedia/sickchill/README @@ -0,0 +1,32 @@ +sickchill (Less rage, more chill.) + +Automatic Video Library Manager for TV Shows. It watches for new +episodes of your favorite shows, and when they are posted it does its +magic. + +NOTE: Requires sickchill user and group. + groupadd -g 377 sickchill + useradd -u 377 -g sickchill -d /var/lib/sickchill -s /bin/false sickchill + +If you previously had sickrage installed, please change the user and +group with the following: + + groupmod -n sickchill sickrage + usermod -l sickchill -g sickchill -d /var/lib/sickchill sickrage + +To have this start up with Slackware, please add the following to your +/etc/rc.d/rc.local: + +# Start sickrage +if [ -x /etc/rc.d/rc.sickrage ]; then + /etc/rc.d/rc.sickrage start +fi + +If you want it to shut down properly when Slackware restarts or shuts +down, please add the following to your /etc/rc.d/rc.local_shutdown +(it may need to be created): + +# Stop sickrage +if [ -x /etc/rc.d/rc.sickrage ]; then + /etc/rc.d/rc.sickrage stop +fi diff --git a/multimedia/sickchill/config.ini b/multimedia/sickchill/config.ini new file mode 100644 index 0000000000..b2e8361381 --- /dev/null +++ b/multimedia/sickchill/config.ini @@ -0,0 +1,3 @@ +[General] +log_dir = /var/log/sickchill +version_notify = 0 diff --git a/multimedia/sickchill/doinst.sh b/multimedia/sickchill/doinst.sh new file mode 100644 index 0000000000..26340579ec --- /dev/null +++ b/multimedia/sickchill/doinst.sh @@ -0,0 +1,27 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.sickchill.new +config etc/sickchill.conf.new +config var/lib/sickchill/config.ini.new diff --git a/multimedia/sickchill/rc.sickchill b/multimedia/sickchill/rc.sickchill new file mode 100644 index 0000000000..f36eb79604 --- /dev/null +++ b/multimedia/sickchill/rc.sickchill @@ -0,0 +1,171 @@ +#!/bin/bash + +# Start/stop/restart sickchill. + +# Originally created for sickrage in 2016 +# Updated to sickchill in 2023 + +# Copyright 2016-2024 Jeremy Hansen <jebrhansen+SBo@gmail.com> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR 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. + +# Set program name in case you want to run sick{beard|rage|gear|etc} +PROG=${PROG:-sickchill} + +# If you want to have multiple instances of sickchill running, set +# the suffix here. +SUFFIX= + +# Set the full program name for folders +if [ -n "$SUFFIX" ]; then + FULLPROG="$PROG-$SUFFIX" +# Just use $PROG if there isn't a suffix set +else + FULLPROG="$PROG" +fi + +# Source SickRage configuration +if [ -f /etc/"$FULLPROG".conf ]; then + . /etc/"$FULLPROG".conf +fi + +# Ensure all required variables are set in conf file +# Edit conf file in /etc/$PROG-$SUFFIX.conf for any changes +MISSING=0 +for var in USERNAME HOMEDIR DATADIR PIDFILE PORT; do + if [ -z "${!var}" ]; then + ((MISSING++)) + VAR="$var $VAR" + fi +done +if [ $MISSING -gt 0 ]; then + echo "/etc/$FULLPROG.conf is missing some or all required variables ($VAR)." + echo "Please check the file and try again." +fi + +# Check if the program is running and pid file exists +check() +{ + if pgrep "$PROG" > /dev/null; then + # Check if the pidfile matches the running pid + if [ -e "$PIDFILE" ] && pgrep -f "$PIDFILE" > /dev/null; then + STATUS=running + else + # Check if the program is running without the pid file matching + if pgrep -f "$FULLPROG.*$PORT" > /dev/null; then + STATUS=broken + echo "WARNING: $FULLPROG is running without the correct pid file." + echo "Did you start it without using the rc.$FULLPROG?" + else + STATUS=stopped + fi + fi + else + STATUS=stopped + fi +} + +status() +{ + if [ $STATUS == "running" ]; then + echo "$FULLPROG currently running." + elif [ $STATUS == "stopped" ]; then + echo "$FULLPROG not running." + elif [ $STATUS == "broken" ]; then + echo "Please fix the issue before attempting to run $(basename "$0") again." + else + echo "Status unknown." + fi +} + +start() +{ + if [ $STATUS == "stopped" ]; then + echo -n "Starting $PROG: " + if su "$USERNAME" -s /bin/sh -c "/usr/bin/${PROG} --daemon --pidfile=${PIDFILE} --datadir=${DATADIR} --port=${PORT} &> /dev/null"; then + echo "Startup Successful" + else + su "$USERNAME" -s /bin/sh -c "/usr/bin/${PROG} --daemon --pidfile=${PIDFILE} --datadir=${DATADIR} --port=${PORT}" + echo "Startup Failed. The following command is what produced the failure:" + echo "su $USERNAME -s /bin/sh -c \"/usr/bin/${PROG} --daemon --pidfile=${PIDFILE} --datadir=${DATADIR} --port=${PORT}\"" + fi + else + status + fi +} + +stop() +{ + if [ $STATUS == "stopped" ]; then + echo "$PROG doesn't seem to be running. Please try running" + echo "$0 start" + elif [ $STATUS == "broken" ]; then + echo "Cannot stop. Please correct issue and try again." + else + if [ "$EUID" -ne 0 ];then + echo "Please run as root" + exit 1 + fi + # sickchill can take some time to properly shut down. + # It takes more than 10 seconds on my system top properly close. + # If it doesn't close by the timeout, force close it. + TIMEOUT=15 + echo -n $"Giving $PROG $TIMEOUT seconds to shut down: " + curl -s http://localhost:"$PORT"/home/shutdown/?pid="$(cat "$PIDFILE")" | grep -q "shutting down" + for (( COUNT=0; COUNT <= TIMEOUT; COUNT++ )); do + if pgrep -f "$FULLPROG.*$PORT" > /dev/null; then + SHUTDOWN=success + break + fi + sleep 1 + done + if [ "$SHUTDOWN" == "success" ]; then + echo "Shutdown successful." + else + echo "Normal Shutdown Failed - Attempting to kill the process." + sleep 7 + pkill -9 -F "$PIDFILE" + fi + fi +} + +case "$1" in + start) + check + start + ;; + stop) + check + stop + ;; + restart) + check + stop + sleep 1 + check + start + ;; + status) + check + status + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 +esac diff --git a/multimedia/sickchill/sickchill.SlackBuild b/multimedia/sickchill/sickchill.SlackBuild new file mode 100644 index 0000000000..13d212ef23 --- /dev/null +++ b/multimedia/sickchill/sickchill.SlackBuild @@ -0,0 +1,138 @@ +#!/bin/bash + +# Slackware build script for sickchill + +# Copyright 2023-2024 Jeremy Hansen jebrhansen+SBo@gmail.com +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR 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. +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=sickchill +VERSION=${VERSION:-2024.3.1} +BUILD=${BUILD:-3} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +SICKUSER=${SICKUSER:-sickchill} +SICKGROUP=${SICKGROUP:-sickchill} + +# The user and group accounts need to be created manually. +# For slackbuilds.org, assigned sickchill uid/gid are 377/377 +# See http://slackbuilds.org/uid_gid.txt +if ! grep -q ^$SICKGROUP: /etc/group > /dev/null; then + # Handle older versions of sickrage + if grep -q ^sickrage: /etc/group; then + echo " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + echo " You seem to have sickrage previously installed..." + echo " If you want to switch to sickchill, change the group using:" + echo " # groupmod -n sickchill sickrage" + echo " Otherwise..." + echo " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + fi + echo " You must have a \"$SICKGROUP\" group to run this script." + echo " # groupadd -g 377 $SICKGROUP" + exit 1 +elif ! grep -q ^$SICKUSER: /etc/passwd ; then + # Handle older versions of sickrage + if grep -q ^sickrage: /etc/passwd; then + echo " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + echo " You seem to have sickrage previously installed..." + echo " If you want to switch to sickchill, change the user using:" + echo " # groupmod -n sickchill sickrage" + echo " Otherwise..." + echo " +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + fi + echo " You must have a \"$SICKUSER\" user to run this script." + echo " # useradd -u 377 -g $SICKGROUP -d /var/lib/sickchill -s /bin/false $SICKUSER" + echo " If you previously had sickrage installed, change the user using" + echo " # usermod -l sickchill -g sickchill -d /var/lib/sickchill sickrage" + exit 1 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Correct python module names and remove version requirements +sed -i 's|kodipydent-alt.*|kodipydent = "\*"|' pyproject.toml +sed -i 's|new-rtorrent-python.*|rtorrent-python = "\*"|' pyproject.toml +sed -i 's|python-twitter.*|twitter = "\*"|' pyproject.toml + +# Remove ipaddress module requirement as it's been included in python since 3.3 +sed -i '/ipaddress.*/d' pyproject.toml + +# Remove win-inet-pton requirement as it is for Windows +sed -i '/win-inet-pton.*/d' pyproject.toml + +# Remove unnecessary validators version requirement +sed -i 's|validators.*|validators = "\*"|' pyproject.toml + +python3 -m build --wheel --no-isolation +python3 -m installer --destdir=$PKG dist/*.whl + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + COPYING.txt LICENSE.md README.md SECURITY.md \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/etc/rc.d/ +install -m 0644 $CWD/rc.sickchill $PKG/etc/rc.d/rc.sickchill.new +install -m 0644 $CWD/sickchill.conf $PKG/etc/sickchill.conf.new +install -dm 0755 --owner=$SICKUSER $PKG/var/lib/sickchill/ +install -m 0644 --owner=$SICKUSER $CWD/config.ini $PKG/var/lib/sickchill/config.ini.new +install -dm 0755 --owner=$SICKUSER $PKG/var/log/sickchill/ + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/multimedia/sickchill/sickchill.conf b/multimedia/sickchill/sickchill.conf new file mode 100644 index 0000000000..e63d927d91 --- /dev/null +++ b/multimedia/sickchill/sickchill.conf @@ -0,0 +1,6 @@ +USERNAME=sickchill +HOMEDIR=/usr/share/sickchill +DATADIR=/var/lib/sickchill +PIDFILE=${DATADIR}/sickchill.pid +PORT=8081 +LOGDIR=/var/log/sickchill
\ No newline at end of file diff --git a/multimedia/sickchill/sickchill.info b/multimedia/sickchill/sickchill.info new file mode 100644 index 0000000000..66d5282dee --- /dev/null +++ b/multimedia/sickchill/sickchill.info @@ -0,0 +1,10 @@ +PRGNAM="sickchill" +VERSION="2024.3.1" +HOMEPAGE="https://sickchill.github.io/" +DOWNLOAD="https://github.com/SickChill/sickchill/archive/refs/tags/2024.3.1/sickchill-2024.3.1.tar.gz" +MD5SUM="ed4ac0ad41142a5eef0443cb008d92a7" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="python3-PyGithub python3-ifaddr python3-cacheyou python3-tornado Unidecode python-gntp python3-kodipydent python3-cinemagoer python3-validators python-jsonrpclib python3-markdown2 subliminal twitter requests-oauthlib configobj imagesize python3-tvdbsimple python3-fanart python3-tmdbsimple python3-slugify send2trash pyOpenSSL pymediainfo python3-putio.py python3-pynma python3-deluge-client python3-qbittorrent-api python3-new-rtorrent python3-timeago python3-profilehooks" +MAINTAINER="Jeremy Hansen" +EMAIL="jebrhansen+SBo@gmail.com" diff --git a/multimedia/sickchill/slack-desc b/multimedia/sickchill/slack-desc new file mode 100644 index 0000000000..af844946bf --- /dev/null +++ b/multimedia/sickchill/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +sickchill: sickchill (Less rage, more chill.) +sickchill: +sickchill: Automatic Video Library Manager for TV Shows. It watches for new +sickchill: episodes of your favorite shows, and when they are posted it does +sickchill: its magic. +sickchill: +sickchill: HOMEPAGE: https://sickchill.github.io/ +sickchill: +sickchill: +sickchill: +sickchill: |