UNMAINTAINED

This commit is contained in:
hoellen
2018-01-22 22:30:12 +01:00
parent 792ab407e1
commit afd3d476fd
49 changed files with 0 additions and 192 deletions

View File

@ -0,0 +1,120 @@
FROM alpine:3.6
ARG RTORRENT_VER=0.9.6
ARG LIBTORRENT_VER=0.13.6
ARG MEDIAINFO_VER=0.7.99
ARG FILEBOT_VER=4.7.9
ARG CHROMAPRINT_VER=1.4.2
ARG LIBZEN_VER=0.4.37
ARG FLOOD_VER=1.0.0
ARG BUILD_CORES
ENV UID=991 GID=991 \
FLOOD_SECRET=supersecret \
CONTEXT_PATH=/ \
RTORRENT_SCGI=0 \
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
ENV FILEBOT_RENAME_METHOD="symlink" \
FILEBOT_RENAME_MOVIES="{n} ({y})" \
FILEBOT_RENAME_SERIES="{n}/Season {s.pad(2)}/{s00e00} - {t}" \
FILEBOT_RENAME_ANIMES="{n}/{e.pad(3)} - {t}" \
FILEBOT_RENAME_MUSICS="{artist}/{album}/{fn}"
RUN NB_CORES=${BUILD_CORES-`getconf _NPROCESSORS_CONF`} \
&& apk -U upgrade \
&& apk add -t build-dependencies \
build-base \
git \
libtool \
automake \
autoconf \
wget \
tar \
xz \
zlib-dev \
cppunit-dev \
libressl-dev \
ncurses-dev \
curl-dev \
binutils \
&& apk add \
ca-certificates \
curl \
ncurses \
libressl \
gzip \
zip \
zlib \
unrar \
s6 \
su-exec \
python \
nodejs \
nodejs-npm \
openjdk8-jre \
java-jna-native \
&& cd /tmp && mkdir libtorrent rtorrent \
&& cd libtorrent && wget -qO- https://github.com/rakshasa/libtorrent/archive/${LIBTORRENT_VER}.tar.gz | tar xz --strip 1 \
&& cd ../rtorrent && wget -qO- https://github.com/rakshasa/rtorrent/archive/${RTORRENT_VER}.tar.gz | tar xz --strip 1 \
&& cd /tmp \
&& git clone https://github.com/mirror/xmlrpc-c.git \
&& git clone https://github.com/Rudde/mktorrent.git \
&& git clone https://github.com/acoustid/chromaprint.git \
&& cd /tmp/mktorrent && make -j ${NB_CORES} && make install \
&& cd /tmp/xmlrpc-c/stable && ./configure && make -j ${NB_CORES} && make install \
&& cd /tmp/libtorrent && ./autogen.sh && ./configure && make -j ${NB_CORES} && make install \
&& cd /tmp/rtorrent && ./autogen.sh && ./configure --with-xmlrpc-c && make -j ${NB_CORES} && make install \
&& cd /tmp \
&& wget -q http://mediaarea.net/download/binary/mediainfo/${MEDIAINFO_VER}/MediaInfo_CLI_${MEDIAINFO_VER}_GNU_FromSource.tar.gz \
&& wget -q http://mediaarea.net/download/binary/libmediainfo0/${MEDIAINFO_VER}/MediaInfo_DLL_${MEDIAINFO_VER}_GNU_FromSource.tar.gz \
&& wget -q https://github.com/MediaArea/ZenLib/archive/v${LIBZEN_VER}.tar.gz -O libzen.tar.gz \
&& tar xzf MediaInfo_DLL_${MEDIAINFO_VER}_GNU_FromSource.tar.gz \
&& tar xzf MediaInfo_CLI_${MEDIAINFO_VER}_GNU_FromSource.tar.gz \
&& tar xzf libzen.tar.gz \
&& cd /tmp/ZenLib-${LIBZEN_VER}/Project/GNU/Library \
&& ./autogen.sh && ./configure --prefix=/usr --enable-shared --disable-static && make && make install \
&& cd /tmp/MediaInfo_DLL_GNU_FromSource && ./SO_Compile.sh \
&& cd /tmp/MediaInfo_DLL_GNU_FromSource/ZenLib/Project/GNU/Library && make install \
&& cd /tmp/MediaInfo_DLL_GNU_FromSource/MediaInfoLib/Project/GNU/Library && make install \
&& cd /tmp/MediaInfo_CLI_GNU_FromSource && ./CLI_Compile.sh \
&& cd /tmp/MediaInfo_CLI_GNU_FromSource/MediaInfo/Project/GNU/CLI && make install \
&& strip -s /usr/local/bin/rtorrent \
&& strip -s /usr/local/bin/mktorrent \
&& strip -s /usr/local/bin/mediainfo \
&& mkdir /filebot && cd /filebot \
&& wget https://github.com/acoustid/chromaprint/releases/download/v${CHROMAPRINT_VER}/chromaprint-fpcalc-${CHROMAPRINT_VER}-linux-x86_64.tar.gz \
&& tar xvf chromaprint-fpcalc-${CHROMAPRINT_VER}-linux-x86_64.tar.gz \
&& mv chromaprint-fpcalc-${CHROMAPRINT_VER}-linux-x86_64/fpcalc /usr/local/bin \
&& strip -s /usr/local/bin/fpcalc \
&& wget -q https://netcologne.dl.sourceforge.net/project/filebot/filebot/FileBot_${FILEBOT_VER}/FileBot_${FILEBOT_VER}-portable.tar.xz \
&& tar xJf FileBot_${FILEBOT_VER}-portable.tar.xz && rm FileBot_${FILEBOT_VER}-portable.tar.xz \
&& mkdir /usr/flood && cd /usr/flood && wget -qO- https://github.com/jfurrow/flood/archive/v${FLOOD_VER}.tar.gz | tar xz --strip 1 \
&& npm install --production \
&& ln -sf /usr/local/lib/libmediainfo.so.0.0.0 /filebot/lib/x86_64/libmediainfo.so \
&& ln -sf /usr/local/lib/libzen.la /filebot/lib/x86_64/libzen.so \
&& ln -sf /usr/local/bin/mediainfo /usr/bin/mediainfo \
&& apk del build-dependencies \
&& rm -rf /var/cache/apk/* /tmp/*
COPY config.js /usr/flood/
COPY s6.d /etc/s6.d
COPY run.sh /usr/bin/
COPY postdl /usr/bin/
COPY postrm /usr/bin/
COPY config.js /usr/flood/
COPY rtorrent.rc /home/torrent/.rtorrent.rc
RUN chmod +x /usr/bin/* /etc/s6.d/*/* /etc/s6.d/.s6-svscan/*
VOLUME /data /flood-db
EXPOSE 3000 49184 49184/udp
LABEL description="BitTorrent client with WebUI front-end" \
rtorrent="rTorrent BiTorrent client v$RTORRENT_VER" \
libtorrent="libtorrent v$LIBTORRENT_VER" \
filebot="Filebot v$FILEBOT_VER" \
maintainer="Wonderfall <wonderfall@targaryen.house>"
CMD ["run.sh"]

View File

@ -0,0 +1,40 @@
## wonderfall/rtorrent-flood
![](https://camo.githubusercontent.com/d8f5cb502f06e0ea1cc171550c2bed035293c1a9/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6a6f686e667572726f772e636f6d2f73686172652f666c6f6f642d73637265656e73686f742d612d303630362e706e67)
#### Main features
- Based on Alpine Linux.
- rTorrent and libtorrent are compiled from source.
- Provides by default a solid configuration.
- [Filebot](http://www.filebot.net/) is included, and creates symlinks in `/data/Media`.
- [Flood](https://github.com/jfurrow/flood), a modern web UI for rTorrent with a Node.js backend and React frontend.
#### Build-time variables
- **RTORRENT_VER** : rtorrent version
- **LIBTORRENT_VER** : libtorrent version
- **MEDIAINFO_VER** : libmediainfo version
- **FILEBOT_VER** : filebot version
- **BUILD_CORES** : number of cores used during build
#### Environment variables
- **UID** : user id (default : 991)
- **GID** : group id (defaut : 991)
- **FLOOD_SECRET** : flood secret key (defaut : mysupersecretkey) (CHANGE IT)
- **CONTEXT_PATH** : context path (base_URI) (default : /)
- **RTORRENT_SCGI** : SCGI port (default : 0 for use local socket)
- **PKG_CONFIG_PATH** : `/usr/local/lib/pkgconfig` (don't touch)
### Note
Run this container with tty mode enabled. In your `docker-compose.yml`, add `tty: true`. If you don't do this, [rtorrent will use 100% of CPU](https://github.com/Wonderfall/dockerfiles/issues/156).
#### Ports
- **49184** (bind it).
- **3000** [(reverse proxy!)](https://github.com/hardware/mailserver/wiki/Reverse-proxy-configuration)
#### Tags
- **latest** : latest versions of rTorrent/libtorrent.
- Use **$RTORRENT_VER-$LIBTORRENT_VER** to get specific versions of rTorrent/libtorrent.
#### Volumes
- **/data** : your downloaded torrents, session files, symlinks...
- **/flood-db** : Flood databases.

View File

@ -0,0 +1,17 @@
const CONFIG = {
baseURI: '<CONTEXT_PATH>',
dbCleanInterval: 1000 * 60 * 60,
dbPath: '/flood-db/',
floodServerPort: 3000,
maxHistoryStates: 30,
pollInterval: 1000 * 5,
secret: '<FLOOD_SECRET>',
scgi: {
host: 'localhost',
port: 5000,
socket: true,
socketPath: '/tmp/rtorrent.sock'
}
};
module.exports = CONFIG;

View File

@ -0,0 +1,27 @@
#!/bin/sh
# rtorrent.rc
# system.method.set_key=event.download.finished,filebot,"execute={rtorrent-postprocess.sh,$d.get_base_path=,$d.get_name=,$d.get_custom1=}"
TORRENT_PATH="$1"
TORRENT_NAME="$2"
TORRENT_LABEL="$(echo $3 | tr '[:upper:]' '[:lower:]')"
case $TORRENT_LABEL in
films|movies|film|movie)
/filebot/filebot.sh --db TheMovieDB -script fn:amc --output "/data/Media" --action <FILEBOT_RENAME_METHOD> --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y "movieFormat=/data/Media/Movies/<FILEBOT_RENAME_MOVIES>" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=Movie" &
;;
music|musics|musique|musiques)
/filebot/filebot.sh --db ID3 -script fn:amc --output "/data/Media" --action <FILEBOT_RENAME_METHOD> --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y music=y "musicFormat=/data/Media/Music/<FILEBOT_RENAME_MUSICS>" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=Music" &
;;
tv|"tv show"|"tv shows"|series|serie)
/filebot/filebot.sh --db TheTVDB -script fn:amc --output "/data/Media" --action <FILEBOT_RENAME_METHOD> --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y "seriesFormat=/data/Media/TV/<FILEBOT_RENAME_SERIES>" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=TV Show" &
;;
anime|animes)
/filebot/filebot.sh --db AniDB -script fn:amc --output "/data/Media" --action <FILEBOT_RENAME_METHOD> --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y "animeFormat=/data/Media/Animes/<FILEBOT_RENAME_ANIMES>" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=Anime" &
;;
*)
/filebot/filebot.sh -script fn:amc --output "/data/Media" --action <FILEBOT_RENAME_METHOD> --conflict skip -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y music=y "seriesFormat=/data/Media/TV/<FILEBOT_RENAME_SERIES>" "animeFormat=/data/Media/Animes/<FILEBOT_RENAME_ANIMES>" "movieFormat=/data/Media/Movies/<FILEBOT_RENAME_MOVIES>" "musicFormat=/data/Media/Music/<FILEBOT_RENAME_MUSICS>" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=$TORRENT_LABEL" &
;;
esac

View File

@ -0,0 +1,11 @@
#!/bin/sh
(sleep 10; find /data/Media -type l | while read in; do
file "$in" | grep "broken symbolic link"
if [ $? -ne 1 ]; then
echo "Delete $in"
rm -f "$in"
fi
done
find /data/Media/ -type d -empty -exec rm -r {} \;) >> /tmp/postrm.log &

View File

@ -0,0 +1,28 @@
scgi_local = /tmp/rtorrent.sock
encoding_list = UTF-8
port_range = 49184-49184
port_random = no
check_hash = no
directory = /data/torrents
session = /data/.session
encryption = allow_incoming, try_outgoing, enable_retry
use_udp_trackers = yes
dht = off
peer_exchange = no
min_peers = 1
max_peers = 100
min_peers_seed = 1
max_peers_seed = 50
max_uploads = 15
network.xmlrpc.size_limit.set = 10000000
schedule = watch_directory,1,1,"load_start=/data/.watch/*.torrent"
schedule = untied_directory,5,5,"stop_untied=/data/.watch/*.torrent"
schedule = scgi_permission,0,0,"execute.nothrow=chmod,\"g+w,o=\",/tmp/rtorrent.sock"
schedule = insufficient_disk_space,1,30,close_low_diskspace=500M
system.method.set_key=event.download.finished,filebot,"execute={/usr/bin/postdl,$d.get_base_path=,$d.get_name=,$d.get_custom1=}"
system.method.set_key=event.download.erased,filebot_cleaner,"execute={/usr/bin/postrm}"

View File

@ -0,0 +1,30 @@
#!/bin/sh
mkdir -p /data/torrents
mkdir -p /data/.watch
mkdir -p /data/.session
mkdir -p /data/Media/Movies
mkdir -p /data/Media/TV
mkdir -p /data/Media/Animes
mkdir -p /data/Media/Music
sed -i -e "s|<FLOOD_SECRET>|$FLOOD_SECRET|g" \
-e "s|<CONTEXT_PATH>|$CONTEXT_PATH|g" /usr/flood/config.js
sed -i -e 's#<FILEBOT_RENAME_MOVIES>#'"$FILEBOT_RENAME_MOVIES"'#' \
-e 's#<FILEBOT_RENAME_METHOD>#'"$FILEBOT_RENAME_METHOD"'#' \
-e 's#<FILEBOT_RENAME_MUSICS>#'"$FILEBOT_RENAME_MUSICS"'#' \
-e 's#<FILEBOT_RENAME_SERIES>#'"$FILEBOT_RENAME_SERIES"'#' \
-e 's#<FILEBOT_RENAME_ANIMES>#'"$FILEBOT_RENAME_ANIMES"'#' /usr/bin/postdl
rm -f /data/.session/rtorrent.lock
chown -R $UID:$GID /data /home/torrent /tmp /filebot /usr/flood /flood-db /etc/s6.d
if [ ${RTORRENT_SCGI} -ne 0 ]; then
sed -i -e 's|^scgi_local.*$|scgi_port = 0.0.0.0:'${RTORRENT_SCGI}'|' /home/torrent/.rtorrent.rc
sed -i -e 's|socket: true,|socket: false,|' -e 's|port: 5000,|port: '${RTORRENT_SCGI}',|' /usr/flood/config.js
fi
exec su-exec $UID:$GID /bin/s6-svscan /etc/s6.d

View File

@ -0,0 +1,3 @@
#!/bin/sh
exit 0

View File

@ -0,0 +1,3 @@
#!/bin/sh
cd /usr/flood
exec /usr/flood/server/bin/www

View File

@ -0,0 +1,6 @@
#!/bin/sh
export TERM="xterm"
export HOME="/home/torrent"
export PWD="/home/torrent"
cd /home/torrent
exec rtorrent