diff --git a/.gitignore b/.gitignore index c7e3ba6c..aceef55c 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ flixctl /aws/lambda/plex/dispatcher/lambda.zip /aws/lambda/plex/executor/lambda.zip /aws/lambda/torrent/lambda.zip -/aws/lambda/torrent/library.zip +/aws/lambda/library/lambda.zip ### Intellij ### # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm diff --git a/README.adoc b/README.adoc index 09a293cc..d6c26e5a 100644 --- a/README.adoc +++ b/README.adoc @@ -102,6 +102,7 @@ Available Commands: start To Start Plex status To Get Plex Status stop To Stop Plex + token To Get Plex Token Flags: -h, --help help for plex @@ -112,6 +113,7 @@ Use "flixctl plex [command] --help" for more information about a command. ---- $ flixctl library --help To Control Media Library + Usage: flixctl library [command] @@ -153,6 +155,7 @@ flixctl version ---- ==== ```flixctl plex``` ---- +flixctl plex token flixctl plex start --slack-notification "true" --slack-notification-channel "monitoring" flixctl plex stop --slack-notification false flixctl plex status --slack-notification false diff --git a/cmd/torrent/download.go b/cmd/torrent/download.go index d6c1f9a1..2d5c19ba 100644 --- a/cmd/torrent/download.go +++ b/cmd/torrent/download.go @@ -1,10 +1,8 @@ package torrent import ( - "encoding/base64" "encoding/json" "fmt" - "os" sess "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/ec2" @@ -20,18 +18,6 @@ var DownloadTorrentCmd = &cobra.Command{ Short: "To Download A Torrent", Long: "to download a torrent using Transmission client.", Run: func(cmd *cobra.Command, args []string) { - envMagnetLink := os.Getenv("MAGNET_LINK") - envDownloadDir := os.Getenv("DOWNLOAD_DIR") - if envDownloadDir != "" && envMagnetLink == "" { - // coming from web-hook - downloadDir = envDownloadDir - decodedEnvMagnetLink, err := base64.StdEncoding.DecodeString(envMagnetLink) - if err != nil { - fmt.Printf("Could not decode the magnet link: [%s]\n", err) - panic(err) - } - magnetLink = string(decodedEnvMagnetLink) - } var awsSession = sess.Must(sess.NewSessionWithOptions(sess.Options{ SharedConfigState: sess.SharedConfigEnable, })) diff --git a/cmd/torrent/search.go b/cmd/torrent/search.go index 615e5457..3a5be4cf 100644 --- a/cmd/torrent/search.go +++ b/cmd/torrent/search.go @@ -3,7 +3,6 @@ package torrent import ( "encoding/json" "fmt" - "os" "sort" "strings" @@ -17,13 +16,6 @@ var SearchTorrentCmd = &cobra.Command{ Short: "To Search For Torrents", Long: "to search for torrents using the given keyword(s)", Run: func(cmd *cobra.Command, args []string) { - envKeywords := os.Getenv("KEYWORDS") - envDownloadDir := os.Getenv("DOWNLOAD_DIR") - if envKeywords != "" && envDownloadDir != "" { - // coming from web-hook - keywords = envKeywords - downloadDir = envDownloadDir - } torrentSearch := torrentService.Search{ In: keywords, SourcesToLookup: []string{ diff --git a/hooks/torrent.sh b/hooks/torrent.sh index 9d7788f6..b1777615 100644 --- a/hooks/torrent.sh +++ b/hooks/torrent.sh @@ -19,7 +19,7 @@ case $# in /home/webhook/go/bin/flixctl torrent \ download \ --download-dir "${DOWNLOAD_DIR}" \ - --magnet-link "${MAGNET_LINK}" \ + --magnet-link "$(echo `echo "${MAGNET_LINK}" | base64 --decode`)" \ --slack-notification-channel "${SLACK_TORRENT_INCOMING_HOOK_URL}" ;; search)