Skip to content

Commit

Permalink
Modules update, auto url fixes. (#119)
Browse files Browse the repository at this point in the history
* sonarr fixes

* fix lint

* update deps

* whoops
  • Loading branch information
davidnewhall authored Oct 5, 2021
1 parent ad9898e commit 4b333bc
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 9 deletions.
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/gen2brain/beeep v0.0.0-20210529141713-5586760f0cc1
github.com/gen2brain/dlgs v0.0.0-20210609125024-bf6c92aaa984
github.com/gen2brain/dlgs v0.0.0-20210911090025-cbd38e821b98
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect
github.com/getlantern/errors v1.0.1 // indirect
github.com/getlantern/golog v0.0.0-20210606115803-bce9f9fe5a5f // indirect
Expand All @@ -18,10 +18,10 @@ require (
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 // indirect
github.com/godbus/dbus/v5 v5.0.4 // indirect
github.com/godbus/dbus/v5 v5.0.5 // indirect
github.com/gonutz/w32 v1.0.0
github.com/google/cabbie v1.0.2 // indirect
github.com/google/glazier v0.0.0-20210831085901-f44389497a84 // indirect
github.com/google/glazier v0.0.0-20211004192146-897b4e78b5fb // indirect
github.com/gopherjs/gopherjs v0.0.0-20210825203111-a709d8e111b3 // indirect
github.com/gopherjs/gopherwasm v1.1.0 // indirect
github.com/gorilla/mux v1.8.0
Expand All @@ -37,19 +37,19 @@ require (
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e // indirect
github.com/shirou/gopsutil/v3 v3.21.8
github.com/shirou/gopsutil/v3 v3.21.9
github.com/spf13/pflag v1.0.6-0.20201009195203-85dd5c8bc61c
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
github.com/tklauser/go-sysconf v0.3.9 // indirect
github.com/tklauser/numcpus v0.3.0 // indirect
golang.org/x/mod v0.5.0
golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e
golift.io/cnfg v0.0.8-0.20201101095209-9c9085f1bf93
golift.io/cnfg v0.0.8
golift.io/deluge v0.9.2
golift.io/qbit v0.0.0-20210717220751-d545c7a8f721
golift.io/rotatorr v0.0.0-20210307012029-65b11a8ea8f9
golift.io/starr v0.10.8
golift.io/starr v0.10.10
golift.io/version v0.0.2
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
Expand Down
14 changes: 14 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ github.com/gen2brain/beeep v0.0.0-20210529141713-5586760f0cc1 h1:Xh9mvwEmhbdXlRS
github.com/gen2brain/beeep v0.0.0-20210529141713-5586760f0cc1/go.mod h1:ElSskYZe3oM8kThaHGJ+kiN2yyUMVXMZ7WxF9QqLDS8=
github.com/gen2brain/dlgs v0.0.0-20210609125024-bf6c92aaa984 h1:nyWVnisZPgKmLuj8UiictFdpigdTMn7RB35TNmkl8ww=
github.com/gen2brain/dlgs v0.0.0-20210609125024-bf6c92aaa984/go.mod h1:/eFcjDXaU2THSOOqLxOPETIbHETnamk8FA/hMjhg/gU=
github.com/gen2brain/dlgs v0.0.0-20210911090025-cbd38e821b98 h1:wkHRSagNSNKP54v6Pf/Tebhe8bQLLkg6FQaM4/y8v2g=
github.com/gen2brain/dlgs v0.0.0-20210911090025-cbd38e821b98/go.mod h1:/eFcjDXaU2THSOOqLxOPETIbHETnamk8FA/hMjhg/gU=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY=
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7/go.mod h1:l+xpFBrCtDLpK9qNjxs+cHU6+BAdlBaxHqikB6Lku3A=
Expand Down Expand Up @@ -91,6 +93,8 @@ github.com/godbus/dbus v4.1.0+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZ
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.0.5 h1:9Eg0XUhQxtkV8ykTMKtMMYY72g4NgxtRq4jgh4Ih5YM=
github.com/godbus/dbus/v5 v5.0.5/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down Expand Up @@ -121,6 +125,8 @@ github.com/google/cabbie v1.0.2/go.mod h1:6MmHaUrgfabehCHAIaxdrbmvHSxUVXj3Abs08F
github.com/google/glazier v0.0.0-20210617205946-bf91b619f5d4/go.mod h1:g7oyIhindbeebnBh0hbFua5rv6XUt/nweDwIWdvxirg=
github.com/google/glazier v0.0.0-20210831085901-f44389497a84 h1:vhqqs8fR/R7rur9puPmnULBxza3jWneYsr00K7rtDiw=
github.com/google/glazier v0.0.0-20210831085901-f44389497a84/go.mod h1:h2R3DLUecGbLSyi6CcxBs5bdgtJhgK+lIffglvAcGKg=
github.com/google/glazier v0.0.0-20211004192146-897b4e78b5fb h1:aKKoI+bBzHIMMCoSayaS6BCNqU58Q+owVauyjsEqlwQ=
github.com/google/glazier v0.0.0-20211004192146-897b4e78b5fb/go.mod h1:h2R3DLUecGbLSyi6CcxBs5bdgtJhgK+lIffglvAcGKg=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
Expand Down Expand Up @@ -266,6 +272,8 @@ github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e/go.mod h1:9Tc1
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shirou/gopsutil/v3 v3.21.8 h1:nKct+uP0TV8DjjNiHanKf8SAuub+GNsbrOtM9Nl9biA=
github.com/shirou/gopsutil/v3 v3.21.8/go.mod h1:YWp/H8Qs5fVmf17v7JNZzA0mPJ+mS2e9JdiUF9LlKzQ=
github.com/shirou/gopsutil/v3 v3.21.9 h1:Vn4MUz2uXhqLSiCbGFRc0DILbMVLAY92DSkT8bsYrHg=
github.com/shirou/gopsutil/v3 v3.21.9/go.mod h1:YWp/H8Qs5fVmf17v7JNZzA0mPJ+mS2e9JdiUF9LlKzQ=
github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
Expand Down Expand Up @@ -444,6 +452,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golift.io/cnfg v0.0.8-0.20201101095209-9c9085f1bf93 h1:6zgmt5vpnqltfJ7Wfj16NT+rgMROC/Y+SvJrnKnoDfc=
golift.io/cnfg v0.0.8-0.20201101095209-9c9085f1bf93/go.mod h1:AsB0DJe7nv0bizKaoy3e3MjjOF7upTpMOMvsfv4CNNk=
golift.io/cnfg v0.0.8 h1:CmEgOoXuq4iXy3EaZPL+MKgyKmBEoxZ1D02vg9dyUWM=
golift.io/cnfg v0.0.8/go.mod h1:AsB0DJe7nv0bizKaoy3e3MjjOF7upTpMOMvsfv4CNNk=
golift.io/deluge v0.9.2 h1:G1NitZaOikjlqqvO0BZmSnmPgDY1sRzXv615KaCu38A=
golift.io/deluge v0.9.2/go.mod h1:6EhEMN8Bdqrx0A3IoySwKXeuwERDWb5G7GL7kZWODb8=
golift.io/qbit v0.0.0-20210717220751-d545c7a8f721 h1:hVHvpJ9X9fP3U7XBy1ohCeVLIf/KCxPXxEsQRtxMMGs=
Expand All @@ -452,6 +462,10 @@ golift.io/rotatorr v0.0.0-20210307012029-65b11a8ea8f9 h1:j/WeLF6Ew1lc/m8/bh5qleZ
golift.io/rotatorr v0.0.0-20210307012029-65b11a8ea8f9/go.mod h1:EZevRvIGRh8jDMwuYL0/tlPns0KynquPZzb0SerIC1s=
golift.io/starr v0.10.8 h1:O/gxXzeq16W8Ou+rLk+I4AARjyW8K9yjIqZjIL/8R9Y=
golift.io/starr v0.10.8/go.mod h1:2ZSbBMYCBGkgA18ihFRL6R4DelptIkAJrtW8wyxU9ew=
golift.io/starr v0.10.9 h1:mTQYWxOcujTEjJxALlU19LsgPuea1L/Bq4xSkXky4F8=
golift.io/starr v0.10.9/go.mod h1:2ZSbBMYCBGkgA18ihFRL6R4DelptIkAJrtW8wyxU9ew=
golift.io/starr v0.10.10 h1:c+CmsF8dr8bq5YKh1x8WtesZZlH+l6w2TiR6ZpLwboM=
golift.io/starr v0.10.10/go.mod h1:2ZSbBMYCBGkgA18ihFRL6R4DelptIkAJrtW8wyxU9ew=
golift.io/version v0.0.2 h1:i0gXRuSDHKs4O0sVDUg4+vNIuOxYoXhaxspftu2FRTE=
golift.io/version v0.0.2/go.mod h1:76aHNz8/Pm7CbuxIsDi97jABL5Zui3f2uZxDm4vB6hU=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
Expand Down
4 changes: 4 additions & 0 deletions pkg/apps/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,21 +167,25 @@ func (a *Apps) Setup(timeout time.Duration) error {

for i := range a.Radarr {
a.Radarr[i].Debugf = a.DebugLog.Printf
a.Radarr[i].Errorf = a.ErrorLog.Printf
a.Radarr[i].setup(timeout)
}

for i := range a.Readarr {
a.Readarr[i].Debugf = a.DebugLog.Printf
a.Readarr[i].Errorf = a.ErrorLog.Printf
a.Readarr[i].setup(timeout)
}

for i := range a.Sonarr {
a.Sonarr[i].Debugf = a.DebugLog.Printf
a.Sonarr[i].Errorf = a.ErrorLog.Printf
a.Sonarr[i].setup(timeout)
}

for i := range a.Lidarr {
a.Lidarr[i].Debugf = a.DebugLog.Printf
a.Lidarr[i].Errorf = a.ErrorLog.Printf
a.Lidarr[i].setup(timeout)
}

Expand Down
10 changes: 10 additions & 0 deletions pkg/apps/lidarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type LidarrConfig struct {
CheckQ *uint `toml:"check_q" xml:"check_q"`
*starr.Config
*lidarr.Lidarr
Errorf func(string, ...interface{}) `toml:"-" xml:"-"`
}

func (r *LidarrConfig) setup(timeout time.Duration) {
Expand All @@ -61,6 +62,15 @@ func (r *LidarrConfig) setup(timeout time.Duration) {
if r.StuckItem && r.CheckQ == nil {
i := uint(0)
r.CheckQ = &i
} else if r.CheckQ != nil {
r.StuckItem = true
}

if u, err := r.GetURL(); err != nil {
r.Errorf("Checking Lidarr Path: %v", err)
} else if u := strings.TrimRight(u, "/"); u != r.URL {
r.Errorf("Lidarr URL fixed: %s -> %s (continuing)", r.URL, u)
r.URL = u
}
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/apps/radarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type RadarrConfig struct {
CheckQ *uint `toml:"check_q" xml:"check_q"`
*starr.Config
*radarr.Radarr
Errorf func(string, ...interface{}) `toml:"-" xml:"-"`
}

func (r *RadarrConfig) setup(timeout time.Duration) {
Expand All @@ -64,6 +65,13 @@ func (r *RadarrConfig) setup(timeout time.Duration) {
} else if r.CheckQ != nil {
r.StuckItem = true
}

if u, err := r.GetURL(); err != nil {
r.Errorf("Checking Radarr Path: %v", err)
} else if u = strings.TrimRight(u, "/"); u != r.URL {
r.Errorf("Radarr URL fixed: %s -> %s (continuing)", r.URL, u)
r.URL = u
}
}

func radarrAddMovie(r *http.Request) (int, interface{}) {
Expand Down
8 changes: 8 additions & 0 deletions pkg/apps/readarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type ReadarrConfig struct {
CheckQ *uint `toml:"check_q" xml:"check_q"`
*starr.Config
*readarr.Readarr
Errorf func(string, ...interface{}) `toml:"-" xml:"-"`
}

func (r *ReadarrConfig) setup(timeout time.Duration) {
Expand All @@ -59,6 +60,13 @@ func (r *ReadarrConfig) setup(timeout time.Duration) {
} else if r.CheckQ != nil {
r.StuckItem = true
}

if u, err := r.GetURL(); err != nil {
r.Errorf("Checking Readarr Path: %v", err)
} else if u = strings.TrimRight(u, "/"); u != r.URL {
r.Errorf("Readarr URL fixed: %s -> %s (continuing)", r.URL, u)
r.URL = u
}
}

func readarrAddBook(r *http.Request) (int, interface{}) {
Expand Down
8 changes: 8 additions & 0 deletions pkg/apps/sonarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type SonarrConfig struct {
CheckQ *uint `toml:"check_q" xml:"check_q"`
*starr.Config
*sonarr.Sonarr
Errorf func(string, ...interface{}) `toml:"-" xml:"-"`
}

func (r *SonarrConfig) setup(timeout time.Duration) {
Expand All @@ -63,6 +64,13 @@ func (r *SonarrConfig) setup(timeout time.Duration) {
} else if r.CheckQ != nil {
r.StuckItem = true
}

if u, err := r.GetURL(); err != nil {
r.Errorf("Checking Sonarr Path: %v", err)
} else if u = strings.TrimRight(u, "/"); u != r.URL {
r.Errorf("Sonarr URL fixed: %s -> %s (continuing)", r.URL, u)
r.URL = u
}
}

func sonarrAddSeries(r *http.Request) (int, interface{}) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/mnd/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import "time"

// Application Constants.
const (
Mode0755 = 0755
Mode0750 = 0750
Mode0600 = 0600
Mode0755 = 0o755
Mode0750 = 0o750
Mode0600 = 0o600
Megabyte = 1024 * 1024
KB100 = 1024 * 100
OneDay = 24 * time.Hour
Expand Down

0 comments on commit 4b333bc

Please sign in to comment.