jacobwgillespie/plex-sync

TypeError: Cannot read property 'row' of undefined

Closed this issue · 12 comments

Attempting to sync two plex servers, running the command on a CentOS 7 server. I received the following error:

DRY_RUN=1 plex-sync 192.168.2.230/1,r 192.168.2.235/1,w
Reading data from 192.168.2.230:32400, 192.168.2.235:32400...
TypeError: Cannot read property 'row' of undefined
    at ProgressBar.terminate (/usr/lib/node_modules/plex-sync/node_modules/ascii-progress/index.js:439:34)
    at ProgressBar.snoop (/usr/lib/node_modules/plex-sync/node_modules/ascii-progress/index.js:420:10)
    at ProgressBar.tick (/usr/lib/node_modules/plex-sync/node_modules/ascii-progress/index.js:159:8)
    at /usr/lib/node_modules/plex-sync/lib/ui.js:35:14
    at Array.map (native)
    at progressMap (/usr/lib/node_modules/plex-sync/lib/ui.js:34:38)
    at _callee$ (/usr/lib/node_modules/plex-sync/lib/index.js:68:48)
    at tryCatch (/usr/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:62:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:336:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/lib/node_modules/plex-sync/node_modules/regenerator-runtime/runtime.js:95:21)

Running Plex version 1.2.2.2857 for Windows on 192.168.2.230 and Plex DVR beta version 1.2.0.2838 for CentOS on 192.168.2.235

Are you setting your Plex authentication token someplace? You may want to update to v0.5.1 (just released) which provides some more helpful error messages if the tool cannot determine the Plex authentication token.

Hi Jacob

Getting the same thing when trying to install this on either an ubuntu server, Debian, node Docker, etc. This is trying with Node v4.6.1, 6.9.1

When running npm install -g plex-sync there is an issue building get-cursor-position I believe that is causing this to break (ascii-progress relies on get-cursor-position)

The only place I've gotten it to work myself in on my Mac of all things.

Here's the error I get building get-cursor-position:

gyp WARN EACCES user "undefined" does not have permission to access the dev dir "/root/.node-gyp/6.9.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/plex-sync/node_modules/get-cursor-position/.node-gyp"
....
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/usr/local/lib/node_modules/plex-sync/node_modules/get-cursor-position/build'
  CXX(target) Release/obj.target/pos/src/pos.o
../src/pos.cc: In function 'void Method(const v8::FunctionCallbackInfo<v8::Value>&)':
../src/pos.cc:222:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret, fd, row, col;
      ^
  SOLINK_MODULE(target) Release/obj.target/pos.node
  COPY Release/pos.node
make: Leaving directory '/usr/local/lib/node_modules/plex-sync/node_modules/get-cursor-position/build'

Here's a quick way to test via Docker

from the CLI:
docker run -ti --rm ubuntu:latest bash

Within the docker just created:

apt-get update
apt-get install nodejs npm
ln -s /usr/bin/nodejs /usr/bin/node
npm install -g plex-sync
plex-sync ....

This should generate the error.

You could also try a native Node docker:

docker run -ti --rm node:latest bash

npm install -g plex-sync
plex-sync ....

I stand corrected, the second command works, just tried it.

Sorry about that (been fighting with the same error as @kesawi for a few hours now.

Ah, yep, I can reproduce it on my Windows machine... I probably need to find a replacement progress library.

If you have any example API responses and want to share, I'd be happy to debug. Those are the output of the URL:

http://SERVER_HOST/library/sections/SECTION_NUMBER/allLeaves?X-Plex-Token=PLEX_TOKEN

Either someplace like Gists or via email to jacobwgillespie@gmail.com works for me.

When running npm install -g plex-sync I also get the same issue as @jrarseneau building get-cursor-position.

Running the same command and then plex-sync in docker works without problems.

Also, probably a separate topic, but can you sync different Plex Home users' status?

@jrarseneau and @kesawi, I just released v0.5.2 which updates the progress library to something supported on Windows.

@kesawi this does support syncing across different Plex Home users' statuses I believe, you will just need to locate their respective Plex authentication tokens. I updated my bookmarklet for this today, or you can use the official docs. Each Plex Home user should have a different token (let me know if they're the same and I can look into it).

Your command would look like:

$ plex-sync xxxTOKEN1xxx@127.0.0.1/1 xxxTOKEN2xxx@127.0.0.1/1

Are you still experiencing the Cannot read property 'row' of undefined error? And if so, you're trying to sync a Movie or TV library, correct?

Actually, taking a second look at the trace for that error shows it's inside the progress bar library I just replaced - let me know if v0.5.2 has any issues, but I believe your problems should be resolved.

Ping me back here if it works and I'll close this issue.

Closing as I believe this is fixed, but feel free to let me know if anything pops up.

@jacobwgillespie, sorry, I haven't had an opportunity to test out 0.5.2 due to things just being really hectic for me. In relation to the token, I was unable to locate the separate token for the different Plex Home users. I've found that the view the XML option isn't present when viewing items in the library as one of the home users rather than the main user. Probably should raise syncing between different home users as its own issue as it is separate from the original reason I opened this thread for.

@kesawi no problem, and no rush, I can always reopen if/when something comes up.

You might try this bookmarklet that I wrote for capturing the token. If it's still working, you'd just switch users to the user you want to grab a token for, then click the bookmarklet and it'll give you a copyable token. If you have any issues or the bookmarklet's broken, feel free to post here or open another issue.

👍

That bookmarket, BTW, is just grabbing the following from the JS console, if that's easier:

window.PLEXWEB.myPlexAccessToken || window.localStorage.myPlexAccessToken