Open CLHatch opened 1 year ago
Looking at this again... this is what I have so far, taking it from your Docker file. The LSIO Plex container uses apt-get
instead of apk
, so using that instead. I also had to adjust the names of the python packages for Ubuntu. I'm not currently worrying about rclone
because I don't use it:
custom-cont-init.d/10-install_autoscan.sh:
#!/bin/bash
AUTOSCAN_VERSION=master
PYTHONUNBUFFERED=1
PIP_DISABLE_PIP_VERSION_CHECK=1
PIP_NO_CACHE_DIR=1
echo "**** install apk packages ****" && \
apt-get update -y&& \
apt-get install -y \
`# python3` \
python3 \
python3-pip \
python3-wheel \
`# pre-compiled python packages` \
python3-psutil \
`# core` \
findutils \
git \
unzip \
&& \
if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi && \
if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
echo "**** install plex_autoscan ****" && \
pip install "git+https://github.com/by275/plex_autoscan.git@${AUTOSCAN_VERSION}" && \
echo "**** cleanup ****" && \
apt-get autoremove --purge -y && \
rm -rf \
/root/.cache \
/tmp/*
export \
PLEX_AUTOSCAN_COLORLOG=1 \
PLEX_AUTOSCAN_CONFIG="/config/config.json" \
PLEX_AUTOSCAN_QUEUEFILE="/config/queue.db" \
PLEX_AUTOSCAN_CACHEFILE="/config/cache.db"
custom-cont-init.d/20-autoscan.sh:
#!/usr/bin/with-contenv bash
if [ ! -f "$PLEX_AUTOSCAN_CONFIG" ]; then
autoscan server
exit 1
fi
# permission
find "$(dirname "$PLEX_AUTOSCAN_CONFIG")" \! \( -uid "$(id -u abc)" -gid "$(id -g abc)" \) -print0 | \
xargs -0 --no-run-if-empty chown -h abc:abc
echo "*** $(autoscan -v) ready!"
exit 0
However, one problem I ran into is that the export
command didn't work as I'd hoped, I shell in and those variables are not set. The second problem I'm running into is not knowing where autoscan
has actually been installed. The system doesn't find it when it tries to run it. Here's the log when the Plex container starts up (shorter log here, since it's been run before and git
, pip
, etc have already been installed.
[custom-init] Files found, executing
[custom-init] 10-install_autoscan.sh: executing...
**** install apk packages ****
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
findutils is already the newest version (4.8.0-1ubuntu3).
python3-psutil is already the newest version (5.9.0-1build1).
git is already the newest version (1:2.34.1-1ubuntu1.10).
python3 is already the newest version (3.10.6-1~22.04).
unzip is already the newest version (6.0-26ubuntu3.1).
python3-pip is already the newest version (22.0.2+dfsg-1ubuntu0.3).
python3-wheel is already the newest version (0.37.1-2ubuntu0.22.04.1).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
**** install plex_autoscan ****
Collecting git+https://github.com/by275/plex_autoscan.git@master
Cloning https://github.com/by275/plex_autoscan.git (to revision master) to /tmp/pip-req-build-cte9iain
Running command git clone --filter=blob:none --quiet https://github.com/by275/plex_autoscan.git /tmp/pip-req-build-cte9iain
Resolved https://github.com/by275/plex_autoscan.git to commit c2c1e0599095deac131d125f0536fba520d1ebae
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
**** cleanup ****
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
[custom-init] 10-install_autoscan.sh: exited 0
[custom-init] 20-autoscan.sh: executing...
/custom-cont-init.d/20-autoscan.sh: line 4: autoscan: command not found
[custom-init] 20-autoscan.sh: exited 1
Starting Plex Media Server. . . (you can ignore the libusb_init error)
However, one problem I ran into is that the
export
command didn't work as I'd hoped, I shell in and those variables are not set.
Try to set ENVs in container level i.e. docker run -d -e ENV_YOU_WANT=VALUE
The second problem I'm running into is not knowing where
autoscan
has actually been installed. The system doesn't find it when it tries to run it.
After digging, it turns out that recent version of pip is required. Try upgrade pip before installing autoscan like pip install pip -U
In case you're wondering, here is my repo building plex_autoscan on top of LSIO docker-plex with some useful apps.
In case you're wondering, here is my repo building plex_autoscan on top of LSIO docker-plex with some useful apps.
I think I just found the one you're talking about: https://github.com/by275/docker-plex
What other tools does that add? And will it update itself to the "Plex Pass" versions like the LSIO one will?
Oh... forgot to leave a link. Sorry.
On init:
apt-get
packages: you specified/usr/local/bin:
And will it update itself to the "Plex Pass" versions like the LSIO one will?
All features supported by LISO also works with mine.
Oh... forgot to leave a link. Sorry.
On init:
- Install agents: default+specified
- Install
apt-get
packages: you specified- Wait for mounts: delay services until your mount points are ready.
/usr/local/bin:
- cleanup-ptc: cleaning up phototranscoder directory for recovering disk usages
- plex: useful plex-related operations like analyze repair stats optimize claim
And will it update itself to the "Plex Pass" versions like the LSIO one will?
All features supported by LISO also works with mine.
Sounds good, I'll try switching over to it as soon as someone stops watching a movie on my server. :)
That said, I'm betting many would find a more barebones "Docker Mod" of just plex_autoscan
to be very helpful, if you know how to or could figure out how to make one using that link up there. :)
Edit: I was actually looking at this earlier thinking it might be easier for me to create a Docker Mod, but it appears you have basically done that, just merged it all into a self-contained container. :) https://github.com/linuxserver/docker-mods
I will leave this issue open and consider supporting docker-mods later.
Before I saw that you had a Docker container, I was thinking of trying to "inject"
plex_autoscan
into the LSIOplex
container, using this as a guide:https://docs.linuxserver.io/general/container-customization
I started working on that, and did get it partially going, but not running yet, but then got side-tracked trying to get your pre-built Docker container up and running. Any chance of help on that, or possibly even make an official "Docker Mod" for it to inject it?