Skip to content

Instantly share code, notes, and snippets.

@Xaero252 Xaero252/Moved.md
Last active May 26, 2019

Embed
What would you like to do?
Enable nvdec support for plex dockers on unraid
@Xaero252

This comment has been minimized.

Copy link
Owner Author

Xaero252 commented Mar 8, 2019

Moved: https://github.com/Xaero252/unraid-plex-nvdec/

This script now depends on https://github.com/revr3nd/plex-nvdec/
Things that have changed with the most recent version of this script:

Changes 5/25/19"

  • Moved script to dedicated repo for issue tracking, pull requests et al.

Changes 4/24/19:

  • wget is now called on the HOST side, and output is redirected to docker exec should fix issues caused by different dockers having different tools
  • Removed redundant concatenation line. Thanks to MowMdown at unraid forums for pointing this out.

Changes 4/23/19:

Changes 3/9/19:

  • Changed heredoc sentinel from <<-'EOF' to <<'@EOF' this preserves indentation, but includes the leading two tabs.
  • Changed xargs -0 printf with sed to trim leading tabs present from above change.
  • Resulting script inside container is now properly indented. I know, this was REALLY nitpicky.
  • Added a conditional check for decoding even being present. For cards that have nvenc but no nvdec, or situations where for some reason your card isn't present.

Changes 3/7/19:

  • Wrapper script is contained inside a heredoc to make editing easier. Pay attention to the fi above the EOF - this must not have a trailing space attached to it.
  • Variables are now wrapped in double quotes as they should be. This shouldn't be a problem in this specific use case, but it's just best practice.
  • Shortened output statements and removed whitespace echos.
  • Output is now on one line, which makes logging output in case of errors more legible.
  • No longer restarts container (have tested numerous times - this is not needed.)
  • Swapped to terminal substitution $( ... ) instead of backticks ` ... ` for variable population
@PermaNulled

This comment has been minimized.

Copy link

PermaNulled commented Mar 10, 2019

This ends up throwing an error due to EOF in it's current state in User Scripts or an actual terminal. It's due to the spacing prior to @eof it should be all the way to the left with no padding, that appears to resolve the issue.

Applying hardware decode patch... ./patch_transcode.sh: line 36: warning: here-document at line 18 delimited by end-of-file (wanted `@EOF')
./patch_transcode.sh: line 37: syntax error: unexpected end of file

@Xaero252

This comment has been minimized.

Copy link
Owner Author

Xaero252 commented Mar 10, 2019

Oh man, I had it right originally and pushed the broken code. Commit history even shows it lol.

Fixed, thank you!

Frustrating that we can't have proper indentation everywhere though. heredocs are a blessing and a curse. I suppose I could put it in a variable but that feels ugly.

@unstat1c

This comment has been minimized.

Copy link

unstat1c commented Apr 24, 2019

i'm having this error:

Applying hardware decode patch...
Downloading patch script...
/bin/sh: 1: wget: not found
chmod: cannot access '/usr/lib/plexmediaserver/plex-nvdec-patch.sh': No such file or directory
/bin/sh: 1: /usr/lib/plexmediaserver/plex-nvdec-patch.sh: not found

on unraid user scripts, the old one was working...
what am i doing wrong?

@pducharme

This comment has been minimized.

Copy link

pducharme commented Apr 24, 2019

@unstat1c Looks like you don't have wget ? what Plex Docker are you using ?

@Xaero252 Looks like the Official PLEX inc. Docker doesn't know what is "wget". I get the same. Can you verify it it's present and if not, add it with a command?

@unstat1c

This comment has been minimized.

Copy link

unstat1c commented Apr 24, 2019

yup its the official docker

@Xaero252

This comment has been minimized.

Copy link
Owner Author

Xaero252 commented Apr 24, 2019

EDIT: please try the revised script, the issue should be resolved since unraid's wget is being used instead of the container's.

I see 4 potential solutions to this; I'm going to test something.

Solutions are:

  • Pure bash download function (will always work)
  • curl instead of wget (if it's present - it is in the ls.io container)
  • pipe the output of wget or curl into the docker exec command and use cat to push the content to the file (I assume unraid has wget and curl included, but this would break support for non unraid systems that don't have the required tool)
  • check for the appropriate tool, and if not present install it - I'd rather not do this.
@unstat1c

This comment has been minimized.

Copy link

unstat1c commented Apr 24, 2019

working fine with the oficial docker, the revised script did the trick, thanks!

@pducharme

This comment has been minimized.

Copy link

pducharme commented Apr 24, 2019

How should I put that in my User Scripts Plugin? I just need to create a new Script and copy what is here and run it when? Array start? what trigger you suggest?

@Xaero252

This comment has been minimized.

Copy link
Owner Author

Xaero252 commented Apr 24, 2019

I have mine set to run slightly after my CA Auto Updater. The only time the script should be run is when the plex docker is updated. There's no built-in trigger for force updating or installing a docker, so if you manually reinstall the docker you'll need to manually run the script, or wait for whenever you schedule it to run.
I'll work on writing a conditional for a case where either Plex Transcoder2 already exists, or the Plex Transcoder doesn't look like the original.
For example, my CA Auto Updater is set to run at ~3am - when probably nobody is going to be doing much with my server. Just after that at ~3:15am, I have this script scheduled to run.
And yes, you can just copy the script from gist directly into a new script on the user scripts plugin.

@Xaero252

This comment has been minimized.

Copy link
Owner Author

Xaero252 commented Apr 29, 2019

@J-Nerdy

This comment has been minimized.

Copy link

J-Nerdy commented May 19, 2019

@Xaero252 worked flawlessly with unRaid 6.7.0 and gtx1070

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.