mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add livetv view
This commit is contained in:
parent
c37783479e
commit
e41436552e
44 changed files with 1396 additions and 749 deletions
367
src/utils/sections.ts
Normal file
367
src/utils/sections.ts
Normal file
|
@ -0,0 +1,367 @@
|
|||
import { ImageType, ItemFields, ItemFilter } from '@jellyfin/sdk/lib/generated-client';
|
||||
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
|
||||
import { ItemSortBy } from '@jellyfin/sdk/lib/models/api/item-sort-by';
|
||||
import { SortOrder } from '@jellyfin/sdk/lib/generated-client/models/sort-order';
|
||||
import * as userSettings from 'scripts/settings/userSettings';
|
||||
import { Section, SectionType, SectionApiMethod } from 'types/sections';
|
||||
|
||||
export const getSuggestionSections = (): Section[] => {
|
||||
const parametersOptions = {
|
||||
fields: [ItemFields.PrimaryImageAspectRatio],
|
||||
filters: [ItemFilter.IsPlayed],
|
||||
IsPlayed: true,
|
||||
imageTypeLimit: 1,
|
||||
enableImageTypes: [
|
||||
ImageType.Primary,
|
||||
ImageType.Backdrop,
|
||||
ImageType.Thumb
|
||||
]
|
||||
};
|
||||
return [
|
||||
{
|
||||
name: 'HeaderContinueWatching',
|
||||
apiMethod: SectionApiMethod.ResumeItems,
|
||||
itemTypes: 'Movie',
|
||||
type: SectionType.ContinueWatchingMovies,
|
||||
parametersOptions: {
|
||||
includeItemTypes: [BaseItemKind.Movie]
|
||||
},
|
||||
cardOptions: {
|
||||
overlayPlayButton: true,
|
||||
preferThumb: true,
|
||||
shape: 'overflowBackdrop',
|
||||
showYear: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'HeaderLatestMovies',
|
||||
apiMethod: SectionApiMethod.LatestMedia,
|
||||
itemTypes: 'Movie',
|
||||
type: SectionType.LatestMovies,
|
||||
parametersOptions: {
|
||||
includeItemTypes: [BaseItemKind.Movie]
|
||||
},
|
||||
cardOptions: {
|
||||
overlayPlayButton: true,
|
||||
shape: 'overflowPortrait',
|
||||
showYear: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'HeaderContinueWatching',
|
||||
apiMethod: SectionApiMethod.ResumeItems,
|
||||
itemTypes: 'Episode',
|
||||
type: SectionType.ContinueWatchingEpisode,
|
||||
parametersOptions: {
|
||||
includeItemTypes: [BaseItemKind.Episode]
|
||||
},
|
||||
cardOptions: {
|
||||
overlayPlayButton: true,
|
||||
shape: 'overflowBackdrop',
|
||||
preferThumb: true,
|
||||
inheritThumb:
|
||||
!userSettings.useEpisodeImagesInNextUpAndResume(undefined),
|
||||
showYear: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'HeaderLatestEpisodes',
|
||||
apiMethod: SectionApiMethod.LatestMedia,
|
||||
itemTypes: 'Episode',
|
||||
type: SectionType.LatestEpisode,
|
||||
parametersOptions: {
|
||||
includeItemTypes: [BaseItemKind.Episode]
|
||||
},
|
||||
cardOptions: {
|
||||
overlayPlayButton: true,
|
||||
shape: 'overflowBackdrop',
|
||||
preferThumb: true,
|
||||
showSeriesYear: true,
|
||||
showParentTitle: true,
|
||||
showUnplayedIndicator: false,
|
||||
showChildCountIndicator: true,
|
||||
lines: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'NextUp',
|
||||
apiMethod: SectionApiMethod.NextUp,
|
||||
itemTypes: 'nextup',
|
||||
type: SectionType.NextUp,
|
||||
cardOptions: {
|
||||
overlayPlayButton: true,
|
||||
shape: 'overflowBackdrop',
|
||||
preferThumb: true,
|
||||
inheritThumb:
|
||||
!userSettings.useEpisodeImagesInNextUpAndResume(undefined),
|
||||
showParentTitle: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'HeaderLatestMusic',
|
||||
apiMethod: SectionApiMethod.LatestMedia,
|
||||
itemTypes: 'Audio',
|
||||
type: SectionType.LatestMusic,
|
||||
parametersOptions: {
|
||||
includeItemTypes: [BaseItemKind.Audio]
|
||||
},
|
||||
cardOptions: {
|
||||
showUnplayedIndicator: false,
|
||||
shape: 'overflowSquare',
|
||||
showParentTitle: true,
|
||||
overlayPlayButton: true,
|
||||
coverImage: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'HeaderRecentlyPlayed',
|
||||
itemTypes: 'Audio',
|
||||
type: SectionType.RecentlyPlayedMusic,
|
||||
parametersOptions: {
|
||||
sortBy: [ItemSortBy.DatePlayed],
|
||||
sortOrder: [SortOrder.Descending],
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
...parametersOptions
|
||||
},
|
||||
cardOptions: {
|
||||
showUnplayedIndicator: false,
|
||||
shape: 'overflowSquare',
|
||||
showParentTitle: true,
|
||||
action: 'instantmix',
|
||||
overlayMoreButton: true,
|
||||
coverImage: true
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'HeaderFrequentlyPlayed',
|
||||
itemTypes: 'Audio',
|
||||
type: SectionType.FrequentlyPlayedMusic,
|
||||
parametersOptions: {
|
||||
sortBy: [ItemSortBy.PlayCount],
|
||||
sortOrder: [SortOrder.Descending],
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
...parametersOptions
|
||||
},
|
||||
cardOptions: {
|
||||
showUnplayedIndicator: false,
|
||||
shape: 'overflowSquare',
|
||||
showParentTitle: true,
|
||||
action: 'instantmix',
|
||||
overlayMoreButton: true,
|
||||
coverImage: true
|
||||
}
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
export const getProgramSections = (): Section[] => {
|
||||
const cardOptions = {
|
||||
inheritThumb: false,
|
||||
shape: 'autooverflow',
|
||||
defaultShape: 'overflowBackdrop',
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
lazy: true,
|
||||
showAirTime: true
|
||||
};
|
||||
|
||||
return [
|
||||
{
|
||||
name: 'HeaderOnNow',
|
||||
itemTypes: 'Programs',
|
||||
apiMethod: SectionApiMethod.RecommendedPrograms,
|
||||
type: SectionType.ActivePrograms,
|
||||
parametersOptions: {
|
||||
isAiring: true
|
||||
},
|
||||
cardOptions: {
|
||||
showParentTitle: true,
|
||||
showTitle: true,
|
||||
showAirDateTime: false,
|
||||
showAirEndTime: true,
|
||||
overlayPlayButton: true,
|
||||
overlayMoreButton: false,
|
||||
overlayInfoButton: false,
|
||||
preferThumb: 'auto',
|
||||
...cardOptions
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Shows',
|
||||
itemTypes: 'Programs',
|
||||
apiMethod: SectionApiMethod.LiveTvPrograms,
|
||||
type: SectionType.UpcomingEpisodes,
|
||||
parametersOptions: {
|
||||
isAiring: false,
|
||||
hasAired: false,
|
||||
isMovie: false,
|
||||
isSports: false,
|
||||
isKids: false,
|
||||
isNews: false,
|
||||
isSeries: true
|
||||
},
|
||||
cardOptions: {
|
||||
showParentTitle: true,
|
||||
showTitle: true,
|
||||
overlayPlayButton: false,
|
||||
overlayMoreButton: false,
|
||||
overlayInfoButton: false,
|
||||
preferThumb: 'auto',
|
||||
showAirDateTime: true,
|
||||
...cardOptions
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Movies',
|
||||
itemTypes: 'Programs',
|
||||
apiMethod: SectionApiMethod.LiveTvPrograms,
|
||||
type: SectionType.UpcomingMovies,
|
||||
parametersOptions: {
|
||||
isAiring: false,
|
||||
hasAired: false,
|
||||
isMovie: true
|
||||
},
|
||||
cardOptions: {
|
||||
preferThumb: null,
|
||||
showParentTitle: false,
|
||||
showTitle: true,
|
||||
overlayPlayButton: false,
|
||||
overlayMoreButton: false,
|
||||
overlayInfoButton: false,
|
||||
showAirDateTime: true,
|
||||
...cardOptions
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Sports',
|
||||
itemTypes: 'Programs',
|
||||
apiMethod: SectionApiMethod.LiveTvPrograms,
|
||||
type: SectionType.UpcomingSports,
|
||||
parametersOptions: {
|
||||
isAiring: false,
|
||||
hasAired: false,
|
||||
isSports: true
|
||||
},
|
||||
cardOptions: {
|
||||
showParentTitle: true,
|
||||
showTitle: true,
|
||||
overlayPlayButton: false,
|
||||
overlayMoreButton: false,
|
||||
overlayInfoButton: false,
|
||||
preferThumb: 'auto',
|
||||
showAirDateTime: true,
|
||||
...cardOptions
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'HeaderForKids',
|
||||
itemTypes: 'Programs',
|
||||
apiMethod: SectionApiMethod.LiveTvPrograms,
|
||||
type: SectionType.UpcomingKids,
|
||||
parametersOptions: {
|
||||
isAiring: false,
|
||||
hasAired: false,
|
||||
isKids: true
|
||||
},
|
||||
cardOptions: {
|
||||
showParentTitle: true,
|
||||
showTitle: true,
|
||||
overlayPlayButton: false,
|
||||
overlayMoreButton: false,
|
||||
overlayInfoButton: false,
|
||||
preferThumb: 'auto',
|
||||
showAirDateTime: true,
|
||||
...cardOptions
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'News',
|
||||
itemTypes: 'Programs',
|
||||
apiMethod: SectionApiMethod.LiveTvPrograms,
|
||||
type: SectionType.UpcomingNews,
|
||||
parametersOptions: {
|
||||
isAiring: false,
|
||||
hasAired: false,
|
||||
isNews: true
|
||||
},
|
||||
cardOptions: {
|
||||
overlayPlayButton: false,
|
||||
overlayMoreButton: false,
|
||||
overlayInfoButton: false,
|
||||
showParentTitleOrTitle: true,
|
||||
showTitle: false,
|
||||
showParentTitle: false,
|
||||
preferThumb: 'auto',
|
||||
showAirDateTime: true,
|
||||
...cardOptions
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'HeaderLatestRecordings',
|
||||
itemTypes: 'Recordings',
|
||||
apiMethod: SectionApiMethod.Recordings,
|
||||
type: SectionType.LatestRecordings,
|
||||
parametersOptions: {
|
||||
limit: 12,
|
||||
imageTypeLimit: 1
|
||||
},
|
||||
cardOptions: {
|
||||
showYear: true,
|
||||
lines: 2,
|
||||
shape: 'autooverflow',
|
||||
defaultShape: 'overflowBackdrop',
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
coverImage: true,
|
||||
cardLayout: false,
|
||||
centerText: true,
|
||||
preferThumb: 'auto',
|
||||
overlayText: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'HeaderAllRecordings',
|
||||
itemTypes: 'Recordings',
|
||||
apiMethod: SectionApiMethod.RecordingFolders,
|
||||
type: SectionType.RecordingFolders,
|
||||
cardOptions: {
|
||||
showYear: false,
|
||||
showParentTitle: false,
|
||||
shape: 'autooverflow',
|
||||
defaultShape: 'overflowBackdrop',
|
||||
showTitle: true,
|
||||
coverImage: true,
|
||||
cardLayout: false,
|
||||
centerText: true,
|
||||
preferThumb: 'auto',
|
||||
overlayText: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'HeaderActiveRecordings',
|
||||
itemTypes: 'Recordings',
|
||||
apiMethod: SectionApiMethod.Recordings,
|
||||
type: SectionType.ActiveRecordings,
|
||||
parametersOptions: {
|
||||
isInProgress: true
|
||||
},
|
||||
cardOptions: {
|
||||
shape: 'autooverflow',
|
||||
defaultShape: 'backdrop',
|
||||
showParentTitle: false,
|
||||
showParentTitleOrTitle: true,
|
||||
showTitle: true,
|
||||
showAirTime: true,
|
||||
showAirEndTime: true,
|
||||
showChannelName: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
overlayMoreButton: true,
|
||||
cardLayout: false,
|
||||
centerText: true,
|
||||
preferThumb: 'auto'
|
||||
}
|
||||
}
|
||||
];
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue