1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #5932 from grafixeyehero/Add-ItemDtoQueryResult-ItemStatus

Add shared ItemStatus and ItemDtoQueryResult Type
This commit is contained in:
Bill Thornton 2024-08-21 11:41:48 -04:00 committed by GitHub
commit d232494a89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 219 additions and 183 deletions

View file

@ -6,6 +6,7 @@ import CardHoverMenu from './CardHoverMenu';
import CardOuterFooter from './CardOuterFooter';
import CardContent from './CardContent';
import { CardShape } from 'utils/card';
import type { ItemDto } from 'types/base/models/item-dto';
import type { CardOptions } from 'types/cardOptions';

View file

@ -2,10 +2,11 @@ import React, { type FC } from 'react';
import Box from '@mui/material/Box';
import useCardText from './useCardText';
import layoutManager from 'components/layoutManager';
import MoreVertIconButton from '../../common/MoreVertIconButton';
import MoreVertIconButton from 'components/common/MoreVertIconButton';
import Image from 'components/common/Image';
import type { ItemDto } from 'types/base/models/item-dto';
import type { CardOptions } from 'types/cardOptions';
import Image from 'components/common/Image';
const shouldShowDetailsMenu = (
cardOptions: CardOptions,

View file

@ -1,4 +1,3 @@
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
import React, { type FC } from 'react';
import Box from '@mui/material/Box';
import classNames from 'classnames';
@ -7,6 +6,7 @@ import RefreshIndicator from 'elements/emby-itemrefreshindicator/RefreshIndicato
import Media from '../../common/Media';
import CardInnerFooter from './CardInnerFooter';
import { ItemKind } from 'types/base/models/item-kind';
import type { ItemDto } from 'types/base/models/item-dto';
import type { CardOptions } from 'types/cardOptions';
@ -33,7 +33,7 @@ const CardImageContainer: FC<CardImageContainerProps> = ({
const cardImageClass = classNames(
'cardImageContainer',
{ coveredImage: coveredImage },
{ 'coveredImage-contain': coveredImage && item.Type === BaseItemKind.TvChannel }
{ 'coveredImage-contain': coveredImage && item.Type === ItemKind.TvChannel }
);
return (
@ -53,7 +53,7 @@ const CardImageContainer: FC<CardImageContainerProps> = ({
indicator.getChildCountIndicator() :
indicator.getPlayedIndicator()}
{(item.Type === BaseItemKind.CollectionFolder
{(item.Type === ItemKind.CollectionFolder
|| item.CollectionType) && (
<RefreshIndicator item={item} />
)}

View file

@ -1,6 +1,7 @@
import React, { type FC } from 'react';
import classNames from 'classnames';
import CardFooterText from './CardFooterText';
import type { ItemDto } from 'types/base/models/item-dto';
import type { CardOptions } from 'types/cardOptions';

View file

@ -1,4 +1,3 @@
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
import { LocationType } from '@jellyfin/sdk/lib/generated-client/models/location-type';
import React, { type FC } from 'react';
import ButtonGroup from '@mui/material/ButtonGroup';
@ -7,6 +6,8 @@ import { appRouter } from 'components/router/appRouter';
import PlayArrowIconButton from '../../common/PlayArrowIconButton';
import MoreVertIconButton from '../../common/MoreVertIconButton';
import { ItemKind } from 'types/base/models/item-kind';
import { ItemMediaKind } from 'types/base/models/item-media-kind';
import type { ItemDto } from 'types/base/models/item-dto';
import type { CardOptions } from 'types/cardOptions';
@ -19,8 +20,8 @@ const sholudShowOverlayPlayButton = (
&& !item.IsPlaceHolder
&& (item.LocationType !== LocationType.Virtual
|| !item.MediaType
|| item.Type === BaseItemKind.Program)
&& item.Type !== BaseItemKind.Person
|| item.Type === ItemKind.Program)
&& item.Type !== ItemKind.Person
);
};
@ -41,7 +42,7 @@ const CardOverlayButtons: FC<CardOverlayButtonsProps> = ({
&& !cardOptions.overlayInfoButton
&& !cardOptions.cardLayout
) {
overlayPlayButton = item.MediaType === 'Video';
overlayPlayButton = item.MediaType === ItemMediaKind.Video;
}
const url = appRouter.getRouteUrl(item, {

View file

@ -1,10 +1,6 @@
import {
BaseItemDto,
BaseItemKind,
BaseItemPerson,
ImageType
} from '@jellyfin/sdk/lib/generated-client';
import { Api } from '@jellyfin/sdk';
import type { BaseItemPerson } from '@jellyfin/sdk/lib/generated-client/models/base-item-person';
import { ImageType } from '@jellyfin/sdk/lib/generated-client/models/image-type';
import { getImageApi } from '@jellyfin/sdk/lib/utils/api/image-api';
import { appRouter } from 'components/router/appRouter';
@ -12,14 +8,15 @@ import layoutManager from 'components/layoutManager';
import itemHelper from 'components/itemHelper';
import globalize from 'lib/globalize';
import datetime from 'scripts/datetime';
import { isUsingLiveTvNaming } from '../cardBuilderUtils';
import { getDataAttributes } from 'utils/items';
import { ItemKind } from 'types/base/models/item-kind';
import { ItemMediaKind } from 'types/base/models/item-media-kind';
import type { NullableNumber, NullableString } from 'types/base/common/shared/types';
import type { ItemDto } from 'types/base/models/item-dto';
import type { CardOptions } from 'types/cardOptions';
import type { DataAttributes } from 'types/dataAttributes';
import { getDataAttributes } from 'utils/items';
export function getCardLogoUrl(
item: ItemDto,
@ -142,15 +139,15 @@ export function getAirTimeText(
return airTimeText;
}
function isGenreOrStudio(itemType: NullableString) {
return itemType === BaseItemKind.Genre || itemType === BaseItemKind.Studio;
function isGenreOrStudio(itemType: ItemKind) {
return itemType === ItemKind.Genre || itemType === ItemKind.Studio;
}
function isMusicGenreOrMusicArtist(
itemType: NullableString,
itemType: ItemKind,
context: NullableString
) {
return itemType === BaseItemKind.MusicGenre || context === 'MusicArtist';
return itemType === ItemKind.MusicGenre || context === 'MusicArtist';
}
function getMovieCount(itemMovieCount: NullableNumber) {
@ -213,8 +210,8 @@ function getParentTitle(
item: ItemDto
) {
if (isOuterFooter && item.AlbumArtists?.length) {
(item.AlbumArtists[0] as BaseItemDto).Type = BaseItemKind.MusicArtist;
(item.AlbumArtists[0] as BaseItemDto).IsFolder = true;
(item.AlbumArtists[0] as ItemDto).Type = ItemKind.MusicArtist;
(item.AlbumArtists[0] as ItemDto).IsFolder = true;
return getTextActionButton(item.AlbumArtists[0], null, serverId);
} else {
return {
@ -250,7 +247,7 @@ export function getItemCounts(cardOptions: CardOptions, item: ItemDto) {
}
};
if (item.Type === BaseItemKind.Playlist) {
if (item.Type === ItemKind.Playlist) {
const runTimeTicksText = getRunTimeTicks(item.RunTimeTicks);
addCount(runTimeTicksText);
} else if (isGenreOrStudio(item.Type)) {
@ -271,7 +268,7 @@ export function getItemCounts(cardOptions: CardOptions, item: ItemDto) {
const musicVideoCountText = getMusicVideoCount(item.MusicVideoCount);
addCount(musicVideoCountText);
} else if (item.Type === BaseItemKind.Series) {
} else if (item.Type === ItemKind.Series) {
const recursiveItemCountText = getRecursiveItemCount(
item.RecursiveItemCount
);
@ -283,12 +280,12 @@ export function getItemCounts(cardOptions: CardOptions, item: ItemDto) {
export function shouldShowTitle(
showTitle: boolean | string | undefined,
itemType: NullableString
itemType: ItemKind
) {
return (
Boolean(showTitle)
|| itemType === BaseItemKind.PhotoAlbum
|| itemType === BaseItemKind.Folder
|| itemType === ItemKind.PhotoAlbum
|| itemType === ItemKind.Folder
);
}
@ -300,12 +297,12 @@ export function shouldShowOtherText(
}
export function shouldShowParentTitleUnderneath(
itemType: NullableString
itemType: ItemKind
) {
return (
itemType === BaseItemKind.MusicAlbum
|| itemType === BaseItemKind.Audio
|| itemType === BaseItemKind.MusicVideo
itemType === ItemKind.MusicAlbum
|| itemType === ItemKind.Audio
|| itemType === ItemKind.MusicVideo
);
}
@ -338,16 +335,16 @@ function shouldShowSeriesYearOrYear(
function shouldShowCurrentProgram(
showCurrentProgram: boolean | undefined,
itemType: NullableString
itemType: ItemKind
) {
return showCurrentProgram && itemType === BaseItemKind.TvChannel;
return showCurrentProgram && itemType === ItemKind.TvChannel;
}
function shouldShowCurrentProgramTime(
showCurrentProgramTime: boolean | undefined,
itemType: NullableString
itemType: ItemKind
) {
return showCurrentProgramTime && itemType === BaseItemKind.TvChannel;
return showCurrentProgramTime && itemType === ItemKind.TvChannel;
}
function shouldShowPersonRoleOrType(
@ -475,7 +472,7 @@ function getSeriesTimerTime(item: ItemDto) {
}
}
function getCurrentProgramTime(CurrentProgram: BaseItemDto | undefined) {
function getCurrentProgramTime(CurrentProgram: ItemDto | undefined) {
if (CurrentProgram) {
return getAirTimeText(CurrentProgram, false, true) || '';
} else {
@ -483,7 +480,7 @@ function getCurrentProgramTime(CurrentProgram: BaseItemDto | undefined) {
}
}
function getCurrentProgramName(CurrentProgram: BaseItemDto | undefined) {
function getCurrentProgramName(CurrentProgram: ItemDto | undefined) {
if (CurrentProgram) {
return CurrentProgram.Name;
} else {
@ -498,7 +495,7 @@ function getChannelName(item: ItemDto) {
Id: item.ChannelId,
ServerId: item.ServerId,
Name: item.ChannelName,
Type: BaseItemKind.TvChannel,
Type: ItemKind.TvChannel,
MediaType: item.MediaType,
IsFolder: false
},
@ -548,7 +545,7 @@ function getProductionYear(item: ItemDto) {
&& datetime.toLocaleString(item.ProductionYear, {
useGrouping: false
});
if (item.Type === BaseItemKind.Series) {
if (item.Type === ItemKind.Series) {
if (item.Status === 'Continuing') {
return globalize.translate(
'SeriesYearToPresent',
@ -575,7 +572,7 @@ function getMediaTitle(cardOptions: CardOptions, item: ItemDto): TextLine {
const name =
cardOptions.showTitle === 'auto'
&& !item.IsFolder
&& item.MediaType === 'Photo' ?
&& item.MediaType === ItemMediaKind.Photo ?
'' :
itemHelper.getDisplayName(item, {
includeParentInfo: cardOptions.includeParentInfoInTitle
@ -599,7 +596,7 @@ function getParentTitleOrTitle(
): TextLine {
if (
isOuterFooter
&& item.Type === BaseItemKind.Episode
&& item.Type === ItemKind.Episode
&& item.SeriesName
) {
if (item.SeriesId) {
@ -607,7 +604,7 @@ function getParentTitleOrTitle(
Id: item.SeriesId,
ServerId: item.ServerId,
Name: item.SeriesName,
Type: BaseItemKind.Series,
Type: ItemKind.Series,
IsFolder: true
});
} else {

View file

@ -1,4 +1,3 @@
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
import classNames from 'classnames';
import useCardImageUrl from './useCardImageUrl';
import {
@ -9,6 +8,8 @@ import { getDataAttributes } from 'utils/items';
import { CardShape } from 'utils/card';
import layoutManager from 'components/layoutManager';
import { ItemKind } from 'types/base/models/item-kind';
import { ItemMediaKind } from 'types/base/models/item-media-kind';
import type { ItemDto } from 'types/base/models/item-dto';
import type { CardOptions } from 'types/cardOptions';
@ -21,7 +22,7 @@ function useCard({ item, cardOptions }: UseCardProps) {
const action = resolveAction({
defaultAction: cardOptions.action ?? 'link',
isFolder: item.IsFolder ?? false,
isPhoto: item.MediaType === 'Photo'
isPhoto: item.MediaType === ItemMediaKind.Photo
});
let shape = cardOptions.shape;
@ -84,9 +85,9 @@ function useCard({ item, cardOptions }: UseCardProps) {
{ groupedCard: cardOptions.showChildCountIndicator && item.ChildCount },
{
'card-withuserdata':
item.Type !== BaseItemKind.MusicAlbum
&& item.Type !== BaseItemKind.MusicArtist
&& item.Type !== BaseItemKind.Audio
item.Type !== ItemKind.MusicAlbum
&& item.Type !== ItemKind.MusicArtist
&& item.Type !== ItemKind.Audio
},
{ itemAction: layoutManager.tv }
);

View file

@ -1,9 +1,11 @@
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
import { ImageType } from '@jellyfin/sdk/lib/generated-client/models/image-type';
import { getImageApi } from '@jellyfin/sdk/lib/utils/api/image-api';
import { useApi } from 'hooks/useApi';
import { getDesiredAspect } from '../cardBuilderUtils';
import { CardShape } from 'utils/card';
import { ItemKind } from 'types/base/models/item-kind';
import { ItemMediaKind } from 'types/base/models/item-media-kind';
import type { NullableNumber, NullableString } from 'types/base/common/shared/types';
import type { ItemDto } from 'types/base/models/item-dto';
import type { CardOptions } from 'types/cardOptions';
@ -25,7 +27,7 @@ function getPreferThumbInfo(item: ItemDto, cardOptions: CardOptions) {
} else if (
item.ParentThumbItemId
&& cardOptions.inheritThumb !== false
&& item.MediaType !== 'Photo'
&& item.MediaType !== ItemMediaKind.Photo
) {
imgType = ImageType.Thumb;
imgTag = item.ParentThumbImageTag;
@ -117,12 +119,12 @@ function shouldShowPreferDisc(
function shouldShowImageTagsPrimary(item: ItemDto): boolean {
return (
Boolean(item.ImageTags?.Primary) && (item.Type !== BaseItemKind.Episode || item.ChildCount !== 0)
Boolean(item.ImageTags?.Primary) && (item.Type !== ItemKind.Episode || item.ChildCount !== 0)
);
}
function shouldShowImageTagsThumb(item: ItemDto): boolean {
return item.Type === BaseItemKind.Season && Boolean(item.ImageTags?.Thumb);
return item.Type === ItemKind.Season && Boolean(item.ImageTags?.Thumb);
}
function shouldShowSeriesThumbImageTag(
@ -147,8 +149,8 @@ function shouldShowAlbumPrimaryImageTag(item: ItemDto): boolean {
return Boolean(item.AlbumId) && Boolean(item.AlbumPrimaryImageTag);
}
function shouldShowPreferThumb(itemType: NullableString, cardOptions: CardOptions): boolean {
return Boolean(cardOptions.preferThumb) && !(itemType === BaseItemKind.Program || itemType === BaseItemKind.Episode);
function shouldShowPreferThumb(itemType: ItemKind, cardOptions: CardOptions): boolean {
return Boolean(cardOptions.preferThumb) && !(itemType === ItemKind.Program || itemType === ItemKind.Episode);
}
function getCardImageInfo(

View file

@ -1,4 +1,3 @@
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
import { LocationType } from '@jellyfin/sdk/lib/generated-client/models/location-type';
import React from 'react';
import Box from '@mui/material/Box';
@ -13,9 +12,15 @@ import FolderIcon from '@mui/icons-material/Folder';
import PhotoAlbumIcon from '@mui/icons-material/PhotoAlbum';
import PhotoIcon from '@mui/icons-material/Photo';
import classNames from 'classnames';
import datetime from 'scripts/datetime';
import itemHelper from 'components/itemHelper';
import AutoTimeProgressBar from 'elements/emby-progressbar/AutoTimeProgressBar';
import { ItemKind } from 'types/base/models/item-kind';
import { ItemMediaKind } from 'types/base/models/item-media-kind';
import { ItemStatus } from 'types/base/models/item-status';
import type { NullableString } from 'types/base/common/shared/types';
import type { ItemDto } from 'types/base/models/item-dto';
import type { ProgressOptions } from 'types/progressOptions';
@ -32,25 +37,25 @@ const getTypeIcon = (itemType: NullableString) => {
};
const enableProgressIndicator = (
itemType: NullableString,
itemMediaType: NullableString
itemType: ItemKind,
itemMediaType: ItemMediaKind
) => {
return (
(itemMediaType === 'Video' && itemType !== BaseItemKind.TvChannel)
|| itemType === BaseItemKind.AudioBook
|| itemType === 'AudioPodcast'
(itemMediaType === ItemMediaKind.Video && itemType !== ItemKind.TvChannel)
|| itemType === ItemKind.AudioBook
|| itemType === ItemKind.AudioPodcast
);
};
const enableAutoTimeProgressIndicator = (
itemType: NullableString,
itemType: ItemKind,
itemStartDate: NullableString,
itemEndDate: NullableString
) => {
return (
(itemType === BaseItemKind.Program
|| itemType === 'Timer'
|| itemType === BaseItemKind.Recording)
(itemType === ItemKind.Program
|| itemType === ItemKind.Timer
|| itemType === ItemKind.Recording)
&& Boolean(itemStartDate)
&& Boolean(itemEndDate)
);
@ -76,7 +81,7 @@ const useIndicator = (item: ItemDto) => {
const getMissingIndicator = () => {
if (
item.Type === BaseItemKind.Episode
item.Type === ItemKind.Episode
&& item.LocationType === LocationType.Virtual
) {
if (item.PremiereDate) {
@ -102,11 +107,11 @@ const useIndicator = (item: ItemDto) => {
let status;
if (item.Type === 'SeriesTimer') {
if (item.Type === ItemKind.SeriesTimer) {
return <FiberSmartRecordIcon className={indicatorIconClass} />;
} else if (item.TimerId || item.SeriesTimerId) {
status = item.Status || 'Cancelled';
} else if (item.Type === 'Timer') {
status = item.Status || ItemStatus.Cancelled;
} else if (item.Type === ItemKind.Timer) {
status = item.Status;
} else {
return null;
@ -116,7 +121,7 @@ const useIndicator = (item: ItemDto) => {
return (
<FiberSmartRecordIcon
className={`${indicatorIconClass} ${
status === 'Cancelled' ? 'timerIndicator-inactive' : ''
status === ItemStatus.Cancelled ? 'timerIndicator-inactive' : ''
}`}
/>
);
@ -198,7 +203,7 @@ const useIndicator = (item: ItemDto) => {
const getProgressBar = (progressOptions?: ProgressOptions) => {
if (
enableProgressIndicator(item.Type, item.MediaType)
&& item.Type !== BaseItemKind.Recording
&& item.Type !== ItemKind.Recording
) {
const playedPercentage = progressOptions?.userData?.PlayedPercentage ?
progressOptions.userData.PlayedPercentage :
@ -231,8 +236,8 @@ const useIndicator = (item: ItemDto) => {
if (pct > 0 && pct < 100) {
const isRecording =
item.Type === 'Timer'
|| item.Type === BaseItemKind.Recording
item.Type === ItemKind.Timer
|| item.Type === ItemKind.Recording
|| Boolean(item.TimerId);
return (
<AutoTimeProgressBar

View file

@ -8,6 +8,8 @@ import StarIcons from './StarIcons';
import CaptionMediaInfo from './CaptionMediaInfo';
import CriticRatingMediaInfo from './CriticRatingMediaInfo';
import EndsAt from './EndsAt';
import { ItemMediaKind } from 'types/base/models/item-media-kind';
import type { ItemDto } from 'types/base/models/item-dto';
import type { MiscInfo } from 'types/mediaInfoItem';
@ -89,7 +91,7 @@ const PrimaryMediaInfo: FC<PrimaryMediaInfoProps> = ({
)}
{isEndsAtEnabled
&& MediaType === 'Video'
&& MediaType === ItemMediaKind.Video
&& RunTimeTicks
&& !StartDate && <EndsAt runTimeTicks={RunTimeTicks} />}

View file

@ -1,22 +1,25 @@
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
import * as userSettings from 'scripts/settings/userSettings';
import datetime from 'scripts/datetime';
import globalize from 'lib/globalize';
import itemHelper from '../itemHelper';
import { ItemKind } from 'types/base/models/item-kind';
import { ItemMediaKind } from 'types/base/models/item-media-kind';
import { ItemStatus } from 'types/base/models/item-status';
import type { NullableNumber, NullableString } from 'types/base/common/shared/types';
import type { ItemDto } from 'types/base/models/item-dto';
import type { MiscInfo } from 'types/mediaInfoItem';
function shouldShowFolderRuntime(
itemType: NullableString,
itemMediaType: NullableString
itemType: ItemKind,
itemMediaType: ItemMediaKind
): boolean {
return (
itemType === BaseItemKind.MusicAlbum
|| itemMediaType === 'MusicArtist'
|| itemType === BaseItemKind.Playlist
|| itemMediaType === 'Playlist'
|| itemMediaType === 'MusicGenre'
itemType === ItemKind.MusicAlbum
|| itemMediaType === ItemMediaKind.MusicArtist
|| itemType === ItemKind.Playlist
|| itemMediaType === ItemMediaKind.Playlist
|| itemMediaType === ItemMediaKind.MusicGenre
);
}
@ -37,7 +40,7 @@ function addTrackCountOrItemCount(
if (itemRunTimeTicks) {
addMiscInfo({ text: datetime.getDisplayDuration(itemRunTimeTicks) });
}
} else if (itemType === BaseItemKind.PhotoAlbum || itemType === BaseItemKind.BoxSet) {
} else if (itemType === ItemKind.PhotoAlbum || itemType === ItemKind.BoxSet) {
const count = itemChildCount;
if (count) {
addMiscInfo({ text: globalize.translate('ItemCount', count) });
@ -46,22 +49,22 @@ function addTrackCountOrItemCount(
}
function addOriginalAirDateInfo(
itemType: NullableString,
itemMediaType: NullableString,
itemType: ItemKind,
itemMediaType: ItemMediaKind,
isOriginalAirDateEnabled: boolean,
itemPremiereDate: NullableString,
addMiscInfo: (val: MiscInfo) => void
): void {
if (
itemPremiereDate
&& (itemType === BaseItemKind.Episode || itemMediaType === 'Photo')
&& (itemType === ItemKind.Episode || itemMediaType === ItemMediaKind.Photo)
&& isOriginalAirDateEnabled
) {
try {
//don't modify date to locale if episode. Only Dates (not times) are stored, or editable in the edit metadata dialog
const date = datetime.parseISO8601Date(
itemPremiereDate,
itemType !== BaseItemKind.Episode
itemType !== ItemKind.Episode
);
addMiscInfo({ text: datetime.toLocaleDateString(date) });
} catch (e) {
@ -71,14 +74,14 @@ function addOriginalAirDateInfo(
}
function addSeriesTimerInfo(
itemType: NullableString,
itemType: ItemKind,
itemRecordAnyTime: boolean | undefined,
itemStartDate: NullableString,
itemRecordAnyChannel: boolean | undefined,
itemChannelName: NullableString,
addMiscInfo: (val: MiscInfo) => void
): void {
if (itemType === 'SeriesTimer') {
if (itemType === ItemKind.SeriesTimer) {
if (itemRecordAnyTime) {
addMiscInfo({ text: globalize.translate('Anytime') });
} else {
@ -145,9 +148,9 @@ function addProgramIndicators(
isEpisodeTitleIndexNumberEnabled: boolean,
addMiscInfo: (val: MiscInfo) => void
): void {
if (item.Type === BaseItemKind.Program || item.Type === 'Timer') {
if (item.Type === ItemKind.Program || item.Type === ItemKind.Timer) {
let program = item;
if (item.Type === 'Timer' && item.ProgramInfo) {
if (item.Type === ItemKind.Timer && item.ProgramInfo) {
program = item.ProgramInfo;
}
@ -205,20 +208,20 @@ function addProgramTextInfo(
function addStartDateInfo(
itemStartDate: NullableString,
itemType: NullableString,
itemType: ItemKind,
addMiscInfo: (val: MiscInfo) => void
): void {
if (
itemStartDate
&& itemType !== BaseItemKind.Program
&& itemType !== 'SeriesTimer'
&& itemType !== 'Timer'
&& itemType !== ItemKind.Program
&& itemType !== ItemKind.SeriesTimer
&& itemType !== ItemKind.Timer
) {
try {
const date = datetime.parseISO8601Date(itemStartDate);
addMiscInfo({ text: datetime.toLocaleDateString(date) });
if (itemType !== BaseItemKind.Recording) {
if (itemType !== ItemKind.Recording) {
addMiscInfo({ text: datetime.getDisplayTime(date) });
}
} catch (e) {
@ -229,14 +232,14 @@ function addStartDateInfo(
function addSeriesProductionYearInfo(
itemProductionYear: NullableNumber,
itemType: NullableString,
itemType: ItemKind,
isYearEnabled: boolean,
itemStatus: NullableString,
itemStatus: ItemStatus,
itemEndDate: NullableString,
addMiscInfo: (val: MiscInfo) => void
): void {
if (itemProductionYear && isYearEnabled && itemType === BaseItemKind.Series) {
if (itemStatus === 'Continuing') {
if (itemProductionYear && isYearEnabled && itemType === ItemKind.Series) {
if (itemStatus === ItemStatus.Continuing) {
addMiscInfo({
text: globalize.translate(
'SeriesYearToPresent',
@ -279,20 +282,20 @@ function addproductionYearWithEndDate(
function addYearInfo(
isYearEnabled: boolean,
itemType: NullableString,
itemMediaType: NullableString,
itemType: ItemKind,
itemMediaType: ItemMediaKind,
itemProductionYear: NullableNumber,
itemPremiereDate: NullableString,
addMiscInfo: (val: MiscInfo) => void
): void {
if (
isYearEnabled
&& itemType !== BaseItemKind.Series
&& itemType !== BaseItemKind.Episode
&& itemType !== BaseItemKind.Person
&& itemMediaType !== 'Photo'
&& itemType !== BaseItemKind.Program
&& itemType !== BaseItemKind.Season
&& itemType !== ItemKind.Series
&& itemType !== ItemKind.Episode
&& itemType !== ItemKind.Person
&& itemMediaType !== ItemMediaKind.Photo
&& itemType !== ItemKind.Program
&& itemType !== ItemKind.Season
) {
if (itemProductionYear) {
addMiscInfo({ text: itemProductionYear });
@ -321,21 +324,21 @@ function addVideo3DFormat(
function addRunTimeInfo(
itemRunTimeTicks: NullableNumber,
itemType: NullableString,
itemType: ItemKind,
showFolderRuntime: boolean,
isRuntimeEnabled: boolean,
addMiscInfo: (val: MiscInfo) => void
): void {
if (
itemRunTimeTicks
&& itemType !== BaseItemKind.Series
&& itemType !== BaseItemKind.Program
&& itemType !== 'Timer'
&& itemType !== BaseItemKind.Book
&& itemType !== ItemKind.Series
&& itemType !== ItemKind.Program
&& itemType !== ItemKind.Timer
&& itemType !== ItemKind.Book
&& !showFolderRuntime
&& isRuntimeEnabled
) {
if (itemType === BaseItemKind.Audio) {
if (itemType === ItemKind.Audio) {
addMiscInfo({ text: datetime.getDisplayRunningTime(itemRunTimeTicks) });
} else {
addMiscInfo({ text: datetime.getDisplayDuration(itemRunTimeTicks) });
@ -345,15 +348,15 @@ function addRunTimeInfo(
function addOfficialRatingInfo(
itemOfficialRating: NullableString,
itemType: NullableString,
itemType: ItemKind,
isOfficialRatingEnabled: boolean,
addMiscInfo: (val: MiscInfo) => void
): void {
if (
itemOfficialRating
&& isOfficialRatingEnabled
&& itemType !== BaseItemKind.Season
&& itemType !== BaseItemKind.Episode
&& itemType !== ItemKind.Season
&& itemType !== ItemKind.Episode
) {
addMiscInfo({
text: itemOfficialRating,
@ -365,21 +368,21 @@ function addOfficialRatingInfo(
function addAudioContainer(
itemContainer: NullableString,
isContainerEnabled: boolean,
itemType: NullableString,
itemType: ItemKind,
addMiscInfo: (val: MiscInfo) => void
): void {
if (itemContainer && isContainerEnabled && itemType === BaseItemKind.Audio) {
if (itemContainer && isContainerEnabled && itemType === ItemKind.Audio) {
addMiscInfo({ text: itemContainer });
}
}
function addPhotoSize(
itemMediaType: NullableString,
itemMediaType: ItemMediaKind,
itemWidth: NullableNumber,
itemHeight: NullableNumber,
addMiscInfo: (val: MiscInfo) => void
): void {
if (itemMediaType === 'Photo' && itemWidth && itemHeight) {
if (itemMediaType === ItemMediaKind.Photo && itemWidth && itemHeight) {
const size = `${itemWidth}x${itemHeight}`;
addMiscInfo({ text: size });