Created 0 Symlinks
I seem to be having the same issue as #42 where there are 0 symlinks created and I believe it's because it's confused on how to create the symlinks. Since my Plex server is connected to my NAS via UNC, it's impossible for os.symlink(old_path, new_path) to actually complete since that Python command won't work for UNC shares/paths.
This script is being ran from my NAS directly, so I've been going down a rabbit hole to figure out if it's possible to implement the way the Path Mapping works on Plex_Autoscan.
This way Python-Plexlibrary would see \\fileserver\TV\ and map it to /volume2/TV which should create the symlinks correctly on the NAS.
My Python skills are terrible so I've come up with a quick and dirty hack until I teach myself a better way of doing this (adding path mapping variable to the yml and then using a function to replace it)
Added import ntpath to the top of recipe.py
Replaced movie references of:
old_path, file_name = os.path.split(old_path_file)
with:
old_path = ntpath.dirname(old_path_file)
old_path = old_path.replace('\\\\SERVERNAME\\movies\\', '/volume2/Movies/')
file_name = ntpath.basename(old_path_file)
Replaced TV references of:
old_path, file_name = os.path.split(old_path_file)
with:
old_path = ntpath.dirname(ntpath.dirname(old_path_file))
old_path = old_path.replace('\\\\SERVERNAME\\tv\\', '/volume2/TV/')
Now running the recipes work and actually create symlinks on my Synology
I would like to add, if anyone is having this issue with Plex docker you need to make sure the symlinks are being created relative to the internal container paths which I accomplish by running python-plexlibrary from inside the Plex container.
I setup a simple docker file to install python and the requirements to allow this without having to manually install them any time the container updates:
FROM plexinc/pms-docker:public
USER 1001:1001
RUN \
# Update and and install python3 + pip for python-plexlibrary
apt-get update && \
apt-get install -y \
python3 \
python3-pip \
&& \
# Cleanup
apt-get -y autoremove && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
rm -rf /var/tmp/*
# Install python-plexlibrary requirements
RUN pip3 install plexapi requests trakt pyyaml
Once everything is installed on the container I mount the folder with python-plexlibrary in the container in /scripts.
If you want to run this as a cron or interactively from the host system you can use something like:
docker exec plex python3 /scripts/python-plexlibrary/plexlibrary movies_imdb_top_250
Hopefully this is helpful to someone. It might not be the best way to do it but its what worked for me.
@jacc1234 do you use cloud or physical storage what are the symlinks really doing?