Skip to content

Commit

Permalink
fix(radarr): Update auth request to server
Browse files Browse the repository at this point in the history
  • Loading branch information
pando85 committed Jan 23, 2024
1 parent dcfe9e7 commit 575c119
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions radarr/add/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func PrintTranscoderResponse(jsonStr []byte) error {
return nil
}

func AddMovieToTranscoderQueue(path string, url string) error {
func AddMovieToTranscoderQueue(path string, url string, token string) error {
payload := map[string]string{
"SourcePath": path,
}
Expand All @@ -107,7 +107,9 @@ func AddMovieToTranscoderQueue(path string, url string) error {
return err
}

authHeader := fmt.Sprintf("Bearer %s", token)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", authHeader)

client := http.Client{}

Expand Down Expand Up @@ -150,7 +152,7 @@ func main() {
return
}

transcoderPostURL := fmt.Sprintf("%s/api/v1/job/?token=%s", *transcoderURL, *transcoderToken)
transcoderPostURL := fmt.Sprintf("%s/api/v1/job/", *transcoderURL)

c := starr.New(*apiKey, *radarrURL, 0)
r := radarr.New(c)
Expand Down Expand Up @@ -186,7 +188,7 @@ func main() {
fmt.Printf("Full Path: %s\n\n", m.MovieFile.Path)

if !*dryRun {
err := AddMovieToTranscoderQueue(m.MovieFile.Path, transcoderPostURL)
err := AddMovieToTranscoderQueue(m.MovieFile.Path, transcoderPostURL, *transcoderToken)
if err != nil {
fmt.Println("error:", err)
os.Exit(1)
Expand Down

0 comments on commit 575c119

Please sign in to comment.