mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add more options for PrimaryMediaInfo
This commit is contained in:
parent
a3eff3c0ae
commit
fabfb9b173
12 changed files with 150 additions and 94 deletions
|
@ -78,12 +78,13 @@ const ListContent: FC<ListContentProps> = ({
|
||||||
{listOptions.showMediaInfo !== false && enableSideMediaInfo && (
|
{listOptions.showMediaInfo !== false && enableSideMediaInfo && (
|
||||||
<PrimaryMediaInfo
|
<PrimaryMediaInfo
|
||||||
className='secondary listItemMediaInfo'
|
className='secondary listItemMediaInfo'
|
||||||
|
infoclass='mediaInfoText'
|
||||||
item={item}
|
item={item}
|
||||||
showRuntimeInfo
|
showRuntimeInfo
|
||||||
|
showOfficialRatingInfo
|
||||||
|
showOriginalAirDateInfo
|
||||||
showStarRatingInfo
|
showStarRatingInfo
|
||||||
showCaptionIndicatorInfo
|
showCaptionIndicatorInfo
|
||||||
showEpisodeTitleInfo
|
|
||||||
showOfficialRatingInfo
|
|
||||||
getMissingIndicator={indicator.getMissingIndicator}
|
getMissingIndicator={indicator.getMissingIndicator}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -61,6 +61,7 @@ const ListItemBody: FC<ListItemBodyProps> = ({
|
||||||
{listOptions.showMediaInfo !== false && !enableSideMediaInfo && (
|
{listOptions.showMediaInfo !== false && !enableSideMediaInfo && (
|
||||||
<PrimaryMediaInfo
|
<PrimaryMediaInfo
|
||||||
className='secondary listItemMediaInfo listItemBodyText'
|
className='secondary listItemMediaInfo listItemBodyText'
|
||||||
|
infoclass='mediaInfoText'
|
||||||
item={item}
|
item={item}
|
||||||
showEpisodeTitleInfo
|
showEpisodeTitleInfo
|
||||||
showOriginalAirDateInfo
|
showOriginalAirDateInfo
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
.listItemMediaInfo {
|
.listItemMediaInfo {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
margin-right: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.listItem {
|
.listItem {
|
||||||
|
|
|
@ -10,14 +10,13 @@ interface CaptionMediaInfoProps {
|
||||||
const CaptionMediaInfo: FC<CaptionMediaInfoProps> = ({ className }) => {
|
const CaptionMediaInfo: FC<CaptionMediaInfoProps> = ({ className }) => {
|
||||||
const cssClass = classNames(
|
const cssClass = classNames(
|
||||||
'mediaInfoItem',
|
'mediaInfoItem',
|
||||||
'mediaInfoText',
|
|
||||||
'closedCaptionMediaInfoText',
|
'closedCaptionMediaInfoText',
|
||||||
className
|
className
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box className={cssClass}>
|
<Box className={cssClass}>
|
||||||
<ClosedCaptionIcon fontSize={'small'} />
|
<ClosedCaptionIcon />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,6 @@ interface EndsAtProps {
|
||||||
const EndsAt: FC<EndsAtProps> = ({ runTimeTicks, className }) => {
|
const EndsAt: FC<EndsAtProps> = ({ runTimeTicks, className }) => {
|
||||||
const cssClass = classNames(
|
const cssClass = classNames(
|
||||||
'mediaInfoItem',
|
'mediaInfoItem',
|
||||||
'mediaInfoText',
|
|
||||||
'endsAt',
|
'endsAt',
|
||||||
className
|
className
|
||||||
);
|
);
|
||||||
|
|
|
@ -12,7 +12,6 @@ interface MediaInfoItemProps {
|
||||||
const MediaInfoItem: FC<MediaInfoItemProps> = ({ className, miscInfo }) => {
|
const MediaInfoItem: FC<MediaInfoItemProps> = ({ className, miscInfo }) => {
|
||||||
const cssClass = classNames(
|
const cssClass = classNames(
|
||||||
'mediaInfoItem',
|
'mediaInfoItem',
|
||||||
'mediaInfoText',
|
|
||||||
className,
|
className,
|
||||||
miscInfo?.cssClass
|
miscInfo?.cssClass
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,26 +16,34 @@ import type { PrimaryInfoOpts } from './type';
|
||||||
|
|
||||||
interface PrimaryMediaInfoProps extends PrimaryInfoOpts {
|
interface PrimaryMediaInfoProps extends PrimaryInfoOpts {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
infoclass?: string;
|
||||||
item: ItemDto;
|
item: ItemDto;
|
||||||
showStarRatingInfo?: boolean;
|
showStarRatingInfo?: boolean;
|
||||||
showCaptionIndicatorInfo?: boolean;
|
showCaptionIndicatorInfo?: boolean;
|
||||||
showCriticRatingInfo?: boolean;
|
showCriticRatingInfo?: boolean;
|
||||||
showEndsAtInfo?: boolean;
|
showEndsAtInfo?: boolean;
|
||||||
showMissingIndicatorInfo?: boolean;
|
showMissingIndicatorInfo?: boolean;
|
||||||
getMissingIndicator?: () => React.JSX.Element | null
|
getMissingIndicator?: () => React.JSX.Element | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PrimaryMediaInfo: FC<PrimaryMediaInfoProps> = ({
|
const PrimaryMediaInfo: FC<PrimaryMediaInfoProps> = ({
|
||||||
className,
|
className,
|
||||||
|
infoclass,
|
||||||
item,
|
item,
|
||||||
showYearInfo,
|
showYearInfo,
|
||||||
showAudioContainerInfo,
|
showAudioContainerInfo,
|
||||||
showEpisodeTitleInfo,
|
showEpisodeTitleInfo,
|
||||||
showOriginalAirDateInfo,
|
showOriginalAirDateInfo,
|
||||||
|
showFolderRuntimeInfo,
|
||||||
showRuntimeInfo,
|
showRuntimeInfo,
|
||||||
|
showItemCountInfo,
|
||||||
|
showSeriesTimerInfo,
|
||||||
|
showStartDateInfo,
|
||||||
showProgramIndicatorInfo,
|
showProgramIndicatorInfo,
|
||||||
includeEpisodeTitleIndexNumber,
|
includeEpisodeTitleIndexNumber,
|
||||||
showOfficialRatingInfo,
|
showOfficialRatingInfo,
|
||||||
|
showVideo3DFormatInfo,
|
||||||
|
showPhotoSizeInfo,
|
||||||
showStarRatingInfo = false,
|
showStarRatingInfo = false,
|
||||||
showCaptionIndicatorInfo = false,
|
showCaptionIndicatorInfo = false,
|
||||||
showCriticRatingInfo = false,
|
showCriticRatingInfo = false,
|
||||||
|
@ -48,10 +56,16 @@ const PrimaryMediaInfo: FC<PrimaryMediaInfoProps> = ({
|
||||||
showAudioContainerInfo,
|
showAudioContainerInfo,
|
||||||
showEpisodeTitleInfo,
|
showEpisodeTitleInfo,
|
||||||
showOriginalAirDateInfo,
|
showOriginalAirDateInfo,
|
||||||
|
showFolderRuntimeInfo,
|
||||||
showRuntimeInfo,
|
showRuntimeInfo,
|
||||||
|
showItemCountInfo,
|
||||||
|
showSeriesTimerInfo,
|
||||||
|
showStartDateInfo,
|
||||||
showProgramIndicatorInfo,
|
showProgramIndicatorInfo,
|
||||||
includeEpisodeTitleIndexNumber,
|
includeEpisodeTitleIndexNumber,
|
||||||
showOfficialRatingInfo
|
showOfficialRatingInfo,
|
||||||
|
showVideo3DFormatInfo,
|
||||||
|
showPhotoSizeInfo
|
||||||
});
|
});
|
||||||
const {
|
const {
|
||||||
StartDate,
|
StartDate,
|
||||||
|
@ -64,8 +78,8 @@ const PrimaryMediaInfo: FC<PrimaryMediaInfoProps> = ({
|
||||||
|
|
||||||
const cssClass = classNames(className);
|
const cssClass = classNames(className);
|
||||||
|
|
||||||
const renderMediaInfo = (info: MiscInfo | undefined, index: number) => (
|
const renderMediaInfo = (info: MiscInfo, index: number) => (
|
||||||
<MediaInfoItem key={index} miscInfo={info} />
|
<MediaInfoItem key={index} className={infoclass} miscInfo={info} />
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -73,19 +87,29 @@ const PrimaryMediaInfo: FC<PrimaryMediaInfoProps> = ({
|
||||||
{miscInfo.map((info, index) => renderMediaInfo(info, index))}
|
{miscInfo.map((info, index) => renderMediaInfo(info, index))}
|
||||||
|
|
||||||
{showStarRatingInfo && CommunityRating && (
|
{showStarRatingInfo && CommunityRating && (
|
||||||
<StarIcons communityRating={CommunityRating} />
|
<StarIcons
|
||||||
|
className={infoclass}
|
||||||
|
communityRating={CommunityRating}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showCaptionIndicatorInfo && HasSubtitles && <CaptionMediaInfo />}
|
{showCaptionIndicatorInfo && HasSubtitles && (
|
||||||
|
<CaptionMediaInfo className={infoclass} />
|
||||||
|
)}
|
||||||
|
|
||||||
{showCriticRatingInfo && CriticRating && (
|
{showCriticRatingInfo && CriticRating && (
|
||||||
<CriticRatingMediaInfo criticRating={CriticRating} />
|
<CriticRatingMediaInfo
|
||||||
|
className={infoclass}
|
||||||
|
criticRating={CriticRating}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showEndsAtInfo
|
{showEndsAtInfo
|
||||||
&& MediaType === ItemMediaKind.Video
|
&& MediaType === ItemMediaKind.Video
|
||||||
&& RunTimeTicks
|
&& RunTimeTicks
|
||||||
&& !StartDate && <EndsAt runTimeTicks={RunTimeTicks} />}
|
&& !StartDate && (
|
||||||
|
<EndsAt className={infoclass} runTimeTicks={RunTimeTicks} />
|
||||||
|
)}
|
||||||
|
|
||||||
{getMissingIndicator?.()}
|
{getMissingIndicator?.()}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
@ -13,16 +13,18 @@ const StarIcons: FC<StarIconsProps> = ({ className, communityRating }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const cssClass = classNames(
|
const cssClass = classNames(
|
||||||
'mediaInfoItem',
|
'mediaInfoItem',
|
||||||
'mediaInfoText',
|
|
||||||
'starRatingContainer',
|
'starRatingContainer',
|
||||||
className
|
className
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box className={cssClass}>
|
<Box className={cssClass}>
|
||||||
<StarIcon fontSize={'small'} sx={{
|
<StarIcon
|
||||||
color: theme.palette.starIcon.main
|
fontSize={'small'}
|
||||||
}} />
|
sx={{
|
||||||
|
color: theme.palette.starIcon.main
|
||||||
|
}}
|
||||||
|
/>
|
||||||
{communityRating.toFixed(1)}
|
{communityRating.toFixed(1)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|
|
@ -271,7 +271,7 @@ export function getMediaInfoHtml(item, options = {}) {
|
||||||
if (options.officialRating !== false && item.OfficialRating && item.Type !== 'Season' && item.Type !== 'Episode') {
|
if (options.officialRating !== false && item.OfficialRating && item.Type !== 'Season' && item.Type !== 'Episode') {
|
||||||
miscInfo.push({
|
miscInfo.push({
|
||||||
text: item.OfficialRating,
|
text: item.OfficialRating,
|
||||||
cssClass: 'mediaInfoOfficialRating'
|
cssClass: 'mediaInfoText mediaInfoOfficialRating'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,6 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
padding-top: 0;
|
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.starIcon {
|
.starIcon {
|
||||||
|
@ -94,15 +92,3 @@
|
||||||
.closedCaptionMediaInfoText {
|
.closedCaptionMediaInfoText {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mediaInfoOfficialRating {
|
|
||||||
border: 0.09em solid currentColor;
|
|
||||||
padding: 0 0.6em;
|
|
||||||
height: 1.3em;
|
|
||||||
line-height: 1.8em;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
border-radius: 0.1em;
|
|
||||||
font-size: 96%;
|
|
||||||
}
|
|
||||||
|
|
|
@ -4,7 +4,13 @@ export interface PrimaryInfoOpts {
|
||||||
showEpisodeTitleInfo?: boolean;
|
showEpisodeTitleInfo?: boolean;
|
||||||
includeEpisodeTitleIndexNumber?: boolean;
|
includeEpisodeTitleIndexNumber?: boolean;
|
||||||
showOriginalAirDateInfo?: boolean;
|
showOriginalAirDateInfo?: boolean;
|
||||||
|
showFolderRuntimeInfo?: boolean;
|
||||||
showRuntimeInfo?: boolean;
|
showRuntimeInfo?: boolean;
|
||||||
|
showItemCountInfo?: boolean;
|
||||||
|
showSeriesTimerInfo?: boolean;
|
||||||
|
showStartDateInfo?: boolean;
|
||||||
showProgramIndicatorInfo?: boolean;
|
showProgramIndicatorInfo?: boolean;
|
||||||
showOfficialRatingInfo?: boolean;
|
showOfficialRatingInfo?: boolean;
|
||||||
|
showVideo3DFormatInfo?: boolean;
|
||||||
|
showPhotoSizeInfo?: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,42 +6,53 @@ import itemHelper from '../itemHelper';
|
||||||
import { ItemKind } from 'types/base/models/item-kind';
|
import { ItemKind } from 'types/base/models/item-kind';
|
||||||
import { ItemMediaKind } from 'types/base/models/item-media-kind';
|
import { ItemMediaKind } from 'types/base/models/item-media-kind';
|
||||||
import { ItemStatus } from 'types/base/models/item-status';
|
import { ItemStatus } from 'types/base/models/item-status';
|
||||||
import type { NullableNumber, NullableString } from 'types/base/common/shared/types';
|
import type {
|
||||||
|
NullableNumber,
|
||||||
|
NullableString
|
||||||
|
} from 'types/base/common/shared/types';
|
||||||
import type { ItemDto } from 'types/base/models/item-dto';
|
import type { ItemDto } from 'types/base/models/item-dto';
|
||||||
import type { MiscInfo } from 'types/mediaInfoItem';
|
import type { MiscInfo } from 'types/mediaInfoItem';
|
||||||
import { PrimaryInfoOpts } from './type';
|
import { PrimaryInfoOpts } from './type';
|
||||||
|
|
||||||
function shouldShowFolderRuntime(
|
function shouldShowFolderRuntime(
|
||||||
|
showFolderRuntimeInfo: boolean,
|
||||||
itemType: ItemKind,
|
itemType: ItemKind,
|
||||||
itemMediaType: ItemMediaKind
|
itemMediaType: ItemMediaKind
|
||||||
): boolean {
|
): boolean {
|
||||||
return (
|
return (
|
||||||
itemType === ItemKind.MusicAlbum
|
showFolderRuntimeInfo
|
||||||
|| itemMediaType === ItemMediaKind.MusicArtist
|
&& (itemType === ItemKind.MusicAlbum
|
||||||
|| itemType === ItemKind.Playlist
|
|| itemMediaType === ItemMediaKind.MusicArtist
|
||||||
|| itemMediaType === ItemMediaKind.Playlist
|
|| itemType === ItemKind.Playlist
|
||||||
|| itemMediaType === ItemMediaKind.MusicGenre
|
|| itemMediaType === ItemMediaKind.Playlist
|
||||||
|
|| itemMediaType === ItemMediaKind.MusicGenre)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTrackCountOrItemCount(
|
function addTrackCountOrItemCount(
|
||||||
showFolderRuntime: boolean,
|
isFolderRuntimeEnabled: boolean,
|
||||||
|
showItemCountInfo: boolean,
|
||||||
itemSongCount: NullableNumber,
|
itemSongCount: NullableNumber,
|
||||||
itemChildCount: NullableNumber,
|
itemChildCount: NullableNumber,
|
||||||
itemRunTimeTicks: NullableNumber,
|
itemRunTimeTicks: NullableNumber,
|
||||||
itemType: ItemKind,
|
itemType: ItemKind,
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (showFolderRuntime) {
|
if (isFolderRuntimeEnabled) {
|
||||||
const count = itemSongCount ?? itemChildCount;
|
const count = itemSongCount || itemChildCount;
|
||||||
if (count) {
|
if (count) {
|
||||||
addMiscInfo({ text: globalize.translate('TrackCount', count) });
|
addMiscInfo({ text: globalize.translate('TrackCount', count) });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemRunTimeTicks) {
|
if (itemRunTimeTicks) {
|
||||||
addMiscInfo({ text: datetime.getDisplayDuration(itemRunTimeTicks) });
|
addMiscInfo({
|
||||||
|
text: datetime.getDisplayDuration(itemRunTimeTicks)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (itemType === ItemKind.PhotoAlbum || itemType === ItemKind.BoxSet) {
|
} else if (
|
||||||
|
showItemCountInfo
|
||||||
|
&& (itemType === ItemKind.PhotoAlbum || itemType === ItemKind.BoxSet)
|
||||||
|
) {
|
||||||
const count = itemChildCount;
|
const count = itemChildCount;
|
||||||
if (count) {
|
if (count) {
|
||||||
addMiscInfo({ text: globalize.translate('ItemCount', count) });
|
addMiscInfo({ text: globalize.translate('ItemCount', count) });
|
||||||
|
@ -50,16 +61,17 @@ function addTrackCountOrItemCount(
|
||||||
}
|
}
|
||||||
|
|
||||||
function addOriginalAirDateInfo(
|
function addOriginalAirDateInfo(
|
||||||
|
showOriginalAirDateInfo: boolean,
|
||||||
itemType: ItemKind,
|
itemType: ItemKind,
|
||||||
itemMediaType: ItemMediaKind,
|
itemMediaType: ItemMediaKind,
|
||||||
showOriginalAirDateInfo: boolean,
|
|
||||||
itemPremiereDate: NullableString,
|
itemPremiereDate: NullableString,
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (
|
if (
|
||||||
itemPremiereDate
|
showOriginalAirDateInfo
|
||||||
&& (itemType === ItemKind.Episode || itemMediaType === ItemMediaKind.Photo)
|
&& (itemType === ItemKind.Episode
|
||||||
&& showOriginalAirDateInfo
|
|| itemMediaType === ItemMediaKind.Photo)
|
||||||
|
&& itemPremiereDate
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
//don't modify date to locale if episode. Only Dates (not times) are stored, or editable in the edit metadata dialog
|
//don't modify date to locale if episode. Only Dates (not times) are stored, or editable in the edit metadata dialog
|
||||||
|
@ -75,6 +87,7 @@ function addOriginalAirDateInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
function addSeriesTimerInfo(
|
function addSeriesTimerInfo(
|
||||||
|
showSeriesTimerInfo: boolean,
|
||||||
itemType: ItemKind,
|
itemType: ItemKind,
|
||||||
itemRecordAnyTime: boolean | undefined,
|
itemRecordAnyTime: boolean | undefined,
|
||||||
itemStartDate: NullableString,
|
itemStartDate: NullableString,
|
||||||
|
@ -82,7 +95,7 @@ function addSeriesTimerInfo(
|
||||||
itemChannelName: NullableString,
|
itemChannelName: NullableString,
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (itemType === ItemKind.SeriesTimer) {
|
if (showSeriesTimerInfo && itemType === ItemKind.SeriesTimer) {
|
||||||
if (itemRecordAnyTime) {
|
if (itemRecordAnyTime) {
|
||||||
addMiscInfo({ text: globalize.translate('Anytime') });
|
addMiscInfo({ text: globalize.translate('Anytime') });
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,7 +106,7 @@ function addSeriesTimerInfo(
|
||||||
addMiscInfo({ text: globalize.translate('AllChannels') });
|
addMiscInfo({ text: globalize.translate('AllChannels') });
|
||||||
} else {
|
} else {
|
||||||
addMiscInfo({
|
addMiscInfo({
|
||||||
text: itemChannelName ?? globalize.translate('OneChannel')
|
text: itemChannelName || globalize.translate('OneChannel')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,12 +154,12 @@ function addProgramIndicatorInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
function addProgramIndicators(
|
function addProgramIndicators(
|
||||||
item: ItemDto,
|
|
||||||
showYearInfo: boolean,
|
showYearInfo: boolean,
|
||||||
showEpisodeTitleInfo: boolean,
|
showEpisodeTitleInfo: boolean,
|
||||||
showOriginalAirDateInfo: boolean,
|
showOriginalAirDateInfo: boolean,
|
||||||
showProgramIndicatorInfo: boolean,
|
showProgramIndicatorInfo: boolean,
|
||||||
includeEpisodeTitleIndexNumber: boolean,
|
includeEpisodeTitleIndexNumber: boolean,
|
||||||
|
item: ItemDto,
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (item.Type === ItemKind.Program || item.Type === ItemKind.Timer) {
|
if (item.Type === ItemKind.Program || item.Type === ItemKind.Timer) {
|
||||||
|
@ -155,33 +168,30 @@ function addProgramIndicators(
|
||||||
program = item.ProgramInfo;
|
program = item.ProgramInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showProgramIndicatorInfo !== false) {
|
if (showProgramIndicatorInfo) {
|
||||||
addProgramIndicatorInfo(program, addMiscInfo);
|
addProgramIndicatorInfo(program, addMiscInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
addProgramTextInfo(
|
addProgramTextInfo(
|
||||||
program,
|
|
||||||
showEpisodeTitleInfo,
|
showEpisodeTitleInfo,
|
||||||
includeEpisodeTitleIndexNumber,
|
includeEpisodeTitleIndexNumber,
|
||||||
showOriginalAirDateInfo,
|
showOriginalAirDateInfo,
|
||||||
showYearInfo,
|
showYearInfo,
|
||||||
|
program,
|
||||||
addMiscInfo
|
addMiscInfo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addProgramTextInfo(
|
function addProgramTextInfo(
|
||||||
program: ItemDto,
|
|
||||||
showEpisodeTitleInfo: boolean,
|
showEpisodeTitleInfo: boolean,
|
||||||
includeEpisodeTitleIndexNumber: boolean,
|
includeEpisodeTitleIndexNumber: boolean,
|
||||||
showOriginalAirDateInfo: boolean,
|
showOriginalAirDateInfo: boolean,
|
||||||
showYearInfo: boolean,
|
showYearInfo: boolean,
|
||||||
|
program: ItemDto,
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (
|
if (showEpisodeTitleInfo && (program.IsSeries || program.EpisodeTitle)) {
|
||||||
(program?.IsSeries || program?.EpisodeTitle)
|
|
||||||
&& showEpisodeTitleInfo !== false
|
|
||||||
) {
|
|
||||||
const text = itemHelper.getDisplayName(program, {
|
const text = itemHelper.getDisplayName(program, {
|
||||||
includeIndexNumber: includeEpisodeTitleIndexNumber
|
includeIndexNumber: includeEpisodeTitleIndexNumber
|
||||||
});
|
});
|
||||||
|
@ -190,12 +200,11 @@ function addProgramTextInfo(
|
||||||
addMiscInfo({ text: text });
|
addMiscInfo({ text: text });
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
program?.ProductionYear
|
((showOriginalAirDateInfo && program.IsMovie) || showYearInfo)
|
||||||
&& ((program?.IsMovie && showOriginalAirDateInfo !== false)
|
&& program.ProductionYear
|
||||||
|| showYearInfo !== false)
|
|
||||||
) {
|
) {
|
||||||
addMiscInfo({ text: program.ProductionYear });
|
addMiscInfo({ text: program.ProductionYear });
|
||||||
} else if (program?.PremiereDate && showOriginalAirDateInfo !== false) {
|
} else if (showOriginalAirDateInfo && program.PremiereDate) {
|
||||||
try {
|
try {
|
||||||
const date = datetime.parseISO8601Date(program.PremiereDate);
|
const date = datetime.parseISO8601Date(program.PremiereDate);
|
||||||
const text = globalize.translate(
|
const text = globalize.translate(
|
||||||
|
@ -210,12 +219,14 @@ function addProgramTextInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
function addStartDateInfo(
|
function addStartDateInfo(
|
||||||
|
showStartDateInfo: boolean,
|
||||||
itemStartDate: NullableString,
|
itemStartDate: NullableString,
|
||||||
itemType: ItemKind,
|
itemType: ItemKind,
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (
|
if (
|
||||||
itemStartDate
|
showStartDateInfo
|
||||||
|
&& itemStartDate
|
||||||
&& itemType !== ItemKind.Program
|
&& itemType !== ItemKind.Program
|
||||||
&& itemType !== ItemKind.SeriesTimer
|
&& itemType !== ItemKind.SeriesTimer
|
||||||
&& itemType !== ItemKind.Timer
|
&& itemType !== ItemKind.Timer
|
||||||
|
@ -234,14 +245,14 @@ function addStartDateInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
function addSeriesProductionYearInfo(
|
function addSeriesProductionYearInfo(
|
||||||
|
showYearInfo: boolean,
|
||||||
itemProductionYear: NullableNumber,
|
itemProductionYear: NullableNumber,
|
||||||
itemType: ItemKind,
|
itemType: ItemKind,
|
||||||
showYearInfo: boolean,
|
|
||||||
itemStatus: ItemStatus,
|
itemStatus: ItemStatus,
|
||||||
itemEndDate: NullableString,
|
itemEndDate: NullableString,
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (itemProductionYear && showYearInfo && itemType === ItemKind.Series) {
|
if (showYearInfo && itemProductionYear && itemType === ItemKind.Series) {
|
||||||
if (itemStatus === ItemStatus.Continuing) {
|
if (itemStatus === ItemStatus.Continuing) {
|
||||||
addMiscInfo({
|
addMiscInfo({
|
||||||
text: globalize.translate(
|
text: globalize.translate(
|
||||||
|
@ -252,7 +263,11 @@ function addSeriesProductionYearInfo(
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addproductionYearWithEndDate(itemProductionYear, itemEndDate, addMiscInfo);
|
addproductionYearWithEndDate(
|
||||||
|
itemProductionYear,
|
||||||
|
itemEndDate,
|
||||||
|
addMiscInfo
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,47 +332,52 @@ function addYearInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
function addVideo3DFormat(
|
function addVideo3DFormat(
|
||||||
|
showVideo3DFormatInfo: boolean,
|
||||||
itemVideo3DFormat: NullableString,
|
itemVideo3DFormat: NullableString,
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (itemVideo3DFormat) {
|
if (showVideo3DFormatInfo && itemVideo3DFormat) {
|
||||||
addMiscInfo({ text: '3D' });
|
addMiscInfo({ text: '3D' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addRunTimeInfo(
|
function addRunTimeInfo(
|
||||||
|
isFolderRuntimeEnabled: boolean,
|
||||||
|
showRuntimeInfo: boolean,
|
||||||
itemRunTimeTicks: NullableNumber,
|
itemRunTimeTicks: NullableNumber,
|
||||||
itemType: ItemKind,
|
itemType: ItemKind,
|
||||||
showFolderRuntime: boolean,
|
|
||||||
showRuntimeInfo: boolean,
|
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (
|
if (
|
||||||
itemRunTimeTicks
|
!isFolderRuntimeEnabled
|
||||||
|
&& showRuntimeInfo
|
||||||
|
&& itemRunTimeTicks
|
||||||
&& itemType !== ItemKind.Series
|
&& itemType !== ItemKind.Series
|
||||||
&& itemType !== ItemKind.Program
|
&& itemType !== ItemKind.Program
|
||||||
&& itemType !== ItemKind.Timer
|
&& itemType !== ItemKind.Timer
|
||||||
&& itemType !== ItemKind.Book
|
&& itemType !== ItemKind.Book
|
||||||
&& !showFolderRuntime
|
|
||||||
&& showRuntimeInfo
|
|
||||||
) {
|
) {
|
||||||
if (itemType === ItemKind.Audio) {
|
if (itemType === ItemKind.Audio) {
|
||||||
addMiscInfo({ text: datetime.getDisplayRunningTime(itemRunTimeTicks) });
|
addMiscInfo({
|
||||||
|
text: datetime.getDisplayRunningTime(itemRunTimeTicks)
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
addMiscInfo({ text: datetime.getDisplayDuration(itemRunTimeTicks) });
|
addMiscInfo({
|
||||||
|
text: datetime.getDisplayDuration(itemRunTimeTicks)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addOfficialRatingInfo(
|
function addOfficialRatingInfo(
|
||||||
|
showOfficialRatingInfo: boolean,
|
||||||
itemOfficialRating: NullableString,
|
itemOfficialRating: NullableString,
|
||||||
itemType: ItemKind,
|
itemType: ItemKind,
|
||||||
showOfficialRatingInfo: boolean,
|
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (
|
if (
|
||||||
itemOfficialRating
|
showOfficialRatingInfo
|
||||||
&& showOfficialRatingInfo
|
&& itemOfficialRating
|
||||||
&& itemType !== ItemKind.Season
|
&& itemType !== ItemKind.Season
|
||||||
&& itemType !== ItemKind.Episode
|
&& itemType !== ItemKind.Episode
|
||||||
) {
|
) {
|
||||||
|
@ -369,14 +389,14 @@ function addOfficialRatingInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
function addAudioContainer(
|
function addAudioContainer(
|
||||||
itemContainer: NullableString,
|
|
||||||
showAudioContainerInfo: boolean,
|
showAudioContainerInfo: boolean,
|
||||||
|
itemContainer: NullableString,
|
||||||
itemType: ItemKind,
|
itemType: ItemKind,
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (
|
if (
|
||||||
itemContainer
|
showAudioContainerInfo
|
||||||
&& showAudioContainerInfo
|
&& itemContainer
|
||||||
&& itemType === ItemKind.Audio
|
&& itemType === ItemKind.Audio
|
||||||
) {
|
) {
|
||||||
addMiscInfo({ text: itemContainer });
|
addMiscInfo({ text: itemContainer });
|
||||||
|
@ -384,12 +404,18 @@ function addAudioContainer(
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPhotoSize(
|
function addPhotoSize(
|
||||||
|
showPhotoSizeInfo: boolean,
|
||||||
itemMediaType: ItemMediaKind,
|
itemMediaType: ItemMediaKind,
|
||||||
itemWidth: NullableNumber,
|
itemWidth: NullableNumber,
|
||||||
itemHeight: NullableNumber,
|
itemHeight: NullableNumber,
|
||||||
addMiscInfo: (val: MiscInfo) => void
|
addMiscInfo: (val: MiscInfo) => void
|
||||||
): void {
|
): void {
|
||||||
if (itemMediaType === ItemMediaKind.Photo && itemWidth && itemHeight) {
|
if (
|
||||||
|
showPhotoSizeInfo
|
||||||
|
&& itemMediaType === ItemMediaKind.Photo
|
||||||
|
&& itemWidth
|
||||||
|
&& itemHeight
|
||||||
|
) {
|
||||||
const size = `${itemWidth}x${itemHeight}`;
|
const size = `${itemWidth}x${itemHeight}`;
|
||||||
|
|
||||||
addMiscInfo({ text: size });
|
addMiscInfo({ text: size });
|
||||||
|
@ -406,10 +432,16 @@ function usePrimaryMediaInfo({
|
||||||
showAudioContainerInfo = false,
|
showAudioContainerInfo = false,
|
||||||
showEpisodeTitleInfo = false,
|
showEpisodeTitleInfo = false,
|
||||||
showOriginalAirDateInfo = false,
|
showOriginalAirDateInfo = false,
|
||||||
|
showFolderRuntimeInfo = false,
|
||||||
showRuntimeInfo = false,
|
showRuntimeInfo = false,
|
||||||
|
showItemCountInfo = false,
|
||||||
|
showSeriesTimerInfo = false,
|
||||||
|
showStartDateInfo = false,
|
||||||
showProgramIndicatorInfo = false,
|
showProgramIndicatorInfo = false,
|
||||||
includeEpisodeTitleIndexNumber = false,
|
includeEpisodeTitleIndexNumber = false,
|
||||||
showOfficialRatingInfo = false
|
showOfficialRatingInfo = false,
|
||||||
|
showVideo3DFormatInfo = false,
|
||||||
|
showPhotoSizeInfo = false
|
||||||
}: UsePrimaryMediaInfoProps) {
|
}: UsePrimaryMediaInfoProps) {
|
||||||
const {
|
const {
|
||||||
EndDate,
|
EndDate,
|
||||||
|
@ -440,10 +472,15 @@ function usePrimaryMediaInfo({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const showFolderRuntime = shouldShowFolderRuntime(Type, MediaType);
|
const isFolderRuntimeEnabled = shouldShowFolderRuntime(
|
||||||
|
showFolderRuntimeInfo,
|
||||||
|
Type,
|
||||||
|
MediaType
|
||||||
|
);
|
||||||
|
|
||||||
addTrackCountOrItemCount(
|
addTrackCountOrItemCount(
|
||||||
showFolderRuntime,
|
isFolderRuntimeEnabled,
|
||||||
|
showItemCountInfo,
|
||||||
SongCount,
|
SongCount,
|
||||||
ChildCount,
|
ChildCount,
|
||||||
RunTimeTicks,
|
RunTimeTicks,
|
||||||
|
@ -452,14 +489,15 @@ function usePrimaryMediaInfo({
|
||||||
);
|
);
|
||||||
|
|
||||||
addOriginalAirDateInfo(
|
addOriginalAirDateInfo(
|
||||||
|
showOriginalAirDateInfo,
|
||||||
Type,
|
Type,
|
||||||
MediaType,
|
MediaType,
|
||||||
showOriginalAirDateInfo,
|
|
||||||
PremiereDate,
|
PremiereDate,
|
||||||
addMiscInfo
|
addMiscInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
addSeriesTimerInfo(
|
addSeriesTimerInfo(
|
||||||
|
showSeriesTimerInfo,
|
||||||
Type,
|
Type,
|
||||||
RecordAnyTime,
|
RecordAnyTime,
|
||||||
StartDate,
|
StartDate,
|
||||||
|
@ -468,24 +506,24 @@ function usePrimaryMediaInfo({
|
||||||
addMiscInfo
|
addMiscInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
addStartDateInfo(StartDate, Type, addMiscInfo);
|
addStartDateInfo(showStartDateInfo, StartDate, Type, addMiscInfo);
|
||||||
|
|
||||||
addSeriesProductionYearInfo(
|
addSeriesProductionYearInfo(
|
||||||
|
showYearInfo,
|
||||||
ProductionYear,
|
ProductionYear,
|
||||||
Type,
|
Type,
|
||||||
showYearInfo,
|
|
||||||
Status,
|
Status,
|
||||||
EndDate,
|
EndDate,
|
||||||
addMiscInfo
|
addMiscInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
addProgramIndicators(
|
addProgramIndicators(
|
||||||
item,
|
|
||||||
showProgramIndicatorInfo,
|
showProgramIndicatorInfo,
|
||||||
showEpisodeTitleInfo,
|
showEpisodeTitleInfo,
|
||||||
includeEpisodeTitleIndexNumber,
|
includeEpisodeTitleIndexNumber,
|
||||||
showOriginalAirDateInfo,
|
showOriginalAirDateInfo,
|
||||||
showYearInfo,
|
showYearInfo,
|
||||||
|
item,
|
||||||
addMiscInfo
|
addMiscInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -499,25 +537,25 @@ function usePrimaryMediaInfo({
|
||||||
);
|
);
|
||||||
|
|
||||||
addRunTimeInfo(
|
addRunTimeInfo(
|
||||||
|
isFolderRuntimeEnabled,
|
||||||
|
showRuntimeInfo,
|
||||||
RunTimeTicks,
|
RunTimeTicks,
|
||||||
Type,
|
Type,
|
||||||
showFolderRuntime,
|
|
||||||
showRuntimeInfo,
|
|
||||||
addMiscInfo
|
addMiscInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
addOfficialRatingInfo(
|
addOfficialRatingInfo(
|
||||||
|
showOfficialRatingInfo,
|
||||||
OfficialRating,
|
OfficialRating,
|
||||||
Type,
|
Type,
|
||||||
showOfficialRatingInfo,
|
|
||||||
addMiscInfo
|
addMiscInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
addVideo3DFormat(Video3DFormat, addMiscInfo);
|
addVideo3DFormat(showVideo3DFormatInfo, Video3DFormat, addMiscInfo);
|
||||||
|
|
||||||
addPhotoSize(MediaType, Width, Height, addMiscInfo);
|
addPhotoSize(showPhotoSizeInfo, MediaType, Width, Height, addMiscInfo);
|
||||||
|
|
||||||
addAudioContainer(Container, showAudioContainerInfo, Type, addMiscInfo);
|
addAudioContainer(showAudioContainerInfo, Container, Type, addMiscInfo);
|
||||||
|
|
||||||
return miscInfo;
|
return miscInfo;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue