Add tv channels search row

This commit is contained in:
Bill Thornton 2021-06-09 10:15:48 -04:00
parent 219d83ede3
commit bf8f004eb3
2 changed files with 27 additions and 21 deletions

View File

@ -28,7 +28,7 @@ const LiveTVSearchResults = ({ serverId, parentId, collectionType, query }) => {
const [ kids, setKids ] = useState([]);
const [ news, setNews ] = useState([]);
const [ programs, setPrograms ] = useState([]);
const [ videos, setVideos ] = useState([]);
const [ channels, setChannels ] = useState([]);
const getDefaultParameters = () => ({
ParentId: parentId,
@ -65,7 +65,7 @@ const LiveTVSearchResults = ({ serverId, parentId, collectionType, query }) => {
setKids([]);
setNews([]);
setPrograms([]);
setVideos([]);
setChannels([]);
if (query && isLiveTV()) {
const apiClient = ServerConnections.getApiClient(serverId);
@ -124,13 +124,9 @@ const LiveTVSearchResults = ({ serverId, parentId, collectionType, query }) => {
IsKids: false,
IsNews: false
}).then(result => setPrograms(result.Items));
// NOTE: I believe this is supposed to be home videos, but it
// includes TV channels so it should probably be included for Live TV
// Videos row
fetchItems(apiClient, {
MediaTypes: 'Video',
ExcludeItemTypes: 'Movie,Episode'
}).then(result => setVideos(result.Items));
// Channels row
fetchItems(apiClient, { IncludeItemTypes: 'TvChannel' })
.then(result => setChannels(result.Items));
}
}, [ query ]);
@ -177,9 +173,9 @@ const LiveTVSearchResults = ({ serverId, parentId, collectionType, query }) => {
cardOptions={CARD_OPTIONS}
/>
<SearchResultsRow
title={globalize.translate('HeaderVideos')}
items={videos}
cardOptions={{ showParentTitle: true }}
title={globalize.translate('Channels')}
items={channels}
cardOptions={{ shape: 'square' }}
/>
</div>
);

View File

@ -13,8 +13,9 @@ const SearchResults = ({ serverId, parentId, collectionType, query }) => {
const [ movies, setMovies ] = useState([]);
const [ shows, setShows ] = useState([]);
const [ episodes, setEpisodes ] = useState([]);
const [ programs, setPrograms ] = useState([]);
const [ videos, setVideos ] = useState([]);
const [ programs, setPrograms ] = useState([]);
const [ channels, setChannels ] = useState([]);
const [ playlists, setPlaylists ] = useState([]);
const [ artists, setArtists ] = useState([]);
const [ albums, setAlbums ] = useState([]);
@ -78,8 +79,9 @@ const SearchResults = ({ serverId, parentId, collectionType, query }) => {
setMovies([]);
setShows([]);
setEpisodes([]);
setPrograms([]);
setVideos([]);
setPrograms([]);
setChannels([]);
setPlaylists([]);
setArtists([]);
setAlbums([]);
@ -133,14 +135,17 @@ const SearchResults = ({ serverId, parentId, collectionType, query }) => {
// Other libraries do not support in-library search currently
if (!collectionType) {
// Programs row
fetchItems(apiClient, { IncludeItemTypes: 'LiveTvProgram' })
.then(result => setPrograms(result.Items));
// Videos row
fetchItems(apiClient, {
MediaTypes: 'Video',
ExcludeItemTypes: 'Movie,Episode'
ExcludeItemTypes: 'Movie,Episode,TvChannel'
}).then(result => setVideos(result.Items));
// Programs row
fetchItems(apiClient, { IncludeItemTypes: 'LiveTvProgram' })
.then(result => setPrograms(result.Items));
// Channels row
fetchItems(apiClient, { IncludeItemTypes: 'TvChannel' })
.then(result => setChannels(result.Items));
// Photo Albums row
fetchItems(apiClient, { IncludeItemTypes: 'PhotoAlbum' })
.then(results => setPhotoAlbums(results.Items));
@ -184,6 +189,11 @@ const SearchResults = ({ serverId, parentId, collectionType, query }) => {
showParentTitle: true
}}
/>
<SearchResultsRow
title={globalize.translate('HeaderVideos')}
items={videos}
cardOptions={{ showParentTitle: true }}
/>
<SearchResultsRow
title={globalize.translate('Programs')}
items={programs}
@ -200,9 +210,9 @@ const SearchResults = ({ serverId, parentId, collectionType, query }) => {
}}
/>
<SearchResultsRow
title={globalize.translate('HeaderVideos')}
items={videos}
cardOptions={{ showParentTitle: true }}
title={globalize.translate('Channels')}
items={channels}
cardOptions={{ shape: 'square' }}
/>
<SearchResultsRow
title={globalize.translate('Playlists')}