From bc3d6742fb3a7dba37ed751798e245b09bb2df18 Mon Sep 17 00:00:00 2001 From: Ashishprasa Date: Sat, 30 Dec 2023 19:08:51 +0530 Subject: [PATCH 1/7] fix missing poster issu --- example.env | 8 -------- src/pages/parts/search/SearchListPart.tsx | 12 +++++++++--- 2 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 example.env diff --git a/example.env b/example.env deleted file mode 100644 index 38c690a5..00000000 --- a/example.env +++ /dev/null @@ -1,8 +0,0 @@ -VITE_TMDB_READ_API_KEY=... -VITE_OPENSEARCH_ENABLED=false - -# make sure the cors proxy url does NOT have a slash at the end -VITE_CORS_PROXY_URL=... - -# make sure the domain does NOT have a slash at the end -VITE_APP_DOMAIN=http://localhost:5173 diff --git a/src/pages/parts/search/SearchListPart.tsx b/src/pages/parts/search/SearchListPart.tsx index 270d05f1..ea9a5f43 100644 --- a/src/pages/parts/search/SearchListPart.tsx +++ b/src/pages/parts/search/SearchListPart.tsx @@ -67,6 +67,8 @@ export function SearchListPart({ searchQuery }: { searchQuery: string }) { if (state.error) return ; if (!results) return null; + // console.log(results); + return (
{results.length > 0 ? ( @@ -76,9 +78,13 @@ export function SearchListPart({ searchQuery }: { searchQuery: string }) { icon={Icons.SEARCH} /> - {results.map((v) => ( - - ))} + {results.map((v) => + v.poster === undefined ? ( + "" + ) : ( + + ), + )}
) : null} From 445103958ae1d6d5285c5c9a9942e39e3aed4f13 Mon Sep 17 00:00:00 2001 From: Ashishprasa Date: Sat, 30 Dec 2023 19:23:27 +0530 Subject: [PATCH 2/7] add example.env --- example.env | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 example.env diff --git a/example.env b/example.env new file mode 100644 index 00000000..38c690a5 --- /dev/null +++ b/example.env @@ -0,0 +1,8 @@ +VITE_TMDB_READ_API_KEY=... +VITE_OPENSEARCH_ENABLED=false + +# make sure the cors proxy url does NOT have a slash at the end +VITE_CORS_PROXY_URL=... + +# make sure the domain does NOT have a slash at the end +VITE_APP_DOMAIN=http://localhost:5173 From 986a46f9f03dafbf48daf30314ab497ba509c87f Mon Sep 17 00:00:00 2001 From: Ashishprasa Date: Sat, 30 Dec 2023 21:57:24 +0530 Subject: [PATCH 3/7] fix missing poster issu sort the movie list --- src/backend/metadata/search.ts | 13 ++++++++++++- src/pages/parts/search/SearchListPart.tsx | 12 +++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/backend/metadata/search.ts b/src/backend/metadata/search.ts index a162dd3a..f7984edc 100644 --- a/src/backend/metadata/search.ts +++ b/src/backend/metadata/search.ts @@ -24,6 +24,17 @@ export async function searchForMedia(query: MWQuery): Promise { return formatTMDBMetaToMediaItem(formattedResult); }); - cache.set(query, results, 3600); // cache results for 1 hour + cache.set(query, results, 3600); + + results.sort((a, b) => { + if (a.poster === undefined) { + return 1; + } + if (b.poster === undefined) { + return -1; + } + return 0; + }); + // cache results for 1 hour return results; } diff --git a/src/pages/parts/search/SearchListPart.tsx b/src/pages/parts/search/SearchListPart.tsx index ea9a5f43..270d05f1 100644 --- a/src/pages/parts/search/SearchListPart.tsx +++ b/src/pages/parts/search/SearchListPart.tsx @@ -67,8 +67,6 @@ export function SearchListPart({ searchQuery }: { searchQuery: string }) { if (state.error) return ; if (!results) return null; - // console.log(results); - return (
{results.length > 0 ? ( @@ -78,13 +76,9 @@ export function SearchListPart({ searchQuery }: { searchQuery: string }) { icon={Icons.SEARCH} /> - {results.map((v) => - v.poster === undefined ? ( - "" - ) : ( - - ), - )} + {results.map((v) => ( + + ))}
) : null} From 99fbfd9848990a16441961732f5f89a6dfb45686 Mon Sep 17 00:00:00 2001 From: Ashish Date: Sat, 30 Dec 2023 22:31:25 +0530 Subject: [PATCH 4/7] Change results position --- src/backend/metadata/search.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/metadata/search.ts b/src/backend/metadata/search.ts index f7984edc..eb923056 100644 --- a/src/backend/metadata/search.ts +++ b/src/backend/metadata/search.ts @@ -24,8 +24,6 @@ export async function searchForMedia(query: MWQuery): Promise { return formatTMDBMetaToMediaItem(formattedResult); }); - cache.set(query, results, 3600); - results.sort((a, b) => { if (a.poster === undefined) { return 1; @@ -35,6 +33,8 @@ export async function searchForMedia(query: MWQuery): Promise { } return 0; }); + + cache.set(query, results, 3600); // cache results for 1 hour return results; } From b9ec201c84509905659f94a045f8c831f0aa5a97 Mon Sep 17 00:00:00 2001 From: Ashishprasa Date: Sun, 31 Dec 2023 11:49:19 +0530 Subject: [PATCH 5/7] fix linting error --- src/backend/metadata/search.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/metadata/search.ts b/src/backend/metadata/search.ts index eb923056..0573625e 100644 --- a/src/backend/metadata/search.ts +++ b/src/backend/metadata/search.ts @@ -33,8 +33,8 @@ export async function searchForMedia(query: MWQuery): Promise { } return 0; }); - - cache.set(query, results, 3600); + // cache results for 1 hour + cache.set(query, results, 3600); return results; } From 1a62185c173ecdec777a2af5d3223546e001335c Mon Sep 17 00:00:00 2001 From: Ashishprasa Date: Mon, 1 Jan 2024 22:59:33 +0530 Subject: [PATCH 6/7] replace sorting into filtering approach --- src/backend/metadata/search.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/backend/metadata/search.ts b/src/backend/metadata/search.ts index 0573625e..3d73705e 100644 --- a/src/backend/metadata/search.ts +++ b/src/backend/metadata/search.ts @@ -24,17 +24,12 @@ export async function searchForMedia(query: MWQuery): Promise { return formatTMDBMetaToMediaItem(formattedResult); }); - results.sort((a, b) => { - if (a.poster === undefined) { - return 1; - } - if (b.poster === undefined) { - return -1; - } - return 0; - }); + const movieWithposters = results.filter((movie) => movie.poster); + const movieWithoutposters = results.filter((movie) => !movie.poster); + + const sortedresult = movieWithposters.concat(movieWithoutposters); // cache results for 1 hour - cache.set(query, results, 3600); - return results; + cache.set(query, sortedresult, 3600); + return sortedresult; } From 5bf7c82b54a69db7fd28dac12210cb757a114158 Mon Sep 17 00:00:00 2001 From: Ashish Date: Tue, 2 Jan 2024 15:43:02 +0530 Subject: [PATCH 7/7] Update src/backend/metadata/search.ts Co-authored-by: William Oldham --- src/backend/metadata/search.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/metadata/search.ts b/src/backend/metadata/search.ts index 3d73705e..fff64112 100644 --- a/src/backend/metadata/search.ts +++ b/src/backend/metadata/search.ts @@ -24,10 +24,10 @@ export async function searchForMedia(query: MWQuery): Promise { return formatTMDBMetaToMediaItem(formattedResult); }); - const movieWithposters = results.filter((movie) => movie.poster); - const movieWithoutposters = results.filter((movie) => !movie.poster); + const movieWithPosters = results.filter((movie) => movie.poster); + const movieWithoutPosters = results.filter((movie) => !movie.poster); - const sortedresult = movieWithposters.concat(movieWithoutposters); + const sortedresult = movieWithPosters.concat(movieWithoutPosters); // cache results for 1 hour cache.set(query, sortedresult, 3600);