okbrown / plexserver-telegram-bot

A Bot that can send messages to your Plex Media Server API endpoints and return information about your media collection
9 stars 1 forks source link

Setup issue #1

Open elRadix opened 7 years ago

elRadix commented 7 years ago

first of all, I like your project a lot.

I installed on debian chroot synology nas, can you probably help here to fix the issue i have below. I have run other telegram bots in the past like the sonar-bot successfully.

[#] root -> npm install npm WARN optional Skipping failed optional dependency /chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14 npm WARN plexbot@0.2.0 No repository field.

[#] root -> uname -a Linux 3.10.77 #8451 SMP Wed Aug 17 05:12:45 CST 2016 x86_64 GNU/Linux

elRadix commented 7 years ago

here some more log details

[#] root -> npm install --verbose npm info it worked if it ends with ok npm verb cli [ 'node', '/usr/bin/npm', 'install', '--verbose' ] npm info using npm@3.10.9 npm info using node@v0.10.29 npm verb node symlink /usr/bin/node npm verb request uri https://registry.npmjs.org/fsevents npm verb request no auth needed npm info attempt registry request try #1 at 15:00:06 npm verb request id 544f220aa0e20f17 npm verb etag "J1WMJADQEUBTKGSOYI5A2X04" npm http request GET https://registry.npmjs.org/fsevents npm http 304 https://registry.npmjs.org/fsevents npm verb headers { date: 'Mon, 10 Oct 2016 12:58:27 GMT', npm verb headers via: '1.1 varnish', npm verb headers 'cache-control': 'max-age=300', npm verb headers etag: '"J1WMJADQEUBTKGSOYI5A2X04"', npm verb headers age: '12', npm verb headers connection: 'keep-alive', npm verb headers 'x-served-by': 'cache-ams4423-AMS', npm verb headers 'x-cache': 'HIT', npm verb headers 'x-cache-hits': '1', npm verb headers 'x-timer': 'S1476104307.916961,VS0,VE0', npm verb headers vary: 'Accept-Encoding' } npm verb etag https://registry.npmjs.org/fsevents from cache npm verb get saving fsevents to /root/.npm/registry.npmjs.org/fsevents/.cache.json npm verb correctMkdir /root/.npm correctMkdir not in flight; initializing npm info lifecycle plexbot@0.2.0~preinstall: plexbot@0.2.0 npm verb correctMkdir /root/.npm/_locks correctMkdir not in flight; initializing npm verb lock using /root/.npm/_locks/staging-5d36647e6b80b665.lock for /opt/plexserver-telegram-bot/node_modules/.staging npm verb unlock done using /root/.npm/_locks/staging-5d36647e6b80b665.lock for /opt/plexserver-telegram-bot/node_modules/.staging npm info linkStuff plexbot@0.2.0 npm verb linkBins plexbot@0.2.0 npm verb linkMans plexbot@0.2.0 npm info lifecycle plexbot@0.2.0~install: plexbot@0.2.0 npm info lifecycle plexbot@0.2.0~postinstall: plexbot@0.2.0 npm info lifecycle plexbot@0.2.0~prepublish: plexbot@0.2.0 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.14: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"ia32"}) npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux npm verb notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: ia32 npm WARN plexbot@0.2.0 No repository field. npm verb npm verb If you need help, you may report this error at: npm verb https://github.com/npm/npm/issues npm verb exit [ 0, true ] npm info ok

okbrown commented 7 years ago

Hey @elRadix thanks.. a quick google found this npm install --no-optional from http://stackoverflow.com/questions/36725181/not-compatible-with-your-operating-system-or-architecture-fsevents1-0-11

Give that a try. Also this version only supports episodes still coding for movies, etc because the JSON/XML structure is slightly different depending on the content.

elRadix commented 7 years ago

@okbrown thanks for your quick feedback, there is still an error remaining

[#] root -> npm install

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.14: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"ia32"}) npm WARN plexbot@0.2.0 No repository field.

[#] root -> npm install --no-optional

npm WARN plexbot@0.2.0 No repository field.

[#] root -> gulp develop

/opt/plexserver-telegram-bot/gulpfile.js:26 gulp.task('es6', () => { ^ SyntaxError: Unexpected token ) at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Liftoff.handleArguments (/usr/lib/node_modules/gulp/bin/gulp.js:116:3) at Liftoff. (/usr/lib/node_modules/gulp/node_modules/liftoff/index.js:192:16) at module.exports (/usr/lib/node_modules/gulp/node_modules/flagged-respawn/index.js:17:3) at Liftoff. (/usr/lib/node_modules/gulp/node_modules/liftoff/index.js:185:9) at /usr/lib/node_modules/gulp/node_modules/liftoff/index.js:159:9

ps, if successfully installed what are the next steps after completing the gulp command

okbrown commented 7 years ago

Hi elRadix,

Have you renamed the gulpfile as instructed in the readme?

elRadix commented 7 years ago

yes, see my updated post above

okbrown commented 7 years ago

git pull the repo and see if it works, as it shouldn't have ES6 syntax it yet. Just for compiling.

okbrown commented 7 years ago

Infact, I should not be compiling at this stage at all, will have to fix this when I get in later on.

elRadix commented 7 years ago

It works how, I mean the bot is working still some issue with my plex I suppose I did update the library id's but it is still complaining

[#] root -> gulp develop

[17:55:55] Using gulpfile /opt/plexserver-telegram-bot/gulpfile.js [17:55:55] Starting 'develop'... [17:55:55] Starting 'build'... [17:55:55] Starting 'es6'... [17:55:55] Finished 'es6' after 34 ms [17:55:55] Finished 'build' after 38 ms [17:55:55] Starting 'dev-server'... [17:55:55] Finished 'dev-server' after 431 ms [17:55:55] Finished 'develop' after 477 ms [17:55:56] [nodemon] 1.11.0 [17:55:56] [nodemon] to restart at any time, enter rs [17:55:56] [nodemon] watching: . [17:55:56] [nodemon] starting node dist/index.js { fromId: xxxxREMOVEDxxx, options: { uri: 'http:/imac.lan:32400/library/sections/2/newest', qs: { 'X-Plex-Token': 'xxxxxREMOVEDxxxxx' }, json: true } } PLEX API ERROR: { [RequestError: Error: Invalid URI "http:/imac.lan:32400/library/sections/2/newest"] name: 'RequestError', message: 'Error: Invalid URI "http:/imac.lan:32400/library/sections/2/newest"', cause: [Error: Invalid URI "http:/imac.lan:32400/library/sections/2/newest"], error: [Error: Invalid URI "http:/imac.lan:32400/library/sections/2/newest"], options: { uri: 'http:/imac.lan:32400/library/sections/2/newest', qs: { 'X-Plex-Token': 'xxxxxxxREMOVEDxxxxxx' }, json: true, callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false }, response: undefined } Unhandled rejection ReferenceError: Promise is not defined at /opt/plexserver-telegram-bot/dist/index.js:77:16 at tryCatcher (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:510:31) at Promise._settlePromise (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:567:18) at Promise._settlePromise0 (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:612:10) at Promise._settlePromises (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:687:18) at Async._drainQueue (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/async.js:138:16) at Async._drainQueues (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/async.js:148:10) at Async.drainQueues (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/async.js:17:14) at process._tickCallback (node.js:419:13)

okbrown commented 7 years ago

Have you changed the library ID numbers to reflect the libraries of your own? e.g. library/sections/2 <---

elRadix commented 7 years ago

yes, i have tested the url manually and i got an xml output in the browser as shown below. this is just an extract as the list is very long http:/192.168.1.2:32400/library/sections/4/newest

<MediaContainer size="70" allowSync="1" art="/:/resources/show-fanart.jpg" identifier="com.plexapp.plugins.library" librarySectionID="2" librarySectionTitle="TV Shows" librarySectionUUID="84e84c9e-93ee-49f1-b306-663a8c630919" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1475647789" mixedParents="1" nocache="1" thumb="/:/resources/show.png" title1="TV Shows" title2="Recently Aired" viewGroup="episode" viewMode="65592">
<Video ratingKey="26430" key="/library/metadata/26430" parentRatingKey="26216" grandparentRatingKey="26215" type="episode" title="Chestnut" grandparentKey="/library/metadata/26215" parentKey="/library/metadata/26216" grandparentTitle="Westworld" contentRating="TV-MA" summary="A pair of guests, first-timer William and repeat visitor Logan arrive at Westworld with different expectations and agendas. Bernard and Quality Assurance head Theresa Cullen debate whether a recent host anomaly is contagious. Meanwhile, behavior engineer Elsie Hughes tweaks the emotions of Maeve, a madam in Sweetwater’s brothel, in order to avoid a recall. Cocky programmer Lee Sizemore pitches his latest narrative to the team, but Dr. Ford has other ideas. The Man in Black conscripts a condemned man, Lawrence, to help him uncover Westworld’s deepest secrets." index="2" parentIndex="1" rating="8.9" year="2016" thumb="/library/metadata/26430/thumb/1476081155" art="/library/metadata/26215/art/1476094832" parentThumb="/library/metadata/26216/thumb/1476080308" grandparentThumb="/library/metadata/26215/thumb/1476094832" grandparentArt="/library/metadata/26215/art/1476094832" grandparentTheme="/library/metadata/26215/theme/1476094832" duration="3516519" originallyAvailableAt="2016-10-09" addedAt="1476080195" updatedAt="1476081155" chapterSource="">
<Media videoResolution="720" id="64680" duration="3516519" bitrate="3193" width="1280" height="720" aspectRatio="1.78" audioChannels="6" audioCodec="ac3" videoCodec="h264" container="mkv" videoFrameRate="24p" videoProfile="main">
<Part id="64723" key="/library/parts/64723/1476079633/file.mkv" duration="3516519" file="/Volumes/video/Series/Westworld/Westworld - S01E02 - Chestnut.mkv" size="1403564666" container="mkv" videoProfile="main"/>
</Media>
<Director tag="Richard J. Lewis"/>
<Writer tag="Jonathan Nolan"/>
<Writer tag="Lisa Joy"/>
</Video>

error message

fromId: xxxxREMOVEDxxxx,
  options: 
   { uri: 'http:/192.168.1.2:32400/library/sections/2/newest',
     qs: { 'X-Plex-Token': 'xxxxREMOVEDxxxx' },
     json: true } }
PLEX API ERROR:  { [RequestError: Error: Invalid URI "http:/192.168.1.2:32400/library/sections/2/newest"]
  name: 'RequestError',
  message: 'Error: Invalid URI "http:/192.168.1.2:32400/library/sections/2/newest"',
  cause: [Error: Invalid URI "http:/192.168.1.2:32400/library/sections/2/newest"],
  error: [Error: Invalid URI "http:/192.168.1.2:32400/library/sections/2/newest"],
  options: 
   { uri: 'http:/192.168.1.2:32400/library/sections/2/newest',
     qs: { 'X-Plex-Token': 'xxxxREMOVEDxxxx' },
     json: true,
     callback: [Function: RP$callback],
     transform: undefined,
     simple: true,
     resolveWithFullResponse: false,
     transform2xxOnly: false },
  response: undefined }
Unhandled rejection ReferenceError: Promise is not defined
    at /opt/plexserver-telegram-bot/dist/index.js:77:16
    at tryCatcher (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:510:31)
    at Promise._settlePromise (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:567:18)
    at Promise._settlePromise0 (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:687:18)
    at Async._drainQueue (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/async.js:138:16)
    at Async._drainQueues (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/async.js:148:10)
    at Async.drainQueues (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/async.js:17:14)
    at process._tickCallback (node.js:419:13)
okbrown commented 7 years ago

Hi elRadix, not sure if you noticed in my previous message, it is not working for movies at the moment, only episodes, as the JSON/XML structure the API returns is different for different types of media.

Its a simple thing to do, just as soon as I get the time.

elRadix commented 7 years ago

same error for tv shows, the above xml output is a tv show

okbrown commented 7 years ago

Not sure then, works fine on my setup, also just got /movies and /whoswatching working too now. Check out the latest commit.

Also do you have /tv /movies /whoswatching commands setup on your Telegram Bot?

okbrown commented 7 years ago

@elRadix looking over your comments, I dont think you have changed these lines of code to reflect which key your plex libraries are.

See https://github.com/okbrown/plexserver-telegram-bot/blob/master/src/plex-config/index.js#L12-L13

Check the updated Readme, for more info.

elRadix commented 7 years ago

@okbrown I did indeed update the plex index.js file with the correct ID for TV Shows, in my case it was also nr 2

I just did 'git pull' to get the latest update just now.

also the command in the telegram bot works /tv no issues with the bot, when I enter the /tv command the error is provided in my terminal output

[#] root -> gulp develop
[17:42:52] Using gulpfile /opt/plexserver-telegram-bot/gulpfile.js
[17:42:52] Starting 'develop'...
[17:42:52] Starting 'build'...
[17:42:52] Starting 'es6'...
[17:42:52] Finished 'es6' after 34 ms
[17:42:52] Finished 'build' after 38 ms
[17:42:52] Starting 'dev-server'...
[17:42:53] Finished 'dev-server' after 384 ms
[17:42:53] Finished 'develop' after 430 ms
[17:42:53] [nodemon] 1.11.0
[17:42:53] [nodemon] to restart at any time, enter `rs`
[17:42:53] [nodemon] watching: *.*
[17:42:53] [nodemon] starting `node dist/index.js`
[17:42:54] [nodemon] restarting due to changes...
Restarting Node...
[17:42:54] [nodemon] starting `node dist/index.js`
{ fromId: xxxxREMOVEDxxxx,
  options: 
   { uri: 'http:/192.168.1.2:32400/library/sections/2/newest',
     qs: { 'X-Plex-Token': 'xxxxREMOVEDxxxx' },
     json: true } }
PLEX API ERROR:  { [RequestError: Error: Invalid URI "http:/192.168.1.2:32400/library/sections/2/newest"]
  name: 'RequestError',
  message: 'Error: Invalid URI "http:/192.168.1.2:32400/library/sections/2/newest"',
  cause: [Error: Invalid URI "http:/192.168.1.2:32400/library/sections/2/newest"],
  error: [Error: Invalid URI "http:/192.168.1.2:32400/library/sections/2/newest"],
  options: 
   { uri: 'http:/192.168.1.2:32400/library/sections/2/newest',
     qs: { 'X-Plex-Token': 'xxxxREMOVEDxxxx' },
     json: true,
     callback: [Function: RP$callback],
     transform: undefined,
     simple: true,
     resolveWithFullResponse: false,
     transform2xxOnly: false },
  response: undefined }
Unhandled rejection ReferenceError: Promise is not defined
    at /opt/plexserver-telegram-bot/dist/index.js:77:16
    at tryCatcher (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:510:31)
    at Promise._settlePromise (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:567:18)
    at Promise._settlePromise0 (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/promise.js:687:18)
    at Async._drainQueue (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/async.js:138:16)
    at Async._drainQueues (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/async.js:148:10)
    at Async.drainQueues (/opt/plexserver-telegram-bot/node_modules/bluebird/js/release/async.js:17:14)
    at process._tickCallback (node.js:419:13)
elRadix commented 7 years ago

As you see the url in the browser is working but showing error above

Image of plex

okbrown commented 7 years ago

Very strange, let me think about this for a bit, and see what pops up. In the mean time, Unhandled rejection ReferenceError: Promise is not defined looks like an interesting part to start looking from.