mirror of
https://github.com/Radarr/Radarr
synced 2026-05-09 11:10:23 +02:00
Add retroactive tag application to import lists
This commit introduces a new feature allowing tags to be retroactively applied to movies already in the database. Changes include database migration for the new column, updates to the frontend to manage this feature, and backend logic to handle retroactive tagging.
This commit is contained in:
parent
fa190c85a3
commit
b1f128fee8
9 changed files with 68 additions and 3 deletions
|
|
@ -55,6 +55,7 @@ function EditImportListModalContent(props) {
|
|||
rootFolderPath,
|
||||
searchOnAdd,
|
||||
tags,
|
||||
retroApplyTags,
|
||||
fields,
|
||||
message
|
||||
} = item;
|
||||
|
|
@ -225,6 +226,18 @@ function EditImportListModalContent(props) {
|
|||
/>
|
||||
</FormGroup>
|
||||
|
||||
<FormGroup>
|
||||
<FormLabel>{translate('RadarrRetroactiveApply')}</FormLabel>
|
||||
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="retroApplyTags"
|
||||
helpText={translate('RetroApplyListTagsHelpText')}
|
||||
{...retroApplyTags}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
{
|
||||
fields.map((field) => {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -82,6 +82,12 @@ const COLUMNS = [
|
|||
isSortable: true,
|
||||
isVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'retroApplyTags',
|
||||
label: () => translate('RetroApplyTags'),
|
||||
isSortable: true,
|
||||
isVisible: true,
|
||||
},
|
||||
];
|
||||
|
||||
interface ManageImportListsModalContentProps {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ interface ManageImportListsModalRowProps {
|
|||
minimumAvailability: string;
|
||||
implementation: string;
|
||||
tags: number[];
|
||||
retroApplyTags: boolean;
|
||||
enabled: boolean;
|
||||
enableAuto: boolean;
|
||||
columns: Column[];
|
||||
|
|
@ -38,6 +39,7 @@ function ManageImportListsModalRow(props: ManageImportListsModalRowProps) {
|
|||
enabled,
|
||||
enableAuto,
|
||||
tags,
|
||||
retroApplyTags,
|
||||
onSelectedChange,
|
||||
} = props;
|
||||
|
||||
|
|
@ -91,6 +93,10 @@ function ManageImportListsModalRow(props: ManageImportListsModalRowProps) {
|
|||
<TableRowCell className={styles.tags}>
|
||||
<TagListConnector tags={tags} />
|
||||
</TableRowCell>
|
||||
|
||||
<TableRowCell className={styles.enabled}>
|
||||
{retroApplyTags ? translate('Yes') : translate('No')}
|
||||
</TableRowCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@
|
|||
<PropertyGroup Condition="'$(IsOSX)' == 'true' and
|
||||
'$(RuntimeIdentifier)' == ''">
|
||||
<_UsingDefaultRuntimeIdentifier>true</_UsingDefaultRuntimeIdentifier>
|
||||
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||
<RuntimeIdentifier>osx-$(Architecture)</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration;
|
||||
|
||||
[Migration(241)]
|
||||
public class add_retroapply_to_importlists : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("ImportLists").AddColumn("RetroApplyTags").AsInt32().WithDefaultValue(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -81,9 +81,10 @@ private void ProcessMovieReport(ImportListDefinition importList, ImportListMovie
|
|||
return;
|
||||
}
|
||||
|
||||
// Check to see if movie in DB
|
||||
// Check to see if movie in DB and maybe apply retro-tags
|
||||
if (dbMovies.Contains(report.TmdbId))
|
||||
{
|
||||
RetroApplyTags(importList, report);
|
||||
_logger.Debug("{0} [{1}] Rejected, Movie Exists in DB", report.TmdbId, report.Title);
|
||||
return;
|
||||
}
|
||||
|
|
@ -123,6 +124,26 @@ private void ProcessMovieReport(ImportListDefinition importList, ImportListMovie
|
|||
}
|
||||
}
|
||||
|
||||
private void RetroApplyTags(ImportListDefinition importList, ImportListMovie report)
|
||||
{
|
||||
if (importList.RetroApplyTags)
|
||||
{
|
||||
var movie = _movieService.FindByTmdbId(report.TmdbId);
|
||||
|
||||
var preCount = movie.Tags.Count;
|
||||
foreach (var tag in importList.Tags)
|
||||
{
|
||||
movie.Tags.Add(tag);
|
||||
}
|
||||
|
||||
if (preCount != movie.Tags.Count)
|
||||
{
|
||||
_movieService.UpdateMovie(movie);
|
||||
_logger.Debug("{0} [{1}] Retro-Actively added tags to movie", report.TmdbId, report.Title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessListItems(ImportListFetchResult listFetchResult)
|
||||
{
|
||||
listFetchResult.Movies = listFetchResult.Movies.DistinctBy(x =>
|
||||
|
|
|
|||
|
|
@ -841,6 +841,7 @@
|
|||
"ListSyncLevelHelpText": "Movies in library will be handled based on your selection if they fall off or do not appear on your list(s)",
|
||||
"ListSyncLevelHelpTextWarning": "Movie files will be permanently deleted, this can result in wiping your library if your lists are empty",
|
||||
"ListTagsHelpText": "Tags list items will be added with",
|
||||
"RetroApplyListTagsHelpText": "Retro-Actively apply tags to movies already in Radarr",
|
||||
"ListWillRefreshEveryInterval": "List will refresh every {refreshInterval}",
|
||||
"Lists": "Lists",
|
||||
"Loading": "Loading",
|
||||
|
|
@ -1366,6 +1367,7 @@
|
|||
"Queued": "Queued",
|
||||
"QuickImport": "Move Automatically",
|
||||
"RadarrTags": "{appName} Tags",
|
||||
"RadarrRetroactiveApply": "Retro-Apply Tags",
|
||||
"Rating": "Rating",
|
||||
"Ratings": "Ratings",
|
||||
"ReadTheWikiForMoreInformation": "Read the Wiki for more information",
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ protected ProviderDefinition()
|
|||
public ProviderMessage Message { get; set; }
|
||||
|
||||
public HashSet<int> Tags { get; set; }
|
||||
public bool RetroApplyTags { get; set; }
|
||||
|
||||
[MemberwiseEqualityIgnore]
|
||||
public IProviderConfig Settings
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ public class ProviderResource<T> : RestResource
|
|||
public string InfoLink { get; set; }
|
||||
public ProviderMessage Message { get; set; }
|
||||
public HashSet<int> Tags { get; set; }
|
||||
public bool RetroApplyTags { get; set; }
|
||||
|
||||
public List<T> Presets { get; set; }
|
||||
}
|
||||
|
|
@ -36,6 +37,7 @@ public virtual TProviderResource ToResource(TProviderDefinition definition)
|
|||
ConfigContract = definition.ConfigContract,
|
||||
Message = definition.Message,
|
||||
Tags = definition.Tags,
|
||||
RetroApplyTags = definition.RetroApplyTags,
|
||||
Fields = SchemaBuilder.ToSchema(definition.Settings),
|
||||
|
||||
// radarr/supported is an disambiguation page. the # should be a header on the page with appropriate details/link
|
||||
|
|
@ -60,7 +62,8 @@ public virtual TProviderDefinition ToModel(TProviderResource resource, TProvider
|
|||
Implementation = resource.Implementation,
|
||||
ConfigContract = resource.ConfigContract,
|
||||
Message = resource.Message,
|
||||
Tags = resource.Tags
|
||||
Tags = resource.Tags,
|
||||
RetroApplyTags = resource.RetroApplyTags,
|
||||
};
|
||||
|
||||
var configContract = ReflectionExtensions.CoreAssembly.FindTypeByName(definition.ConfigContract);
|
||||
|
|
|
|||
Loading…
Reference in a new issue