Skip to content
This repository was archived by the owner on Dec 26, 2024. It is now read-only.

Commit b28f760

Browse files
committed
feat(arrs): add support for including unmonitored titles
1 parent f84f5d9 commit b28f760

File tree

6 files changed

+86
-56
lines changed

6 files changed

+86
-56
lines changed

README.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Omegabrr transforms items monitored by arrs or lists into autobrr filters. Useful for automating your filters for monitored media or racing criteria.
44

55
## Table of Contents
6+
67
- [Config](#config)
78
- [Tags](#tags)
89
- [Lists](#lists)
@@ -36,6 +37,7 @@ clients:
3637
filters:
3738
- 15 # Change me
3839
#matchRelease: false / true
40+
#includeUnmonitored: false # Set to true to include unmonitored items
3941

4042
- name: sonarr
4143
type: sonarr
@@ -50,6 +52,7 @@ clients:
5052
- 14 # Change me
5153
#matchRelease: false / true
5254
#excludeAlternateTitles: false/ true # only works for Sonarr and defaults to false
55+
#includeUnmonitored: false # Set to true to include unmonitored items
5356

5457
- name: lidarr
5558
type: lidarr
@@ -104,7 +107,7 @@ lists:
104107
url: https://api.autobrr.com/lists/trakt/popular-tv
105108
filters:
106109
- 25 # Change me
107-
110+
108111
- name: StevenLu
109112
type: trakt
110113
url: https://api.autobrr.com/lists/stevenlu
@@ -133,27 +136,27 @@ lists:
133136
If you're trying to reach radarr or sonarr hosted on swizzin from some other location, you need to do it like this with basic auth:
134137
135138
```yaml
136-
arr:
137-
- name: radarr
138-
type: radarr
139-
host: https://domain.com/radarr
140-
apikey: YOUR_API_KEY
141-
basicAuth:
142-
user: username
143-
pass: password
144-
filters:
145-
- 15 # Change me
139+
arr:
140+
- name: radarr
141+
type: radarr
142+
host: https://domain.com/radarr
143+
apikey: YOUR_API_KEY
144+
basicAuth:
145+
user: username
146+
pass: password
147+
filters:
148+
- 15 # Change me
146149
```
147150
148151
Same goes for autobrr if it's behind basic auth.
149152
150153
```yaml
151-
autobrr:
152-
host: http://localhost:7474
153-
apikey: YOUR_API_KEY
154-
basicAuth:
155-
user: username
156-
pass: password
154+
autobrr:
155+
host: http://localhost:7474
156+
apikey: YOUR_API_KEY
157+
basicAuth:
158+
user: username
159+
pass: password
157160
```
158161
159162
### Tags
@@ -188,7 +191,7 @@ If you want to exclude certain tags, you can use the `tagsExclude`.
188191

189192
### Lists
190193

191-
Formerly known as regbrr and maintained by community members is now integrated into omegabrr! We now maintain the lists of media.
194+
Formerly known as regbrr and maintained by community members is now integrated into omegabrr! We now maintain the lists of media.
192195

193196
**Trakt**
194197

@@ -215,6 +218,10 @@ Readarr will only use the `Match releases` field for now, so setting `matchRelea
215218

216219
You can drop alternate show titles from being added by setting `excludeAlternateTitles: true` for Sonarr in your config.
217220

221+
### Include Unmonitored Items
222+
223+
By default, omegabrr only processes monitored items. You can include unmonitored items by setting `includeUnmonitored: true` in your arr configuration. This is particularly useful in cross-seed scenarios where you want to match against all items.
224+
218225
## Plaintext lists specific options
219226

220227
Plaintext lists can be anything, therefore you can optionally set `matchRelease: true` or `album: true` to use these fields in your autobrr filter. If not set, it will use the `Movies / Shows` field.
@@ -242,6 +249,7 @@ server:
242249
port: 7441
243250
apiToken: MY_NEW_LONG_SECURE_TOKEN
244251
```
252+
245253
Call with `omegabrr generate-token`
246254
If you are using docker `docker exec omegabrr omegabrr generate-token`
247255
Optionally call with `--length <number>`for a custom length.
@@ -276,7 +284,7 @@ The API Token can be set as either an HTTP header like `X-API-Token`, or be pass
276284

277285
### Docker compose
278286

279-
Check the `docker-compose.yml` example.
287+
Check the `docker-compose.yml` example.
280288

281289
1. Set `user: 1000:1000` with your user id you can get with the `id` command, or remove to run as **root**.
282290
2. Set the `volume` so it matches your system. To run from the same path as the `docker-compose` first create a config dir like `mkdir config`, and place this `./config:/config` in the compose file. This will create a default config on the first run.
@@ -287,13 +295,13 @@ If you have custom networks then make sure to add those, so it can communicate w
287295

288296
For users who prioritize container security, we offer alternative Docker images built on [Distroless](https://github.com/GoogleContainerTools/distroless). Specifically the `distroless/static-debian12:nonroot` base image.
289297

290-
Distroless images do not contain a package manager or shell, thereby reducing the potential attack surface and making them a more secure option. These stripped-back images contain only the application and its runtime dependencies.
298+
Distroless images do not contain a package manager or shell, thereby reducing the potential attack surface and making them a more secure option. These stripped-back images contain only the application and its runtime dependencies.
291299

292300
### Systemd
293301

294302
On Linux-based systems it is recommended to run omegabrr as a systemd service.
295303

296-
Download the [latest binary](https://github.com/autobrr/omegabrr/releases/latest) for your system and place it in `/usr/local/bin`.
304+
Download the [latest binary](https://github.com/autobrr/omegabrr/releases/latest) for your system and place it in `/usr/local/bin`.
297305

298306
Example: Download binary
299307

internal/domain/config.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import (
66
"strings"
77
"text/template"
88

9-
"github.com/autobrr/omegabrr/internal/apitoken"
10-
119
"github.com/knadh/koanf"
1210
"github.com/knadh/koanf/parsers/yaml"
1311
"github.com/knadh/koanf/providers/file"
1412
"github.com/pkg/errors"
1513
"github.com/rs/zerolog/log"
14+
15+
"github.com/autobrr/omegabrr/internal/apitoken"
1616
)
1717

1818
type BasicAuth struct {
@@ -52,6 +52,7 @@ type ArrConfig struct {
5252
TagsExclude []string `koanf:"tagsExclude"`
5353
MatchRelease bool `koanf:"matchRelease"`
5454
ExcludeAlternateTitles bool `koanf:"excludeAlternateTitles"`
55+
IncludeUnmonitored bool `koanf:"includeUnmonitored"`
5556
}
5657

5758
type ArrType string
@@ -234,20 +235,23 @@ clients:
234235
# apikey: API_KEY
235236
# filters:
236237
# - 15 # Change me
238+
# includeUnmonitored: false # Set to true to include unmonitored items
237239
238240
#- name: radarr4k
239241
# type: radarr
240242
# host: http://localhost:7878
241243
# apikey: API_KEY
242244
# filters:
243245
# - 16 # Change me
246+
# includeUnmonitored: false # Set to true to include unmonitored items
244247
245248
#- name: sonarr
246249
# type: sonarr
247250
# host: http://localhost:8989
248251
# apikey: API_KEY
249252
# filters:
250253
# - 14 # Change me
254+
# includeUnmonitored: false # Set to true to include unmonitored items
251255
# #excludeAlternateTitles: true # defaults to false
252256
253257
#- name: readarr
@@ -256,13 +260,15 @@ clients:
256260
# apikey: API_KEY
257261
# filters:
258262
# - 18 # Change me
263+
# includeUnmonitored: false # Set to true to include unmonitored items
259264
260265
#- name: lidarr
261266
# type: lidarr
262267
# host: http://localhost:8686
263268
# apikey: API_KEY
264269
# filters:
265270
# - 32 # Change me
271+
# includeUnmonitored: false # Set to true to include unmonitored items
266272
267273
#- name: whisparr
268274
# type: whisparr
@@ -271,6 +277,7 @@ clients:
271277
# matchRelease: true
272278
# filters:
273279
# - 69 # Change me
280+
# includeUnmonitored: false # Set to true to include unmonitored items
274281
275282
lists:
276283
#- name: Latest TV Shows

internal/processor/radarr.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/autobrr/omegabrr/internal/domain"
10-
"github.com/autobrr/omegabrr/pkg/autobrr"
119
"github.com/pkg/errors"
12-
1310
"github.com/rs/zerolog"
1411
"github.com/rs/zerolog/log"
1512
"golift.io/starr"
1613
"golift.io/starr/radarr"
14+
15+
"github.com/autobrr/omegabrr/internal/domain"
16+
"github.com/autobrr/omegabrr/pkg/autobrr"
1717
)
1818

1919
func (s Service) radarr(ctx context.Context, cfg *domain.ArrConfig, dryRun bool, brr *autobrr.Client) error {
@@ -91,13 +91,12 @@ func (s Service) processRadarr(ctx context.Context, cfg *domain.ArrConfig, logge
9191
logger.Debug().Msgf("found %d movies to process", len(movies))
9292

9393
titleSet := make(map[string]struct{})
94-
var monitoredTitles int
94+
var processedTitles int
9595

9696
for _, movie := range movies {
9797
m := movie
9898

99-
// only want monitored
100-
if !m.Monitored {
99+
if !s.shouldProcessItem(m.Monitored, cfg) {
101100
continue
102101
}
103102

@@ -116,8 +115,7 @@ func (s Service) processRadarr(ctx context.Context, cfg *domain.ArrConfig, logge
116115
}
117116
}
118117

119-
// increment monitored titles
120-
monitoredTitles++
118+
processedTitles++
121119

122120
// Taking the international title and the original title and appending them to the titles array.
123121
for _, title := range []string{m.Title, m.OriginalTitle} {
@@ -135,7 +133,7 @@ func (s Service) processRadarr(ctx context.Context, cfg *domain.ArrConfig, logge
135133
}
136134

137135
sort.Strings(uniqueTitles)
138-
logger.Debug().Msgf("from a total of %d movies we found %d monitored and created %d release titles", len(movies), monitoredTitles, len(uniqueTitles))
136+
logger.Debug().Msgf("from a total of %d movies we found %d titles and created %d release titles", len(movies), processedTitles, len(uniqueTitles))
139137

140138
return uniqueTitles, nil
141139
}

internal/processor/service.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import (
66
"net/http"
77
"time"
88

9-
"github.com/autobrr/omegabrr/internal/domain"
10-
"github.com/autobrr/omegabrr/pkg/autobrr"
11-
129
"github.com/pkg/errors"
1310
"github.com/rs/zerolog/log"
11+
12+
"github.com/autobrr/omegabrr/internal/domain"
13+
"github.com/autobrr/omegabrr/pkg/autobrr"
1414
)
1515

1616
type Service struct {
@@ -47,6 +47,14 @@ func (s Service) newAutobrrClient() *autobrr.Client {
4747
return a
4848
}
4949

50+
// shouldProcessItem determines if an item should be processed based on its monitored status and configuration
51+
func (s Service) shouldProcessItem(monitored bool, arrConfig *domain.ArrConfig) bool {
52+
if arrConfig.IncludeUnmonitored {
53+
return true
54+
}
55+
return monitored
56+
}
57+
5058
func (s Service) ProcessArrs(ctx context.Context, dryRun bool) []string {
5159
var processingErrors []string
5260

@@ -91,7 +99,6 @@ func (s Service) ProcessArrs(ctx context.Context, dryRun bool) []string {
9199
}
92100

93101
return processingErrors
94-
95102
}
96103

97104
func (s Service) ProcessLists(ctx context.Context, dryRun bool) []string {
@@ -133,13 +140,11 @@ func (s Service) ProcessLists(ctx context.Context, dryRun bool) []string {
133140
log.Error().Err(err).Str("type", "steam").Str("client", listsClient.Name).Msg("error while processing Steam wishlist, continuing with other lists")
134141
processingErrors = append(processingErrors, fmt.Sprintf("Steam - %s: %v", listsClient.Name, err))
135142
}
136-
137143
}
138144
}
139145
}
140146

141147
return processingErrors
142-
143148
}
144149

145150
func (s Service) GetFilters(ctx context.Context) ([]autobrr.Filter, error) {

internal/processor/service_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package processor
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
8+
"github.com/autobrr/omegabrr/internal/domain"
9+
)
10+
11+
func TestService_shouldProcessItem(t *testing.T) {
12+
s := &Service{}
13+
cfg := &domain.ArrConfig{
14+
IncludeUnmonitored: true,
15+
}
16+
assert.True(t, s.shouldProcessItem(false, cfg), "unmonitored items should be processed when includeUnmonitored is true")
17+
}

0 commit comments

Comments
 (0)