Skip to content

Commit

Permalink
Filter shows and movies in IMDB suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon committed Nov 2, 2023
1 parent 94d42c9 commit 7335bae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 3 additions & 1 deletion apps/api/src/handlers/suggest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ export const suggest = async (ctx) => {
const query = ctx.req.query("query");

try {
const results = await imdb.suggest({ query });
const results = (await imdb.suggest({ query })).filter((r) =>
["movie", "tvSeries", "tvMiniSeries", "short"].includes(r.type)
);
return ctx.json(results);
} catch (e) {
return ctx.json({ error: e.message }, 500);
Expand Down
9 changes: 3 additions & 6 deletions apps/client/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ var config *Config
var scrapeClient *scraper.Scraper
var db *bolt.DB

func setupDatabase() {
func main() {
scrapeClient = scraper.MakeScraper()
config = MakeConfig()
var err error
db, err = bolt.Open(config.OutputPath+"/.clientdb", 0600, nil)
FatalError(err)
Expand All @@ -21,12 +23,7 @@ func setupDatabase() {
FatalError(err)
return nil
})
}

func main() {
scrapeClient = scraper.MakeScraper()
config = MakeConfig()
setupDatabase()
defer db.Close()
go cleanup()
gin.SetMode(gin.ReleaseMode)
Expand Down
2 changes: 1 addition & 1 deletion apps/navigator/src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const SearchInput = ({ value }) => {
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
</svg>
</div>
<input type="search" ref={input => input && input.focus()} autoFocus value={search.query} onInput={onInput} id="default-search" class="block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white border-transparent focus:border-transparent focus:outline-none" placeholder="Search tv/film e.g. The bear s01e02" required />
<input type="search" ref={input => input && input.focus()} autoFocus value={search.query} onInput={onInput} id="default-search" class="block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white border-transparent focus:border-transparent focus:outline-none" placeholder="Search e.g. Alone s01e01" required />
<SearchBtn type="submit">Search</SearchBtn>
</div>
<div id="suggestions" class="mt-2 text-sm text-gray-500 flex flex-row flex-wrap pt-2">
Expand Down
2 changes: 1 addition & 1 deletion apps/navigator/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ main {

@media (max-width: 639px) {
main {
margin: 2rem;
padding: 2rem;
}
}

Expand Down

0 comments on commit 7335bae

Please sign in to comment.