Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow skipping existing items #20

Merged
merged 3 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 57 additions & 21 deletions config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
"description": "Include a separate configuration file into the current one.",
"additionalProperties": false,
"anyOf": [
{"required": [ "config" ]}
{
"required": [
"config"
]
}
],
"properties": {
"config": {
Expand Down Expand Up @@ -68,11 +72,17 @@
"$ref": "#/$defs/service_filter_collection"
},
"root_folder": {
"type": ["string", "null"],
"type": [
"string",
"null"
],
"description": "Defines the path of the root folder to store items in. If not set, uses the first root folder from the instance."
},
"quality_profile": {
"type": ["string", "null"],
"type": [
"string",
"null"
],
"description": "Defines the name of the quality profile to add items as. If not set, uses the first quality profile from the instance."
},
"monitored": {
Expand All @@ -90,6 +100,11 @@
"default": false,
"description": "Whether to allow in-production series to be added to the instance.\nWhen in-production, genres and certifications are still not finalized; meaning filters likely won't work."
},
"update_existing": {
"type": "boolean",
"default": true,
"description": "Whether existing items in the service should be updated or left as-is."
},
"service_filter": {
"type": "array",
"uniqueItems": true,
Expand Down Expand Up @@ -133,19 +148,18 @@
},
"examples": [
/* TV Parental Guidelines (US) */
"TV-Y", // All children, including ages from 2-6
"TV-Y7", // Directed at children age 7 and above.
"TV-G", // General audience
"TV-PG", // Parental guidance suggested
"TV-14", // Parents strongly cautioned; may be unsuitable for children under the age of 14
"TV-MA", // Mature audience only

"TV-Y", // All children, including ages from 2-6
"TV-Y7", // Directed at children age 7 and above.
"TV-G", // General audience
"TV-PG", // Parental guidance suggested
"TV-14", // Parents strongly cautioned; may be unsuitable for children under the age of 14
"TV-MA", // Mature audience only
/* MPA film rating systems (US) */
"G", // General audience; all ages admitted.
"PG", // Parental guidance suggested; some material may not be suitable for children.
"PG-13", // Parents strongly cautioned; some material may be inappropriate for children under 13.
"R", // Restricted; under 17 requires accompanying parent or adult guardian.
"NC-17" // Adults only; no one 17 and under admitted.
"G", // General audience; all ages admitted.
"PG", // Parental guidance suggested; some material may not be suitable for children.
"PG-13", // Parents strongly cautioned; some material may be inappropriate for children under 13.
"R", // Restricted; under 17 requires accompanying parent or adult guardian.
"NC-17" // Adults only; no one 17 and under admitted.
]
},
"service_filter_collection": {
Expand All @@ -164,7 +178,9 @@
"plex": {
"type": "object",
"additionalProperties": false,
"required": ["api_token"],
"required": [
"api_token"
],
"properties": {
"api_token": {
"type": "string",
Expand Down Expand Up @@ -212,7 +228,11 @@
"$ref": "#/$defs/allow_in_production"
},
"series_type": {
"enum": ["Standard", "Daily", "Anime"],
"enum": [
"Standard",
"Daily",
"Anime"
],
"description": "Defines what type to assign to newly-added series."
},
"season_folder": {
Expand All @@ -226,14 +246,21 @@
"description": "Defines whether to monitor new items, as they are released."
},
"monitored_items": {
"enum": ["None", "All", "FirstSeason", "OnlyShortSeries"],
"enum": [
"None",
"All",
"FirstSeason",
"OnlyShortSeries"
],
"default": "FirstSeason",
"description": "Defines which seasons should be monitored for newly-added series."
}
},
"if": {
"properties": {
"monitored_items": { "const": "OnlyShortSeries" }
"monitored_items": {
"const": "OnlyShortSeries"
}
}
},
"then": {
Expand Down Expand Up @@ -281,12 +308,21 @@
"$ref": "#/$defs/allow_in_production"
},
"minimum_availability": {
"enum": ["TBA", "Announced", "InCinemas", "Released"],
"enum": [
"TBA",
"Announced",
"InCinemas",
"Released"
],
"default": "Released",
"description": "Sets the minimum availability before the instance should attempt fetching the movie."
},
"monitored_items": {
"enum": ["None", "MovieOnly", "MovieAndCollection"],
"enum": [
"None",
"MovieOnly",
"MovieAndCollection"
],
"default": "MovieOnly",
"description": "Defines which items should be monitored for newly-added movies."
}
Expand Down
5 changes: 5 additions & 0 deletions docs/docs/configuration/basic-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ Whether to force the instance to search for newly added content, right after it'
Whether to allow in-production content, such as content which has only been announced.
When content is in production, genres and certifications have often not been finalized, which will render instance filters useless.

### `update_existing`
**Optional.** Default: `true`

Whether existing items in the service should be updated or left as-is. By default, if an item from a watchlist already exists on the service, it will be updated. This can become annoying if you frequently update monitoring, profile or other settings for an item in the service UI, as Fetcharr will override it on next sync. To opt out of this behaviour, set this value to `false`.

## Sonarr

This section will only cover instance options that are unique to Sonarr. All the configuration options in [Services](#service) are still allowed.
Expand Down
10 changes: 10 additions & 0 deletions fetcharr.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ sonarr:
## Default: false
# allow_in_production: true

## Whether to update existing items in Sonarr or leave them as-is.
## This can help prevent unwanted overwriting to series monitoring, quality profile, etc., which have been altered in Sonarr.
## Default: true
# update_existing: false

## Sets the series type on newly-added items.
## Available values: [Standard, Daily, Anime]
## Default: Standard
Expand Down Expand Up @@ -137,6 +142,11 @@ radarr:
## Default: false
# allow_in_production: true

## Whether to update existing items in Radarr or leave them as-is.
## This can help prevent unwanted overwriting to movies monitoring, quality profile, etc., which have been altered in Radarr.
## Default: true
# update_existing: false

## Sets the minimum availability before the instance should attempt fetching the movie.
## Available values: [TBA, Announced, InCinemas, Released]
## Default: Released
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,11 @@ public abstract class FetcharrServiceConfiguration
/// </summary>
[YamlMember(Alias = "allow_in_production")]
public bool AllowInProduction { get; set; } = false;

/// <summary>
/// Gets or sets whether existing items in the service should be updated or left as-is.
/// </summary>
[YamlMember(Alias = "update_existing")]
public bool UpdateExisting { get; set; } = true;
}
}
2 changes: 1 addition & 1 deletion src/Provider.Radarr/src/RadarrClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ await this._client
};

// If the movie already exists, just update it.
if(movie.Id is not null)
if(movie.Id is not null && configuration.UpdateExisting)
{
IFlurlResponse newMovieResponse = await this._client
.Request($"/api/v3/movie/{movie.Id}")
Expand Down
2 changes: 1 addition & 1 deletion src/Provider.Sonarr/src/SonarrClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ await this._client
};

// If the series already exists, just update it.
if(series.Id is not null)
if(series.Id is not null && configuration.UpdateExisting)
{
IFlurlResponse newSeriesResponse = await this._client
.Request($"/api/v3/series/{series.Id}")
Expand Down