Skip to content

Commit

Permalink
Merge branch 'main' into dn2_queue
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnewhall authored Feb 8, 2024
2 parents 310fb23 + 67159ff commit 377cb2d
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 37 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -550,18 +550,18 @@ integrations are used for things like storage, building, compiling, distribution
documentation support. This project succeeds because of them. Thank you!

<p style="text-align: center;">
<a title="PackageCloud" alt="PackageCloud" href="https://packagecloud.io"><img src="https://golift.io/integrations/packagecloud.png"/></a>
<a title="GitHub" alt="GitHub" href="https://GitHub.com"><img src="https://golift.io/integrations/octocat.png"/></a>
<a title="Docker Cloud" alt="Docker" href="https://cloud.docker.com"><img src="https://golift.io/integrations/docker.png"/></a>
<a title="Homebrew" alt="Homebrew" href="https://brew.sh"><img src="https://golift.io/integrations/homebrew.png"/></a>
<a title="Go Lift" alt="Go Lift" href="https://golift.io"><img src="https://golift.io/integrations/golift.png"/></a>
<a title="Better Uptime" alt="Go Lift" href="https://betteruptime.com"><img src="https://golift.io/integrations/betteruptime.png"/></a>
<a title="PackageCloud" alt="PackageCloud" href="https://packagecloud.io"><img src="https://docs.golift.io/integrations/packagecloud.png"/></a>
<a title="GitHub" alt="GitHub" href="https://GitHub.com"><img src="https://docs.golift.io/integrations/octocat.png"/></a>
<a title="Docker Cloud" alt="Docker" href="https://cloud.docker.com"><img src="https://docs.golift.io/integrations/docker.png"/></a>
<a title="Homebrew" alt="Homebrew" href="https://brew.sh"><img src="https://docs.golift.io/integrations/homebrew.png"/></a>
<a title="Go Lift" alt="Go Lift" href="https://golift.io"><img src="https://docs.golift.io/integrations/golift.png"/></a>
<a title="Better Uptime" alt="Go Lift" href="https://betteruptime.com"><img src="https://docs.golift.io/integrations/betteruptime.png"/></a>
</p>

## Contributing

Yes, please.
Join us on Discord and we can discuss.

## License

[MIT](https://github.com/Notifiarr/notifiarr/blob/main/LICENSE) - Copyright (c) 2020-2022 Go Lift
[MIT](https://github.com/Notifiarr/notifiarr/blob/main/LICENSE) - Copyright (c) 2020-2024 Go Lift
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/stretchr/testify v1.8.4
github.com/swaggo/swag v1.16.3
golang.org/x/crypto v0.19.0
golang.org/x/mod v0.14.0
golang.org/x/mod v0.15.0
golang.org/x/sys v0.17.0
golang.org/x/text v0.14.0
golang.org/x/time v0.5.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -320,6 +322,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down
8 changes: 4 additions & 4 deletions pkg/bindata/templates/triggers.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ <h1><i class="fas fa-fire-extinguisher"></i> Triggers</h1>
<td>Description</td>
</tr>
<tr>
<td>{{index .Expvar.TimerCounts "Starting Radarr TRaSH Profiles sync."}}</td>
<td>{{index .Expvar.TimerCounts "Starting Radarr profile and format sync."}}</td>
<td>{{.ClientInfo.Actions.Sync.Interval}}</td>
<td>
<a href="#triggers" onClick="triggerAction('cfsync')">Radarr TRaSH Sync</a></td><td>Syncs customized TRaSH profiles to Radarr.
<a href="#triggers" onClick="triggerAction('cfsync')">Radarr TRaSH Sync</a></td><td>Sync custom profiles and formats to Radarr.
</td>
</tr>
<tr>
<td>{{index .Expvar.TimerCounts "Starting Sonarr TRaSH Profiles sync."}}</td>
<td>{{index .Expvar.TimerCounts "Starting Sonarr profile and format sync."}}</td>
<td>{{.ClientInfo.Actions.Sync.Interval}}</td>
<td>
<a href="#triggers" onClick="triggerAction('rpsync')">Sonarr TRaSH Sync</a></td><td>Syncs customized TRaSH profiles to Sonarr.
<a href="#triggers" onClick="triggerAction('rpsync')">Sonarr TRaSH Sync</a></td><td>Sync custom profiles and formats to Sonarr.
</td>
</tr>
<tr>
Expand Down
17 changes: 9 additions & 8 deletions pkg/triggers/cfsync/radarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
)

const (
TrigCFSyncRadarr common.TriggerName = "Starting Radarr TRaSH Profiles sync."
TrigCFSyncRadarrInt common.TriggerName = "Starting Radarr %d TRaSH Profiles sync."
TrigCFSyncRadarr common.TriggerName = "Starting Radarr profile and format sync."
TrigCFSyncRadarrInt common.TriggerName = "Starting Radarr %d profile and format sync."
)

// RadarrTrashPayload is the payload sent and received
Expand Down Expand Up @@ -49,17 +49,17 @@ func (a *Action) SyncRadarrInstanceCF(event website.EventType, instance int) err
func (c *cmd) syncRadarr(ctx context.Context, input *common.ActionInput) {
ci := clientinfo.Get()
if ci == nil || len(ci.Actions.Sync.RadarrInstances) < 1 {
c.Debugf("[%s requested] Cannot sync Radarr Custom Formats. Website provided 0 instances.", input.Type)
c.Debugf("[%s requested] Cannot sync Radarr profiles and formats. Website provided 0 instances.", input.Type)
return
} else if len(c.Apps.Radarr) < 1 {
c.Debugf("[%s requested] Cannot sync Radarr Custom Formats. No Radarr instances configured.", input.Type)
c.Debugf("[%s requested] Cannot sync Radarr profiles and formats. No Radarr instances configured.", input.Type)
return
}

for idx, app := range c.Apps.Radarr {
instance := idx + 1
if !app.Enabled() || !ci.Actions.Sync.RadarrInstances.Has(instance) {
c.Debugf("[%s requested] CF Sync Skipping Radarr instance %d. Not in sync list: %v",
c.Debugf("[%s requested] Profiles and formats sync skipping Radarr instance %d. Not in sync list: %v",
input.Type, instance, ci.Actions.Sync.RadarrInstances)
continue
}
Expand All @@ -78,10 +78,10 @@ func (c *radarrApp) syncRadarr(ctx context.Context, input *common.ActionInput) {
Event: input.Type,
Params: []string{"app=radarr"},
Payload: payload,
LogMsg: fmt.Sprintf("Radarr TRaSH Sync (elapsed: %v)", time.Since(start).Round(time.Millisecond)),
LogMsg: fmt.Sprintf("Radarr profiles and formats sync (elapsed: %v)", time.Since(start).Round(time.Millisecond)),
LogPayload: true,
})
c.cmd.Printf("[%s requested] Synced Custom Formats for Radarr instance %d (%s/%s)",
c.cmd.Printf("[%s requested] Synced profiles and formats for Radarr instance %d (%s/%s)",
input.Type, c.idx+1, c.app.Name, c.app.URL)
}

Expand Down Expand Up @@ -138,7 +138,8 @@ func (c *cmd) aggregateTrashRadarr(
if app.Enabled() {
output = append(output, &RadarrTrashPayload{Instance: instance, Name: app.Name})
} else {
c.Errorf("[%s requested] Aggegregate request for disabled Radarr instance %d (%s)", event, instance, app.Name)
c.Errorf("[%s requested] Profiles and formats aggregate for disabled Radarr instance %d (%s)",
event, instance, app.Name)
}
}
}
Expand Down
17 changes: 9 additions & 8 deletions pkg/triggers/cfsync/sonarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
)

const (
TrigRPSyncSonarr common.TriggerName = "Starting Sonarr TRaSH Profiles sync."
TrigRPSyncSonarrInt common.TriggerName = "Starting Sonarr %d TRaSH Profiles sync."
TrigRPSyncSonarr common.TriggerName = "Starting Sonarr profile and format sync."
TrigRPSyncSonarrInt common.TriggerName = "Starting Sonarr %d profile and format sync."
)

// SonarrTrashPayload is the payload sent and received
Expand Down Expand Up @@ -50,17 +50,17 @@ func (a *Action) SyncSonarrInstanceRP(event website.EventType, instance int) err
func (c *cmd) syncSonarr(ctx context.Context, input *common.ActionInput) {
ci := clientinfo.Get()
if ci == nil || len(ci.Actions.Sync.SonarrInstances) < 1 {
c.Debugf("[%s requested] Cannot sync Sonarr Release Profiles. Website provided 0 instances.", input.Type)
c.Debugf("[%s requested] Cannot sync Sonarr profiles and formats. Website provided 0 instances.", input.Type)
return
} else if len(c.Apps.Sonarr) < 1 {
c.Debugf("[%s requested] Cannot sync Sonarr Release Profiles. No Sonarr instances configured.", input.Type)
c.Debugf("[%s requested] Cannot sync Sonarr profiles and formats. No Sonarr instances configured.", input.Type)
return
}

for idx, app := range c.Apps.Sonarr {
instance := idx + 1
if !app.Enabled() || !ci.Actions.Sync.SonarrInstances.Has(instance) {
c.Debugf("[%s requested] CF Sync Skipping Sonarr instance %d. Not in sync list: %v",
c.Debugf("[%s requested] Profiles and formats sync skipping Sonarr instance %d. Not in sync list: %v",
input.Type, instance, ci.Actions.Sync.SonarrInstances)
continue
}
Expand All @@ -78,10 +78,10 @@ func (c *sonarrApp) syncSonarr(ctx context.Context, input *common.ActionInput) {
Event: input.Type,
Params: []string{"app=sonarr"},
Payload: payload,
LogMsg: fmt.Sprintf("Sonarr TRaSH Sync (elapsed: %v)", time.Since(start).Round(time.Millisecond)),
LogMsg: fmt.Sprintf("Sonarr profiles and formats sync (elapsed: %v)", time.Since(start).Round(time.Millisecond)),
LogPayload: true,
})
c.cmd.Printf("[%s requested] Synced Release Profiles for Sonarr instance %d (%s/%s)",
c.cmd.Printf("[%s requested] Synced profiles and formats for Sonarr instance %d (%s/%s)",
input.Type, c.idx+1, c.app.Name, c.app.URL)
}

Expand Down Expand Up @@ -149,7 +149,8 @@ func (c *cmd) aggregateTrashSonarr(
if app.Enabled() {
output = append(output, &SonarrTrashPayload{Instance: instance, Name: app.Name})
} else {
c.Errorf("[%s requested] Aggegregate request for disabled Sonarr instance %d (%s)", event, instance, app.Name)
c.Errorf("[%s requested] Profiles and formats aggregate for disabled Sonarr instance %d (%s)",
event, instance, app.Name)
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/triggers/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (a *Actions) command(input *common.ActionInput, content string) (int, strin
return http.StatusOK, "Command triggered: " + cmd.Name
}

// @Description Sync TRaSH Radarr data.
// @Description Sync custom profiles and formats to Radarr.
// @Summary Sync TRaSH Radarr data
// @Tags Triggers,TRaSH
// @Produce json
Expand All @@ -254,18 +254,18 @@ func (a *Actions) command(input *common.ActionInput, content string) (int, strin
func (a *Actions) cfsync(input *common.ActionInput, content string) (int, string) {
if content == "" {
a.CFSync.SyncRadarrCF(input.Type)
return http.StatusOK, "TRaSH Custom Formats Radarr Sync initiated."
return http.StatusOK, "Radarr profile and format sync initiated."
}

instance, _ := strconv.Atoi(content)
if err := a.CFSync.SyncRadarrInstanceCF(input.Type, instance); err != nil {
return http.StatusBadRequest, "TRaSH Custom Formats Radarr Sync failed for instance " + content + ": " + err.Error()
return http.StatusBadRequest, "Radarr profile and format sync initiated for instance " + content + ": " + err.Error()
}

return http.StatusOK, "TRaSH Custom Formats Radarr Sync initiated for instance " + content
return http.StatusOK, "Radarr profile and format sync initiated for instance " + content
}

// @Description Sync TRaSH Sonarr data.
// @Description Sync custom profiles and formats to Sonarr.
// @Summary Sync TRaSH Sonarr data
// @Tags Triggers,TRaSH
// @Produce json
Expand All @@ -277,15 +277,15 @@ func (a *Actions) cfsync(input *common.ActionInput, content string) (int, string
func (a *Actions) rpsync(input *common.ActionInput, content string) (int, string) {
if content == "" {
a.CFSync.SyncSonarrRP(input.Type)
return http.StatusOK, "TRaSH Release Profile Sonarr Sync initiated."
return http.StatusOK, "Sonarr profile and format sync initiated."
}

instance, _ := strconv.Atoi(content)
if err := a.CFSync.SyncSonarrInstanceRP(input.Type, instance); err != nil {
return http.StatusBadRequest, "TRaSH Release Profile Sonarr Sync failed for instance " + content + ": " + err.Error()
return http.StatusBadRequest, "Sonarr profile and format sync initiated for instance " + content + ": " + err.Error()
}

return http.StatusOK, "TRaSH Release Profile Sonarr Sync initiated for instance " + content
return http.StatusOK, "Sonarr profile and format sync initiated for instance " + content
}

// @Description Reschedule all service checks to run immediately.
Expand Down

0 comments on commit 377cb2d

Please sign in to comment.