From bf8f004eb3e500e41de9ac213b65184a0448df37 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 9 Jun 2021 10:15:48 -0400 Subject: [PATCH] Add tv channels search row --- src/components/search/LiveTVSearchResults.js | 20 ++++++-------- src/components/search/SearchResults.js | 28 +++++++++++++------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/components/search/LiveTVSearchResults.js b/src/components/search/LiveTVSearchResults.js index aabceebe98..871c86a96a 100644 --- a/src/components/search/LiveTVSearchResults.js +++ b/src/components/search/LiveTVSearchResults.js @@ -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} /> ); diff --git a/src/components/search/SearchResults.js b/src/components/search/SearchResults.js index 5d4eda07b4..3b6322e201 100644 --- a/src/components/search/SearchResults.js +++ b/src/components/search/SearchResults.js @@ -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 }} /> + { }} />