From 5c683a5a2f5ee3b0b693a07e44364dc16606fa8a Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Sun, 24 Apr 2016 23:01:33 +0100 Subject: [PATCH] Set ld_library_path when running transcoder. Set debug level on Plex New Transcoder --- bootstrap.sh | 2 ++ common/config.go | 2 +- main.go | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 5e9b604..ceccb3d 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -6,4 +6,6 @@ echo "CD'd to directory: $1" echo "Executing with parameters: ${@:2}" +export LD_LIBRARY_PATH=/usr/lib/plexmediaserver + /plexmediaserver/Resources/Plex\ New\ Transcoder "${@:2}" \ No newline at end of file diff --git a/common/config.go b/common/config.go index 58360db..6c49323 100644 --- a/common/config.go +++ b/common/config.go @@ -5,7 +5,7 @@ import ( ) type Config struct { - LogFile string `group:"config" namespace:"config"` + LogFile string `name: "logFile" group:"config" namespace:"config"` Plex *PlexConfig `group:"plex config" namespace:"plex"` Kubernetes *KubernetesConfig `group:"kubernetes executor" namespace:"kubernetes"` diff --git a/main.go b/main.go index c114219..34b0c70 100644 --- a/main.go +++ b/main.go @@ -19,6 +19,12 @@ const configFile = "/etc/plex-elastic-transcoder/config.yaml" var executor common.Executor +type NullWriter struct{} + +func (NullWriter) Write(p []byte) (n int, err error) { + return len(p), nil +} + func signals() { // Signal handling c := make(chan os.Signal, 1) @@ -59,15 +65,12 @@ func loadConfig() (*common.Config, error) { } func main() { - log.SetLevel(log.DebugLevel) config, err := loadConfig() if err != nil { log.Fatalf("error loading config: %s", err.Error()) } - log.Debugf("loaded config: %s", config) - // Setup signals signals() @@ -85,6 +88,9 @@ func main() { log.Fatalf("error closing file: %s", err) } }() + } else { + log.SetLevel(log.PanicLevel) + log.SetOutput(NullWriter{}) } // Get the arguments passed to Plex New Transcoder @@ -95,10 +101,11 @@ func main() { switch arg { case "-progressurl": log.Debugf("replacing progressURL with: %s", config.Plex.URL) - args[i+1] = strings.Replace(args[i+1], "127.0.0.1:32400", config.Plex.URL, 1) + args[i+1] = strings.Replace(args[i+1], "http://127.0.0.1:32400", config.Plex.URL, 1) break case "-loglevel": - case "loglevel_plex": + args[i+1] = "debug" + case "-loglevel_plex": args[i+1] = "debug" } }