Skip to content

Commit

Permalink
fix(plex): json parsing (Cloudbox#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-rots authored Aug 3, 2020
1 parent 23f39c3 commit e63749f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions targets/plex/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package plex

import (
"encoding/json"
"encoding/xml"
"fmt"
"net/http"
"net/url"
Expand Down Expand Up @@ -110,7 +109,7 @@ func (c apiClient) Libraries() ([]library, error) {
type Response struct {
MediaContainer struct {
Libraries []struct {
ID int `json:"key"`
ID int `json:"key,string"`
Name string `json:"title"`
Sections []struct {
Path string `json:"path"`
Expand All @@ -120,7 +119,7 @@ func (c apiClient) Libraries() ([]library, error) {
}

resp := new(Response)
if err := xml.NewDecoder(res.Body).Decode(resp); err != nil {
if err := json.NewDecoder(res.Body).Decode(resp); err != nil {
return nil, fmt.Errorf("failed decoding libraries response: %v: %w", err, autoscan.ErrFatal)
}

Expand Down

0 comments on commit e63749f

Please # to comment.