mirror of
https://github.com/Radarr/Radarr.git
synced 2024-06-28 00:44:48 +02:00
Compare commits
3 Commits
498b1e1050
...
d1b4e994e0
Author | SHA1 | Date | |
---|---|---|---|
|
d1b4e994e0 | ||
|
f228841dc7 | ||
|
e89de12a48 |
|
@ -40,6 +40,24 @@ export const defaultState = {
|
|||
isSortable: true,
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'movieMetadata.inCinemas',
|
||||
label: () => translate('InCinemas'),
|
||||
isSortable: true,
|
||||
isVisible: false
|
||||
},
|
||||
{
|
||||
name: 'movieMetadata.digitalRelease',
|
||||
label: () => translate('DigitalRelease'),
|
||||
isSortable: true,
|
||||
isVisible: false
|
||||
},
|
||||
{
|
||||
name: 'movieMetadata.physicalRelease',
|
||||
label: () => translate('PhysicalRelease'),
|
||||
isSortable: true,
|
||||
isVisible: false
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
label: () => translate('Status'),
|
||||
|
@ -102,6 +120,24 @@ export const defaultState = {
|
|||
isSortable: true,
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
name: 'movieMetadata.inCinemas',
|
||||
label: () => translate('InCinemas'),
|
||||
isSortable: true,
|
||||
isVisible: false
|
||||
},
|
||||
{
|
||||
name: 'movieMetadata.digitalRelease',
|
||||
label: () => translate('DigitalRelease'),
|
||||
isSortable: true,
|
||||
isVisible: false
|
||||
},
|
||||
{
|
||||
name: 'movieMetadata.physicalRelease',
|
||||
label: () => translate('PhysicalRelease'),
|
||||
isSortable: true,
|
||||
isVisible: false
|
||||
},
|
||||
{
|
||||
name: 'languages',
|
||||
label: () => translate('Languages'),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
||||
import TableRow from 'Components/Table/TableRow';
|
||||
|
@ -17,6 +18,9 @@ function CutoffUnmetRow(props) {
|
|||
year,
|
||||
title,
|
||||
titleSlug,
|
||||
inCinemas,
|
||||
digitalRelease,
|
||||
physicalRelease,
|
||||
isSelected,
|
||||
columns,
|
||||
onSelectedChange
|
||||
|
@ -60,6 +64,36 @@ function CutoffUnmetRow(props) {
|
|||
);
|
||||
}
|
||||
|
||||
if (name === 'movieMetadata.inCinemas') {
|
||||
return (
|
||||
<RelativeDateCellConnector
|
||||
key={name}
|
||||
className={styles[name]}
|
||||
date={inCinemas}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'movieMetadata.digitalRelease') {
|
||||
return (
|
||||
<RelativeDateCellConnector
|
||||
key={name}
|
||||
className={styles[name]}
|
||||
date={digitalRelease}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'movieMetadata.physicalRelease') {
|
||||
return (
|
||||
<RelativeDateCellConnector
|
||||
key={name}
|
||||
className={styles[name]}
|
||||
date={physicalRelease}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'languages') {
|
||||
return (
|
||||
<TableRowCell
|
||||
|
@ -112,6 +146,9 @@ CutoffUnmetRow.propTypes = {
|
|||
title: PropTypes.string.isRequired,
|
||||
year: PropTypes.number.isRequired,
|
||||
titleSlug: PropTypes.string.isRequired,
|
||||
inCinemas: PropTypes.string,
|
||||
digitalRelease: PropTypes.string,
|
||||
physicalRelease: PropTypes.string,
|
||||
isSelected: PropTypes.bool,
|
||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
onSelectedChange: PropTypes.func.isRequired
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
||||
import TableRow from 'Components/Table/TableRow';
|
||||
|
@ -16,6 +17,9 @@ function MissingRow(props) {
|
|||
year,
|
||||
title,
|
||||
titleSlug,
|
||||
inCinemas,
|
||||
digitalRelease,
|
||||
physicalRelease,
|
||||
isSelected,
|
||||
columns,
|
||||
onSelectedChange
|
||||
|
@ -63,6 +67,36 @@ function MissingRow(props) {
|
|||
);
|
||||
}
|
||||
|
||||
if (name === 'movieMetadata.inCinemas') {
|
||||
return (
|
||||
<RelativeDateCellConnector
|
||||
key={name}
|
||||
className={styles[name]}
|
||||
date={inCinemas}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'movieMetadata.digitalRelease') {
|
||||
return (
|
||||
<RelativeDateCellConnector
|
||||
key={name}
|
||||
className={styles[name]}
|
||||
date={digitalRelease}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'movieMetadata.physicalRelease') {
|
||||
return (
|
||||
<RelativeDateCellConnector
|
||||
key={name}
|
||||
className={styles[name]}
|
||||
date={physicalRelease}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'status') {
|
||||
return (
|
||||
<TableRowCell
|
||||
|
@ -102,6 +136,9 @@ MissingRow.propTypes = {
|
|||
title: PropTypes.string.isRequired,
|
||||
year: PropTypes.number.isRequired,
|
||||
titleSlug: PropTypes.string.isRequired,
|
||||
inCinemas: PropTypes.string,
|
||||
digitalRelease: PropTypes.string,
|
||||
physicalRelease: PropTypes.string,
|
||||
isSelected: PropTypes.bool,
|
||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
onSelectedChange: PropTypes.func.isRequired
|
||||
|
|
|
@ -63,5 +63,71 @@ public void should_conditional_hide_edition_tags_in_plex_format(string movieForm
|
|||
Subject.BuildFileName(_movie, _movieFile)
|
||||
.Should().Be("South Park");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase("10th anniversary edition", "{Movie Title} [{edition tags}]", "South Park [10th anniversary edition]")]
|
||||
[TestCase("10TH anniversary edition", "{Movie Title} [{edition tags}]", "South Park [10th anniversary edition]")]
|
||||
[TestCase("10Th anniversary edition", "{Movie Title} [{edition tags}]", "South Park [10th anniversary edition]")]
|
||||
[TestCase("10th anniversary edition", "{Movie Title} [{Edition Tags}]", "South Park [10th Anniversary Edition]")]
|
||||
[TestCase("10TH anniversary edition", "{Movie Title} [{Edition Tags}]", "South Park [10th Anniversary Edition]")]
|
||||
[TestCase("10Th anniversary edition", "{Movie Title} [{Edition Tags}]", "South Park [10th Anniversary Edition]")]
|
||||
[TestCase("10th anniversary edition", "{Movie Title} [{EDITION TAGS}]", "South Park [10TH ANNIVERSARY EDITION]")]
|
||||
[TestCase("10TH anniversary edition", "{Movie Title} [{EDITION TAGS}]", "South Park [10TH ANNIVERSARY EDITION]")]
|
||||
[TestCase("10Th anniversary edition", "{Movie Title} [{EDITION TAGS}]", "South Park [10TH ANNIVERSARY EDITION]")]
|
||||
public void should_always_lowercase_ordinals(string edition, string movieFormat, string expected)
|
||||
{
|
||||
_movieFile.Edition = edition;
|
||||
_namingConfig.StandardMovieFormat = movieFormat;
|
||||
|
||||
Subject.BuildFileName(_movie, _movieFile)
|
||||
.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase("imax", "{Movie Title} [{edition tags}]", "South Park [imax]")]
|
||||
[TestCase("IMAX", "{Movie Title} [{edition tags}]", "South Park [imax]")]
|
||||
[TestCase("Imax", "{Movie Title} [{edition tags}]", "South Park [imax]")]
|
||||
[TestCase("imax", "{Movie Title} [{Edition Tags}]", "South Park [IMAX]")]
|
||||
[TestCase("IMAX", "{Movie Title} [{Edition Tags}]", "South Park [IMAX]")]
|
||||
[TestCase("Imax", "{Movie Title} [{Edition Tags}]", "South Park [IMAX]")]
|
||||
[TestCase("imax", "{Movie Title} [{EDITION TAGS}]", "South Park [IMAX]")]
|
||||
[TestCase("IMAX", "{Movie Title} [{EDITION TAGS}]", "South Park [IMAX]")]
|
||||
[TestCase("Imax", "{Movie Title} [{EDITION TAGS}]", "South Park [IMAX]")]
|
||||
|
||||
[TestCase("3d", "{Movie Title} [{edition tags}]", "South Park [3d]")]
|
||||
[TestCase("3D", "{Movie Title} [{edition tags}]", "South Park [3d]")]
|
||||
[TestCase("3d", "{Movie Title} [{Edition Tags}]", "South Park [3D]")]
|
||||
[TestCase("3D", "{Movie Title} [{Edition Tags}]", "South Park [3D]")]
|
||||
[TestCase("3d", "{Movie Title} [{EDITION TAGS}]", "South Park [3D]")]
|
||||
[TestCase("3D", "{Movie Title} [{EDITION TAGS}]", "South Park [3D]")]
|
||||
|
||||
[TestCase("hdr", "{Movie Title} [{edition tags}]", "South Park [hdr]")]
|
||||
[TestCase("HDR", "{Movie Title} [{edition tags}]", "South Park [hdr]")]
|
||||
[TestCase("Hdr", "{Movie Title} [{edition tags}]", "South Park [hdr]")]
|
||||
[TestCase("hdr", "{Movie Title} [{Edition Tags}]", "South Park [HDR]")]
|
||||
[TestCase("HDR", "{Movie Title} [{Edition Tags}]", "South Park [HDR]")]
|
||||
[TestCase("Hdr", "{Movie Title} [{Edition Tags}]", "South Park [HDR]")]
|
||||
[TestCase("hdr", "{Movie Title} [{EDITION TAGS}]", "South Park [HDR]")]
|
||||
[TestCase("HDR", "{Movie Title} [{EDITION TAGS}]", "South Park [HDR]")]
|
||||
[TestCase("Hdr", "{Movie Title} [{EDITION TAGS}]", "South Park [HDR]")]
|
||||
|
||||
[TestCase("sdr", "{Movie Title} [{edition tags}]", "South Park [sdr]")]
|
||||
[TestCase("SDR", "{Movie Title} [{edition tags}]", "South Park [sdr]")]
|
||||
[TestCase("Sdr", "{Movie Title} [{edition tags}]", "South Park [sdr]")]
|
||||
[TestCase("sdr", "{Movie Title} [{Edition Tags}]", "South Park [SDR]")]
|
||||
[TestCase("SDR", "{Movie Title} [{Edition Tags}]", "South Park [SDR]")]
|
||||
[TestCase("Sdr", "{Movie Title} [{Edition Tags}]", "South Park [SDR]")]
|
||||
[TestCase("sdr", "{Movie Title} [{EDITION TAGS}]", "South Park [SDR]")]
|
||||
[TestCase("SDR", "{Movie Title} [{EDITION TAGS}]", "South Park [SDR]")]
|
||||
[TestCase("Sdr", "{Movie Title} [{EDITION TAGS}]", "South Park [SDR]")]
|
||||
|
||||
public void should_always_uppercase_special_strings(string edition, string movieFormat, string expected)
|
||||
{
|
||||
_movieFile.Edition = edition;
|
||||
_namingConfig.StandardMovieFormat = movieFormat;
|
||||
|
||||
Subject.BuildFileName(_movie, _movieFile)
|
||||
.Should().Be(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,11 +298,27 @@ private string GetLanguageTitle(Movie movie, string isoCodes)
|
|||
return movie.Title;
|
||||
}
|
||||
|
||||
private string ToTitleCaseIgnoreOrdinals(string text)
|
||||
{
|
||||
return Regex.Replace(text, @"\b([0-9]{1,3}(?:st|th|rd|nd))\b", new MatchEvaluator((m) => m.Captures[0].Value.ToLower()), RegexOptions.IgnoreCase);
|
||||
}
|
||||
|
||||
private string ToTitleCaseAlwaysUpper(string text)
|
||||
{
|
||||
return Regex.Replace(text, @"\b(imax|3d|sdr|hdr)\b", new MatchEvaluator((m) => m.Captures[0].Value.ToUpper()), RegexOptions.IgnoreCase);
|
||||
}
|
||||
|
||||
private string ToEditionTitleCase(MovieFile movieFile)
|
||||
{
|
||||
var titleCase = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(movieFile.Edition.ToLower());
|
||||
return ToTitleCaseAlwaysUpper(ToTitleCaseIgnoreOrdinals(titleCase));
|
||||
}
|
||||
|
||||
private void AddEditionTagsTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, MovieFile movieFile)
|
||||
{
|
||||
if (movieFile.Edition.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
tokenHandlers["{Edition Tags}"] = m => Truncate(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(movieFile.Edition.ToLower()), m.CustomFormat);
|
||||
tokenHandlers["{Edition Tags}"] = m => Truncate(ToEditionTitleCase(movieFile), m.CustomFormat);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user