Open markfaine opened 1 year ago
The folder structure is given by your plex configuration. That means when you run plex in a docker container and passthrough a media folder such as /source/media
on the root machine to /media
in the plex container, plex will index it's library relative to /media
, not /source/media
. When the metadata script runs the export process, it fetches the library paths relative to the plex container (/media
). That means if your libraries are all in this parent /media
folder, the script can export metadata for multiple libraries.
However, the exporter is not capable of dealing with multiple passed through locations of the root machine.
Thanks, I kind of eventually figured it out. I'm not running plex in docker but I was hoping to run the metadata exporter in docker just for simplicity, fewer things to install, etc. I intend to run it with the 'once' option with cron outside of the container on the host. I have several libraries. They are all relative to /volume1, for example /volume1/movies /volume1/television, etc. So I tried,
docker run --rm -e ... -v /volume1:/media plex-media-exporter once
and I had some success after I included -e NODE_TLS_REJECT_UNAUTHORIZED=0
, however I eventually got stuck again with a different error:
/usr/src/app/index.js:9
const plexRootFolder = process.env.PLEX_ROOT_FOLDER.replace(/\/$/, ''); // remove trailing slash
^
TypeError: Cannot read property 'replace' of undefined
at Object.<anonymous> (/usr/src/app/index.js:9:53)
at Module._compile (internal/modules/cjs/loader.js:1114:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:979:32)
at Function.Module._load (internal/modules/cjs/loader.js:819:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
at internal/main/run_main_module.js:17:47
The error message looks like you haven't defined the PLEX_ROOT_FOLDER
env variable or passed somthing that's not a string. Try setting it like this:
docker run \
-e PLEX_ADDRESS='...' \
-e X_PLEX_TOKEN='...' \
-e PLEX_ROOT_FOLDER='/volume1' \
-e FILE_ENDING_PATTERN='...' \
-v /volume1:/volume1 \
once
Most likely, it also works with /media
when you've set the right env vars. However, maybe there are other issues with nodejs and it's dependencies - I haven't run the exporter since years^^
Jumping in on this issue as I think it may be somewhat related. I am running this on a Windows machine without Docker involved. My media is split across two physical drives, both with a X:/Media root path. It was very unclear what I needed to pass for the environment variable.
I eventually tried to pass an empty string ("") for the environment variable, and that seems to have made it happy. Not the most intuitive but it got me by.
I also replaced all of the directory writeFile calls with path.join() and the file structure. Not sure if it was placebo, but it does seem to have helped. I may make a PR with the simple change depending on how well I can get this to work for me.
The docker instructions seem to show that I need to run it once per library, is this correct or am I missing something, is there a way to run it once but for all libraries? If not, could there be?
Thanks, just getting started looking at it but it looks really nice.