1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +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, movieFile,
title, title,
titleSlug, titleSlug,
isAvailable,
inCinemas, inCinemas,
monitored, monitored,
hasFile, hasFile,
@ -55,7 +56,7 @@ class AgendaEvent extends Component {
const startTime = moment(inCinemas); const startTime = moment(inCinemas);
const downloading = !!(queueItem || grabbed); const downloading = !!(queueItem || grabbed);
const isMonitored = monitored; const isMonitored = monitored;
const statusStyle = getStatusStyle(hasFile, downloading, startTime, isMonitored); const statusStyle = getStatusStyle(hasFile, downloading, isAvailable, isMonitored);
return ( return (
<div> <div>
@ -126,7 +127,8 @@ AgendaEvent.propTypes = {
movieFile: PropTypes.object, movieFile: PropTypes.object,
title: PropTypes.string.isRequired, title: PropTypes.string.isRequired,
titleSlug: PropTypes.string.isRequired, titleSlug: PropTypes.string.isRequired,
inCinemas: PropTypes.string.isRequired, isAvailable: PropTypes.bool.isRequired,
inCinemas: PropTypes.string,
monitored: PropTypes.bool.isRequired, monitored: PropTypes.bool.isRequired,
hasFile: PropTypes.bool.isRequired, hasFile: PropTypes.bool.isRequired,
grabbed: PropTypes.bool, grabbed: PropTypes.bool,

View File

@ -22,7 +22,9 @@ function createCalendarEventsConnector() {
(state) => state.calendar.items, (state) => state.calendar.items,
(date, items) => { (date, items) => {
const filtered = _.filter(items, (item) => { 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); return sort(filtered);

View File

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

View File

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

View File

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