mstinaff / PMS_Updater

Shell script for updating the Plex Media Server inside the FreeNAS Plex plugin
MIT License
439 stars 91 forks source link

Preferences.xml file not found #58

Closed orrinwitt closed 3 years ago

orrinwitt commented 3 years ago

Within the last month, I started getting this message when I try to run the update script: sed: /Plex Media Server/Preferences.xml: no such file or directory

The Preferences.xml file is in "/iocage/jails/plexmediaserver/root/usr/local/plexdata-plexpass/Plex Media Server/Preferences.xml" (I'm assuming that's where it's supposed to be?)

The web GUI tells me there is a new version, but after not finding the xml file, it thinks I have the latest version (which is the old version)

I don't have any clue where to begin troubleshooting this. How would a necessary file be there, then all of a sudden not be there??

(see picture below for details)

plex problem

jbeez commented 3 years ago

You seem to be running it from the Freenas/Truenas HOST instead of inside the jail. So the paths will all be different. If you run it in the jail does the error go away? Also there is an issue downloading right now but I just fixed it on my fork and also submitted a pull request for this project to merge that code to fix it, so you may run into that.

If you aren't running it in the host and are running it in the jail, the jails filesystem from the host level starts at /iocage/jails/plexmediaserver/. for you

In there is a Plex Media Server/Preferences.xml file. There's also a Plex/ directory right in the root(at least on my install) and there's a usr/local/share/plexmediaserver-plexpass

The preferences file stores your auth token and its in that Preferences.xml file.

Do you see "/iocage/jails/plexmediaserver/Plex Media Server/" directory?

jarodwsams commented 3 years ago

I had to update the PLEXTOKEN path to include the full path of the Preferences.xml file. See below. Original: PLEXTOKEN="$(sed -n 's/.*PlexOnlineToken="//p' /Plex\ Media\ Server/Preferences.xml | sed 's/\".*//')" Updated: PLEXTOKEN="$(sed -n 's/.*PlexOnlineToken="//p' /usr/local/plexdata-plexpass/Plex\ Media\ Server/Preferences.xml | sed 's/\".*//')"

NOTE: I've got Plex Media Server installed manually in this jail. If you've installed Plex via the FreeNAS/TrueNAS Plugin system, the original path should work.

jbeez commented 3 years ago

Just realized I had a note in my code for this with it commented out, I should just make it detect if the plug-in version exists or not and go from there

jarodwsams commented 3 years ago

Just realized I had a note in my code for this with it commented out, I should just make it detect if the plug-in version exists or not and go from there

I was just thinking that the script should be updated to detect where the Plex Media Server directory exists, before it tries to do anything. I'm not great with bash scripts, but is it possible to execute a find command to locate the folder and start from there, instead of having a hard-coded path for the parent folder and Preferences parsing?

jbeez commented 3 years ago

check my repo or the patch I have in the pull request, my formatting in this comment section is horrible

check if we're in pms plugin, or standard jail

if [ -e "/Plex Media Server/Preferences.xml" ]; then { PREFS="/Plex Media Server/Preferences.xml" } else { PREFS="/usr/local/plexdata-plexpass/Plex Media Server/Preferences.xml" } fi PLEXTOKEN="$(sed -n 's/.PlexOnlineToken="//p' "${PREFS}" | sed 's/\".//')"

orrinwitt commented 3 years ago

hey sorry this took so long to respond to. life got busy, and i could only test it out when there was a plex update. @jbeez i grabbed your updated PMSupdater.sh file, and it worked like a champ. Thanks!