2024-01-31 03:01:58 +03:00
|
|
|
import * as userSettings from 'scripts/settings/userSettings';
|
|
|
|
import datetime from 'scripts/datetime';
|
2024-08-14 13:31:34 -04:00
|
|
|
import globalize from 'lib/globalize';
|
2024-01-31 03:01:58 +03:00
|
|
|
import itemHelper from '../itemHelper';
|
2024-08-21 03:27:03 +03:00
|
|
|
|
|
|
|
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';
|
2024-02-29 04:22:13 +03:00
|
|
|
import type { NullableNumber, NullableString } from 'types/base/common/shared/types';
|
2024-03-03 01:31:35 +03:00
|
|
|
import type { ItemDto } from 'types/base/models/item-dto';
|
2024-01-31 03:01:58 +03:00
|
|
|
import type { MiscInfo } from 'types/mediaInfoItem';
|
2024-08-10 04:09:59 +03:00
|
|
|
import { PrimaryInfoOpts } from './type';
|
2024-01-31 03:01:58 +03:00
|
|
|
|
|
|
|
function shouldShowFolderRuntime(
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType: ItemKind,
|
|
|
|
itemMediaType: ItemMediaKind
|
2024-01-31 03:01:58 +03:00
|
|
|
): boolean {
|
|
|
|
return (
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType === ItemKind.MusicAlbum
|
|
|
|
|| itemMediaType === ItemMediaKind.MusicArtist
|
|
|
|
|| itemType === ItemKind.Playlist
|
|
|
|
|| itemMediaType === ItemMediaKind.Playlist
|
|
|
|
|| itemMediaType === ItemMediaKind.MusicGenre
|
2024-01-31 03:01:58 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function addTrackCountOrItemCount(
|
|
|
|
showFolderRuntime: boolean,
|
|
|
|
itemSongCount: NullableNumber,
|
|
|
|
itemChildCount: NullableNumber,
|
|
|
|
itemRunTimeTicks: NullableNumber,
|
2024-08-10 04:09:59 +03:00
|
|
|
itemType: ItemKind,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
|
|
|
if (showFolderRuntime) {
|
|
|
|
const count = itemSongCount ?? itemChildCount;
|
|
|
|
if (count) {
|
|
|
|
addMiscInfo({ text: globalize.translate('TrackCount', count) });
|
|
|
|
}
|
|
|
|
|
|
|
|
if (itemRunTimeTicks) {
|
|
|
|
addMiscInfo({ text: datetime.getDisplayDuration(itemRunTimeTicks) });
|
|
|
|
}
|
2024-08-21 03:27:03 +03:00
|
|
|
} else if (itemType === ItemKind.PhotoAlbum || itemType === ItemKind.BoxSet) {
|
2024-01-31 03:01:58 +03:00
|
|
|
const count = itemChildCount;
|
|
|
|
if (count) {
|
|
|
|
addMiscInfo({ text: globalize.translate('ItemCount', count) });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addOriginalAirDateInfo(
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType: ItemKind,
|
|
|
|
itemMediaType: ItemMediaKind,
|
2024-08-10 04:09:59 +03:00
|
|
|
showOriginalAirDateInfo: boolean,
|
2024-01-31 03:01:58 +03:00
|
|
|
itemPremiereDate: NullableString,
|
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
|
|
|
if (
|
|
|
|
itemPremiereDate
|
2024-08-21 03:27:03 +03:00
|
|
|
&& (itemType === ItemKind.Episode || itemMediaType === ItemMediaKind.Photo)
|
2024-08-10 04:09:59 +03:00
|
|
|
&& showOriginalAirDateInfo
|
2024-01-31 03:01:58 +03:00
|
|
|
) {
|
|
|
|
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,
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType !== ItemKind.Episode
|
2024-01-31 03:01:58 +03:00
|
|
|
);
|
|
|
|
addMiscInfo({ text: datetime.toLocaleDateString(date) });
|
|
|
|
} catch (e) {
|
|
|
|
console.error('error parsing date:', itemPremiereDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addSeriesTimerInfo(
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType: ItemKind,
|
2024-01-31 03:01:58 +03:00
|
|
|
itemRecordAnyTime: boolean | undefined,
|
|
|
|
itemStartDate: NullableString,
|
|
|
|
itemRecordAnyChannel: boolean | undefined,
|
|
|
|
itemChannelName: NullableString,
|
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
2024-08-21 03:27:03 +03:00
|
|
|
if (itemType === ItemKind.SeriesTimer) {
|
2024-01-31 03:01:58 +03:00
|
|
|
if (itemRecordAnyTime) {
|
|
|
|
addMiscInfo({ text: globalize.translate('Anytime') });
|
|
|
|
} else {
|
|
|
|
addMiscInfo({ text: datetime.getDisplayTime(itemStartDate) });
|
|
|
|
}
|
|
|
|
|
|
|
|
if (itemRecordAnyChannel) {
|
|
|
|
addMiscInfo({ text: globalize.translate('AllChannels') });
|
|
|
|
} else {
|
|
|
|
addMiscInfo({
|
|
|
|
text: itemChannelName ?? globalize.translate('OneChannel')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addProgramIndicatorInfo(
|
|
|
|
program: ItemDto | undefined,
|
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
|
|
|
if (
|
|
|
|
program?.IsLive
|
2024-08-10 04:09:59 +03:00
|
|
|
&& userSettings.get('guide-indicator-live') === 'true'
|
2024-01-31 03:01:58 +03:00
|
|
|
) {
|
|
|
|
addMiscInfo({
|
|
|
|
text: globalize.translate('Live'),
|
|
|
|
cssClass: 'mediaInfoProgramAttribute liveTvProgram'
|
|
|
|
});
|
|
|
|
} else if (
|
|
|
|
program?.IsPremiere
|
2024-08-10 04:09:59 +03:00
|
|
|
&& userSettings.get('guide-indicator-premiere') === 'true'
|
2024-01-31 03:01:58 +03:00
|
|
|
) {
|
|
|
|
addMiscInfo({
|
|
|
|
text: globalize.translate('Premiere'),
|
|
|
|
cssClass: 'mediaInfoProgramAttribute premiereTvProgram'
|
|
|
|
});
|
|
|
|
} else if (
|
|
|
|
program?.IsSeries
|
|
|
|
&& !program?.IsRepeat
|
2024-08-10 04:09:59 +03:00
|
|
|
&& userSettings.get('guide-indicator-new') === 'true'
|
2024-01-31 03:01:58 +03:00
|
|
|
) {
|
|
|
|
addMiscInfo({
|
|
|
|
text: globalize.translate('New'),
|
|
|
|
cssClass: 'mediaInfoProgramAttribute newTvProgram'
|
|
|
|
});
|
|
|
|
} else if (
|
|
|
|
program?.IsSeries
|
|
|
|
&& program?.IsRepeat
|
2024-08-10 04:09:59 +03:00
|
|
|
&& userSettings.get('guide-indicator-repeat') === 'true'
|
2024-01-31 03:01:58 +03:00
|
|
|
) {
|
|
|
|
addMiscInfo({
|
|
|
|
text: globalize.translate('Repeat'),
|
|
|
|
cssClass: 'mediaInfoProgramAttribute repeatTvProgram'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addProgramIndicators(
|
|
|
|
item: ItemDto,
|
2024-08-10 04:09:59 +03:00
|
|
|
showYearInfo: boolean,
|
|
|
|
showEpisodeTitleInfo: boolean,
|
|
|
|
showOriginalAirDateInfo: boolean,
|
|
|
|
showProgramIndicatorInfo: boolean,
|
|
|
|
includeEpisodeTitleIndexNumber: boolean,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
2024-08-21 03:27:03 +03:00
|
|
|
if (item.Type === ItemKind.Program || item.Type === ItemKind.Timer) {
|
2024-01-31 03:01:58 +03:00
|
|
|
let program = item;
|
2024-08-21 03:27:03 +03:00
|
|
|
if (item.Type === ItemKind.Timer && item.ProgramInfo) {
|
2024-01-31 03:01:58 +03:00
|
|
|
program = item.ProgramInfo;
|
|
|
|
}
|
|
|
|
|
2024-08-10 04:09:59 +03:00
|
|
|
if (showProgramIndicatorInfo !== false) {
|
2024-01-31 03:01:58 +03:00
|
|
|
addProgramIndicatorInfo(program, addMiscInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
addProgramTextInfo(
|
|
|
|
program,
|
2024-08-10 04:09:59 +03:00
|
|
|
showEpisodeTitleInfo,
|
|
|
|
includeEpisodeTitleIndexNumber,
|
|
|
|
showOriginalAirDateInfo,
|
|
|
|
showYearInfo,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addProgramTextInfo(
|
|
|
|
program: ItemDto,
|
2024-08-10 04:09:59 +03:00
|
|
|
showEpisodeTitleInfo: boolean,
|
|
|
|
includeEpisodeTitleIndexNumber: boolean,
|
|
|
|
showOriginalAirDateInfo: boolean,
|
|
|
|
showYearInfo: boolean,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
2024-08-10 04:09:59 +03:00
|
|
|
if (
|
|
|
|
(program?.IsSeries || program?.EpisodeTitle)
|
|
|
|
&& showEpisodeTitleInfo !== false
|
|
|
|
) {
|
2024-01-31 03:01:58 +03:00
|
|
|
const text = itemHelper.getDisplayName(program, {
|
2024-08-10 04:09:59 +03:00
|
|
|
includeIndexNumber: includeEpisodeTitleIndexNumber
|
2024-01-31 03:01:58 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
if (text) {
|
|
|
|
addMiscInfo({ text: text });
|
|
|
|
}
|
|
|
|
} else if (
|
|
|
|
program?.ProductionYear
|
2024-08-10 04:09:59 +03:00
|
|
|
&& ((program?.IsMovie && showOriginalAirDateInfo !== false)
|
|
|
|
|| showYearInfo !== false)
|
2024-01-31 03:01:58 +03:00
|
|
|
) {
|
|
|
|
addMiscInfo({ text: program.ProductionYear });
|
2024-08-10 04:09:59 +03:00
|
|
|
} else if (program?.PremiereDate && showOriginalAirDateInfo !== false) {
|
2024-01-31 03:01:58 +03:00
|
|
|
try {
|
|
|
|
const date = datetime.parseISO8601Date(program.PremiereDate);
|
|
|
|
const text = globalize.translate(
|
|
|
|
'OriginalAirDateValue',
|
|
|
|
datetime.toLocaleDateString(date)
|
|
|
|
);
|
|
|
|
addMiscInfo({ text: text });
|
|
|
|
} catch (e) {
|
|
|
|
console.error('error parsing date:', program.PremiereDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addStartDateInfo(
|
|
|
|
itemStartDate: NullableString,
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType: ItemKind,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
|
|
|
if (
|
|
|
|
itemStartDate
|
2024-08-21 03:27:03 +03:00
|
|
|
&& itemType !== ItemKind.Program
|
|
|
|
&& itemType !== ItemKind.SeriesTimer
|
|
|
|
&& itemType !== ItemKind.Timer
|
2024-01-31 03:01:58 +03:00
|
|
|
) {
|
|
|
|
try {
|
|
|
|
const date = datetime.parseISO8601Date(itemStartDate);
|
|
|
|
addMiscInfo({ text: datetime.toLocaleDateString(date) });
|
|
|
|
|
2024-08-21 03:27:03 +03:00
|
|
|
if (itemType !== ItemKind.Recording) {
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo({ text: datetime.getDisplayTime(date) });
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
console.error('error parsing date:', itemStartDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addSeriesProductionYearInfo(
|
|
|
|
itemProductionYear: NullableNumber,
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType: ItemKind,
|
2024-08-10 04:09:59 +03:00
|
|
|
showYearInfo: boolean,
|
2024-08-21 03:27:03 +03:00
|
|
|
itemStatus: ItemStatus,
|
2024-01-31 03:01:58 +03:00
|
|
|
itemEndDate: NullableString,
|
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
2024-08-10 04:09:59 +03:00
|
|
|
if (itemProductionYear && showYearInfo && itemType === ItemKind.Series) {
|
2024-08-21 03:27:03 +03:00
|
|
|
if (itemStatus === ItemStatus.Continuing) {
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo({
|
|
|
|
text: globalize.translate(
|
|
|
|
'SeriesYearToPresent',
|
|
|
|
datetime.toLocaleString(itemProductionYear, {
|
|
|
|
useGrouping: false
|
|
|
|
})
|
|
|
|
)
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
addproductionYearWithEndDate(itemProductionYear, itemEndDate, addMiscInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addproductionYearWithEndDate(
|
|
|
|
itemProductionYear: number,
|
|
|
|
itemEndDate: NullableString,
|
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
|
|
|
let productionYear = datetime.toLocaleString(itemProductionYear, {
|
|
|
|
useGrouping: false
|
|
|
|
});
|
|
|
|
|
|
|
|
if (itemEndDate) {
|
|
|
|
try {
|
|
|
|
const endYear = datetime.toLocaleString(
|
|
|
|
datetime.parseISO8601Date(itemEndDate).getFullYear(),
|
|
|
|
{ useGrouping: false }
|
|
|
|
);
|
|
|
|
/* At this point, text will contain only the start year */
|
|
|
|
if (endYear !== itemProductionYear) {
|
|
|
|
productionYear += `-${endYear}`;
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
console.error('error parsing date:', itemEndDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
addMiscInfo({ text: productionYear });
|
|
|
|
}
|
|
|
|
|
|
|
|
function addYearInfo(
|
2024-08-10 04:09:59 +03:00
|
|
|
showYearInfo: boolean,
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType: ItemKind,
|
|
|
|
itemMediaType: ItemMediaKind,
|
2024-01-31 03:01:58 +03:00
|
|
|
itemProductionYear: NullableNumber,
|
|
|
|
itemPremiereDate: NullableString,
|
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
|
|
|
if (
|
2024-08-10 04:09:59 +03:00
|
|
|
showYearInfo
|
2024-08-21 03:27:03 +03:00
|
|
|
&& itemType !== ItemKind.Series
|
|
|
|
&& itemType !== ItemKind.Episode
|
|
|
|
&& itemType !== ItemKind.Person
|
|
|
|
&& itemMediaType !== ItemMediaKind.Photo
|
|
|
|
&& itemType !== ItemKind.Program
|
|
|
|
&& itemType !== ItemKind.Season
|
2024-01-31 03:01:58 +03:00
|
|
|
) {
|
|
|
|
if (itemProductionYear) {
|
|
|
|
addMiscInfo({ text: itemProductionYear });
|
|
|
|
} else if (itemPremiereDate) {
|
|
|
|
try {
|
|
|
|
const text = datetime.toLocaleString(
|
|
|
|
datetime.parseISO8601Date(itemPremiereDate).getFullYear(),
|
|
|
|
{ useGrouping: false }
|
|
|
|
);
|
|
|
|
addMiscInfo({ text: text });
|
|
|
|
} catch (e) {
|
|
|
|
console.error('error parsing date:', itemPremiereDate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addVideo3DFormat(
|
|
|
|
itemVideo3DFormat: NullableString,
|
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
|
|
|
if (itemVideo3DFormat) {
|
|
|
|
addMiscInfo({ text: '3D' });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addRunTimeInfo(
|
|
|
|
itemRunTimeTicks: NullableNumber,
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType: ItemKind,
|
2024-01-31 03:01:58 +03:00
|
|
|
showFolderRuntime: boolean,
|
2024-08-10 04:09:59 +03:00
|
|
|
showRuntimeInfo: boolean,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
|
|
|
if (
|
|
|
|
itemRunTimeTicks
|
2024-08-21 03:27:03 +03:00
|
|
|
&& itemType !== ItemKind.Series
|
|
|
|
&& itemType !== ItemKind.Program
|
|
|
|
&& itemType !== ItemKind.Timer
|
|
|
|
&& itemType !== ItemKind.Book
|
2024-01-31 03:01:58 +03:00
|
|
|
&& !showFolderRuntime
|
2024-08-10 04:09:59 +03:00
|
|
|
&& showRuntimeInfo
|
2024-01-31 03:01:58 +03:00
|
|
|
) {
|
2024-08-21 03:27:03 +03:00
|
|
|
if (itemType === ItemKind.Audio) {
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo({ text: datetime.getDisplayRunningTime(itemRunTimeTicks) });
|
|
|
|
} else {
|
|
|
|
addMiscInfo({ text: datetime.getDisplayDuration(itemRunTimeTicks) });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addOfficialRatingInfo(
|
|
|
|
itemOfficialRating: NullableString,
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType: ItemKind,
|
2024-08-10 04:09:59 +03:00
|
|
|
showOfficialRatingInfo: boolean,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
|
|
|
if (
|
|
|
|
itemOfficialRating
|
2024-08-10 04:09:59 +03:00
|
|
|
&& showOfficialRatingInfo
|
2024-08-21 03:27:03 +03:00
|
|
|
&& itemType !== ItemKind.Season
|
|
|
|
&& itemType !== ItemKind.Episode
|
2024-01-31 03:01:58 +03:00
|
|
|
) {
|
|
|
|
addMiscInfo({
|
|
|
|
text: itemOfficialRating,
|
2024-08-10 04:09:59 +03:00
|
|
|
cssClass: 'mediaInfoText mediaInfoOfficialRating'
|
2024-01-31 03:01:58 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addAudioContainer(
|
|
|
|
itemContainer: NullableString,
|
2024-08-10 04:09:59 +03:00
|
|
|
showAudioContainerInfo: boolean,
|
2024-08-21 03:27:03 +03:00
|
|
|
itemType: ItemKind,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
2024-08-10 04:09:59 +03:00
|
|
|
if (
|
|
|
|
itemContainer
|
|
|
|
&& showAudioContainerInfo
|
|
|
|
&& itemType === ItemKind.Audio
|
|
|
|
) {
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo({ text: itemContainer });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addPhotoSize(
|
2024-08-21 03:27:03 +03:00
|
|
|
itemMediaType: ItemMediaKind,
|
2024-01-31 03:01:58 +03:00
|
|
|
itemWidth: NullableNumber,
|
|
|
|
itemHeight: NullableNumber,
|
|
|
|
addMiscInfo: (val: MiscInfo) => void
|
|
|
|
): void {
|
2024-08-21 03:27:03 +03:00
|
|
|
if (itemMediaType === ItemMediaKind.Photo && itemWidth && itemHeight) {
|
2024-01-31 03:01:58 +03:00
|
|
|
const size = `${itemWidth}x${itemHeight}`;
|
|
|
|
|
|
|
|
addMiscInfo({ text: size });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-10 04:09:59 +03:00
|
|
|
interface UsePrimaryMediaInfoProps extends PrimaryInfoOpts {
|
2024-01-31 03:01:58 +03:00
|
|
|
item: ItemDto;
|
|
|
|
}
|
|
|
|
|
|
|
|
function usePrimaryMediaInfo({
|
|
|
|
item,
|
2024-08-10 04:09:59 +03:00
|
|
|
showYearInfo = false,
|
|
|
|
showAudioContainerInfo = false,
|
|
|
|
showEpisodeTitleInfo = false,
|
|
|
|
showOriginalAirDateInfo = false,
|
|
|
|
showRuntimeInfo = false,
|
|
|
|
showProgramIndicatorInfo = false,
|
|
|
|
includeEpisodeTitleIndexNumber = false,
|
|
|
|
showOfficialRatingInfo = false
|
2024-01-31 03:01:58 +03:00
|
|
|
}: UsePrimaryMediaInfoProps) {
|
|
|
|
const {
|
|
|
|
EndDate,
|
|
|
|
Status,
|
|
|
|
StartDate,
|
|
|
|
ProductionYear,
|
|
|
|
Video3DFormat,
|
|
|
|
Type,
|
|
|
|
Width,
|
|
|
|
Height,
|
|
|
|
MediaType,
|
|
|
|
SongCount,
|
|
|
|
RecordAnyTime,
|
|
|
|
RecordAnyChannel,
|
|
|
|
ChannelName,
|
|
|
|
ChildCount,
|
|
|
|
RunTimeTicks,
|
|
|
|
PremiereDate,
|
|
|
|
OfficialRating,
|
|
|
|
Container
|
|
|
|
} = item;
|
|
|
|
|
|
|
|
const miscInfo: MiscInfo[] = [];
|
|
|
|
|
|
|
|
const addMiscInfo = (val: MiscInfo) => {
|
|
|
|
if (val) {
|
|
|
|
miscInfo.push(val);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const showFolderRuntime = shouldShowFolderRuntime(Type, MediaType);
|
|
|
|
|
|
|
|
addTrackCountOrItemCount(
|
|
|
|
showFolderRuntime,
|
|
|
|
SongCount,
|
|
|
|
ChildCount,
|
|
|
|
RunTimeTicks,
|
|
|
|
Type,
|
|
|
|
addMiscInfo
|
|
|
|
);
|
|
|
|
|
|
|
|
addOriginalAirDateInfo(
|
|
|
|
Type,
|
|
|
|
MediaType,
|
2024-08-10 04:09:59 +03:00
|
|
|
showOriginalAirDateInfo,
|
2024-01-31 03:01:58 +03:00
|
|
|
PremiereDate,
|
|
|
|
addMiscInfo
|
|
|
|
);
|
|
|
|
|
|
|
|
addSeriesTimerInfo(
|
|
|
|
Type,
|
|
|
|
RecordAnyTime,
|
|
|
|
StartDate,
|
|
|
|
RecordAnyChannel,
|
|
|
|
ChannelName,
|
|
|
|
addMiscInfo
|
|
|
|
);
|
|
|
|
|
|
|
|
addStartDateInfo(StartDate, Type, addMiscInfo);
|
|
|
|
|
|
|
|
addSeriesProductionYearInfo(
|
|
|
|
ProductionYear,
|
|
|
|
Type,
|
2024-08-10 04:09:59 +03:00
|
|
|
showYearInfo,
|
2024-01-31 03:01:58 +03:00
|
|
|
Status,
|
|
|
|
EndDate,
|
|
|
|
addMiscInfo
|
|
|
|
);
|
|
|
|
|
|
|
|
addProgramIndicators(
|
|
|
|
item,
|
2024-08-10 04:09:59 +03:00
|
|
|
showProgramIndicatorInfo,
|
|
|
|
showEpisodeTitleInfo,
|
|
|
|
includeEpisodeTitleIndexNumber,
|
|
|
|
showOriginalAirDateInfo,
|
|
|
|
showYearInfo,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo
|
|
|
|
);
|
|
|
|
|
|
|
|
addYearInfo(
|
2024-08-10 04:09:59 +03:00
|
|
|
showYearInfo,
|
2024-01-31 03:01:58 +03:00
|
|
|
Type,
|
|
|
|
MediaType,
|
|
|
|
ProductionYear,
|
|
|
|
PremiereDate,
|
|
|
|
addMiscInfo
|
|
|
|
);
|
|
|
|
|
|
|
|
addRunTimeInfo(
|
|
|
|
RunTimeTicks,
|
|
|
|
Type,
|
|
|
|
showFolderRuntime,
|
2024-08-10 04:09:59 +03:00
|
|
|
showRuntimeInfo,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo
|
|
|
|
);
|
|
|
|
|
|
|
|
addOfficialRatingInfo(
|
|
|
|
OfficialRating,
|
|
|
|
Type,
|
2024-08-10 04:09:59 +03:00
|
|
|
showOfficialRatingInfo,
|
2024-01-31 03:01:58 +03:00
|
|
|
addMiscInfo
|
|
|
|
);
|
|
|
|
|
|
|
|
addVideo3DFormat(Video3DFormat, addMiscInfo);
|
|
|
|
|
|
|
|
addPhotoSize(MediaType, Width, Height, addMiscInfo);
|
|
|
|
|
2024-08-10 04:09:59 +03:00
|
|
|
addAudioContainer(Container, showAudioContainerInfo, Type, addMiscInfo);
|
2024-01-31 03:01:58 +03:00
|
|
|
|
|
|
|
return miscInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default usePrimaryMediaInfo;
|