1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

New: Digital Releases on Calendar, Misc Other Calendar Fixes

Fixes #4582
This commit is contained in:
Qstick 2020-07-11 00:35:02 -04:00
parent 0b7067cf9c
commit 1dbb664ef6
5 changed files with 38 additions and 14 deletions

View File

@ -41,6 +41,7 @@ class AgendaEvent extends Component {
movieFile,
title,
titleSlug,
isAvailable,
inCinemas,
monitored,
hasFile,
@ -55,7 +56,7 @@ class AgendaEvent extends Component {
const startTime = moment(inCinemas);
const downloading = !!(queueItem || grabbed);
const isMonitored = monitored;
const statusStyle = getStatusStyle(hasFile, downloading, startTime, isMonitored);
const statusStyle = getStatusStyle(hasFile, downloading, isAvailable, isMonitored);
return (
<div>
@ -126,7 +127,8 @@ AgendaEvent.propTypes = {
movieFile: PropTypes.object,
title: PropTypes.string.isRequired,
titleSlug: PropTypes.string.isRequired,
inCinemas: PropTypes.string.isRequired,
isAvailable: PropTypes.bool.isRequired,
inCinemas: PropTypes.string,
monitored: PropTypes.bool.isRequired,
hasFile: PropTypes.bool.isRequired,
grabbed: PropTypes.bool,

View File

@ -22,7 +22,9 @@ function createCalendarEventsConnector() {
(state) => state.calendar.items,
(date, items) => {
const filtered = _.filter(items, (item) => {
return moment(date).isSame(moment(item.inCinemas), 'day') || moment(date).isSame(moment(item.physicalRelease), 'day');
return (item.inCinemas && moment(date).isSame(moment(item.inCinemas), 'day')) ||
(item.physicalRelease && moment(date).isSame(moment(item.physicalRelease), 'day')) ||
(item.digitalRelease && moment(date).isSame(moment(item.digitalRelease), 'day'));
});
return sort(filtered);

View File

@ -17,11 +17,15 @@ class CalendarEvent extends Component {
render() {
const {
movieFile,
isAvailable,
inCinemas,
physicalRelease,
digitalRelease,
title,
titleSlug,
genres,
monitored,
certification,
hasFile,
grabbed,
queueItem,
@ -31,13 +35,24 @@ class CalendarEvent extends Component {
date
} = this.props;
const startTime = moment(inCinemas);
const isDownloading = !!(queueItem || grabbed);
const isMonitored = monitored;
const statusStyle = getStatusStyle(hasFile, isDownloading, startTime, isMonitored);
const statusStyle = getStatusStyle(hasFile, isDownloading, isAvailable, isMonitored);
const joinedGenres = genres.slice(0, 2).join(', ');
const link = `/movie/${titleSlug}`;
const eventType = moment(date).isSame(moment(inCinemas), 'day') ? 'In Cinemas' : 'Physical Release';
const eventType = [];
if (moment(date).isSame(moment(inCinemas), 'day')) {
eventType.push('Cinemas');
}
if (moment(date).isSame(moment(physicalRelease), 'day')) {
eventType.push('Physical');
}
if (moment(date).isSame(moment(digitalRelease), 'day')) {
eventType.push('Digital');
}
return (
<div>
@ -100,7 +115,10 @@ class CalendarEvent extends Component {
showMovieInformation &&
<div className={styles.movieInfo}>
<div className={styles.genres}>
{eventType}
{eventType.join(', ')}
</div>
<div>
{certification}
</div>
</div>
}
@ -117,8 +135,12 @@ CalendarEvent.propTypes = {
movieFile: PropTypes.object,
title: PropTypes.string.isRequired,
titleSlug: PropTypes.string.isRequired,
inCinemas: PropTypes.string.isRequired,
isAvailable: PropTypes.bool.isRequired,
inCinemas: PropTypes.string,
physicalRelease: PropTypes.string,
digitalRelease: PropTypes.string,
monitored: PropTypes.bool.isRequired,
certification: PropTypes.string,
hasFile: PropTypes.bool.isRequired,
grabbed: PropTypes.bool,
queueItem: PropTypes.object,

View File

@ -1,8 +1,5 @@
/* eslint max-params: 0 */
import moment from 'moment';
function getStatusStyle(hasFile, downloading, startTime, isMonitored) {
const currentTime = moment();
function getStatusStyle(hasFile, downloading, isAvailable, isMonitored) {
if (hasFile) {
return 'downloaded';
@ -16,7 +13,7 @@ function getStatusStyle(hasFile, downloading, startTime, isMonitored) {
return 'unmonitored';
}
if (startTime.isBefore(currentTime) && !hasFile) {
if (isAvailable && !hasFile) {
return 'missing';
}

View File

@ -147,7 +147,8 @@ public List<Movie> MoviesBetweenDates(DateTime start, DateTime end, bool include
var builder = Builder()
.Where<Movie>(m =>
(m.InCinemas >= start && m.InCinemas <= end) ||
(m.PhysicalRelease >= start && m.PhysicalRelease <= end));
(m.PhysicalRelease >= start && m.PhysicalRelease <= end) ||
(m.DigitalRelease >= start && m.DigitalRelease <= end));
if (!includeUnmonitored)
{