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

View File

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