jrudess / streamdvr

DVR for streaming entertainment
GNU General Public License v3.0
65 stars 16 forks source link

Permission Issue #124

Closed ghost closed 5 years ago

ghost commented 5 years ago

(node:15760) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'charAt' of null at Streamdvr.calcPath (/home/xxxxxxxxx/streamdvr/core/dvr.js:128:18) at Streamdvr.postProcess (/home/xxxxxxxxxx/streamdvr/core/dvr.js:200:29) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:745:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3) (node:15760) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:15760) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I'm getting this error unless I run as sudo

even if I give permissions to streamdvr folder even if I give permission to /home/xxxxx/.nvm/versions/node/v10.15.0/lib/node_modules which is my output for global node installs from npm root -g

Just trying to figure if I missed any thing

jrudess commented 5 years ago

What is your postprocess line in config.yml? The default should be

postprocess: ""

ghost commented 5 years ago

You have two post processing lines in the default config. So I left them both as they were in that one

enable: daemon: false recording: autoConvertType: mkv captureDirectory: /xxxxxxxxxxxxx/streamdvr/capturing/ completeDirectory: /xxxxxxxxxxxx/google/ postprocess:"scripts/postprocess_ffmpeg.sh" dateFormat: YYYY.MM.DD_HHmmss includeSiteInFile: false includeSiteInDir: false streamerSubdir: true siteSubdir: true keepTsFile: false minSize: 0 maxSize: 0 postprocess: "" log: enable: true append: true tui: enable: false logshown: true listshown: false allowUnicode: true colors: name: magenta state: yellow offline: blue prompt: blue file: green time: grey site: green cmd: grey debug: yellow error: redni proxy:s server: socks5://127.0.0.1:1080 debug: log: false recorder: false errortrace: false

jrudess commented 5 years ago

Ah yes, the one that is in the recording section is for the script that does conversions to mp4/mkv. The one that is standalone (right after maxSize) is for custom post-process scripts. But I did misread the code and it is the recording section one that is in the stack-trace.

at Streamdvr.postProcess (/home/xxxxxxxxxx/streamdvr/core/dvr.js:200:29)

This line is

const script = this.calcPath(this.config.recording.postprocess);

I don't see anything wrong in code yet, and haven't been able to reproduce this stacktrace. The stack-trace doesn't show any code which is actually trying to access a file, so I don't see a reason why using sudo would fix this.

So the only thing I can think of is that maybe all your indentation got lost in the yaml file? The indentation is very important for the yaml parser, and everything after recording: until maxSize: 0 should be indented 2 spaces. If nothing is indented, then I think that is probably the issue.

The paste of your config doesn't show any indentaton, but I know how it can tend to get lost in copy/paste when not using github code tags to preserve it, so I'd double check that. Also, since the config is looked for in multiple-places, do you use the default config/config.yml or do you have a copy in ~/.config/streamdvr/config.yml ?

ghost commented 5 years ago

Are you running these as root user.

If it helps the issue I'm seeing is that it can't convert non converted videos at the start of a new run. The only time it worked was when I ran it as sudo, but then it wants to run of the root user directory.

You did mentions somethings in your previous post. So I'd like to try that out.

jrudess commented 5 years ago

I only run streamdvr as a non-privileged user.

ghost commented 5 years ago

I think you made a change to how the program runs recently.

As it was throwing a lot of errors that it hadn't before. Yeah I think copy and paste was causing issues. So I moved the config file from the git repository instead.

Secondly even if I renamed a config file it would still pick that one up. So if I have config.yml with correct format from streamdvr reposit configold.yml with my values sometimes it will still pickup the values from configold.yml

So making sure there is only one config file seems to fix issues as well.

Seems to be working now as intended.

jrudess commented 5 years ago

There isn't any logic that can load a file named configold.yml. All references in core/dvr.js:findConfig() are only for config.yml. What matters is that there are multiple paths that the file can be loaded from, so if you have config.yml in multiple places, it will prioritize them based on the XDG_CONFIG_HOME standard.

ghost commented 5 years ago

I thought maybe it was just look at all the .yml files in the folder and then seeing which one match the correct syntax.

I figured that maybe that was part of the new plugin system.

Though now it seems that maybe there was a config I had not corrected that was causing the issue it seems.

Everything is good now it seems.