1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-03-05 13:21:25 -05:00

New: Keywords custom filter and autotagging for movies

This commit is contained in:
Bogdan
2025-05-23 21:29:31 +03:00
parent 4d3d46d796
commit cb59ce891a
16 changed files with 115 additions and 6 deletions

View File

@@ -43,7 +43,8 @@
.physicalRelease,
.digitalRelease,
.releaseDate,
.genres {
.genres,
.keywords {
composes: cell;
flex: 0 0 180px;

View File

@@ -12,6 +12,7 @@ interface CssExports {
'genres': string;
'imdbRating': string;
'inCinemas': string;
'keywords': string;
'minimumAvailability': string;
'movieStatus': string;
'originalLanguage': string;

View File

@@ -72,6 +72,7 @@ function MovieIndexRow(props: MovieIndexRowProps) {
minimumAvailability,
path,
genres = [],
keywords = [],
ratings,
popularity,
certification,
@@ -339,6 +340,20 @@ function MovieIndexRow(props: MovieIndexRowProps) {
);
}
if (name === 'keywords') {
const joinedKeywords = keywords.join(', ');
const truncatedKeywords =
keywords.length > 3
? `${keywords.slice(0, 3).join(', ')}...`
: joinedKeywords;
return (
<VirtualTableRowCell key={name} className={styles[name]}>
<span title={joinedKeywords}>{truncatedKeywords}</span>
</VirtualTableRowCell>
);
}
if (name === 'movieStatus') {
return (
<VirtualTableRowCell key={name} className={styles[name]}>

View File

@@ -36,7 +36,8 @@
.physicalRelease,
.digitalRelease,
.releaseDate,
.genres {
.genres,
.keywords {
composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css';
flex: 0 0 180px;

View File

@@ -9,6 +9,7 @@ interface CssExports {
'genres': string;
'imdbRating': string;
'inCinemas': string;
'keywords': string;
'minimumAvailability': string;
'movieStatus': string;
'originalLanguage': string;

View File

@@ -82,6 +82,7 @@ interface Movie extends ModelBase {
minimumAvailability: MovieAvailability;
path: string;
genres: string[];
keywords: string[];
ratings: Ratings;
popularity: number;
certification: string;

View File

@@ -181,6 +181,12 @@ export const defaultState = {
isSortable: false,
isVisible: false
},
{
name: 'keywords',
label: () => translate('Keywords'),
isSortable: false,
isVisible: false
},
{
name: 'movieStatus',
label: () => translate('Status'),
@@ -473,8 +479,8 @@ export const defaultState = {
label: () => translate('Genres'),
type: filterBuilderTypes.ARRAY,
optionsSelector: function(items) {
const genreList = items.reduce((acc, movie) => {
movie.genres.forEach((genre) => {
const genreList = items.reduce((acc, { genres = [] }) => {
genres.forEach((genre) => {
acc.push({
id: genre,
name: genre
@@ -487,6 +493,27 @@ export const defaultState = {
return genreList.sort(sortByProp('name'));
}
},
{
name: 'keywords',
label: () => translate('Keywords'),
type: filterBuilderTypes.ARRAY,
optionsSelector: function(items) {
const keywordList = items.reduce((acc, { keywords = [] }) => {
keywords.forEach((keyword) => {
if (acc.findIndex((a) => a.id === keyword) === -1) {
acc.push({
id: keyword,
name: keyword
});
}
});
return acc;
}, []);
return keywordList.sort(sortByProp('name'));
}
},
{
name: 'tmdbRating',
label: () => translate('TmdbRating'),