mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-08 02:34:16 -04:00
Cleaning up the search engine.
This commit is contained in:
parent
06cbd21502
commit
38e464c461
@ -2,6 +2,7 @@ import { Component } from '@angular/core';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Event, Router, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';
|
import { Event, Router, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';
|
||||||
import * as $ from "jquery";
|
import * as $ from "jquery";
|
||||||
|
import { Location } from "@angular/common";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -13,7 +14,7 @@ export class AppComponent
|
|||||||
libraries: Library[];
|
libraries: Library[];
|
||||||
isLoading: boolean = false;
|
isLoading: boolean = false;
|
||||||
|
|
||||||
constructor(http: HttpClient, private router: Router)
|
constructor(http: HttpClient, private router: Router, private location: Location)
|
||||||
{
|
{
|
||||||
http.get<Library[]>("api/libraries").subscribe(result =>
|
http.get<Library[]>("api/libraries").subscribe(result =>
|
||||||
{
|
{
|
||||||
@ -50,8 +51,11 @@ export class AppComponent
|
|||||||
|
|
||||||
onUpdateValue(event)
|
onUpdateValue(event)
|
||||||
{
|
{
|
||||||
console.log("Value: " + event.target.value);
|
let query: string = event.target.value;
|
||||||
this.router.navigate(["/search/" + event.target.value]);
|
if (query != "")
|
||||||
|
this.router.navigate(["/search/" + query], { replaceUrl: this.router.url.startsWith("/search/") });
|
||||||
|
else
|
||||||
|
this.location.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="root">
|
<div class="root">
|
||||||
<div class="episodes" #scrollView (scroll)="onScroll()">
|
<div class="episodes" #scrollView (scroll)="onScroll()">
|
||||||
<a class="episode" *ngFor="let episode of this.episodes" #episode routerLink="/watch/{{episode.link}}" href="/watch/{{this.showSlug}}-s{{episode.seasonNumber}}e{{episode.episodeNumber}}">
|
<a class="episode" *ngFor="let episode of this.episodes" #episodeDom routerLink="/watch/{{episode.link}}" href="/watch/{{this.showSlug}}-s{{episode.seasonNumber}}e{{episode.episodeNumber}}">
|
||||||
<div matRipple class="img" [style.background-image]="sanitize(episode.thumb)">
|
<div matRipple class="img" [style.background-image]="sanitize(episode.thumb)">
|
||||||
<button mat-icon-button class="playBtn"><i class="material-icons playIcon">play_circle_outline</i></button>
|
<button mat-icon-button class="playBtn"><i class="material-icons playIcon">play_circle_outline</i></button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,7 +15,7 @@ export class EpisodesListComponent
|
|||||||
@ViewChild("scrollView", { static: true }) private scrollView: ElementRef;
|
@ViewChild("scrollView", { static: true }) private scrollView: ElementRef;
|
||||||
@ViewChild("leftBtn", { static: false }) private leftBtn: MatButton;
|
@ViewChild("leftBtn", { static: false }) private leftBtn: MatButton;
|
||||||
@ViewChild("rightBtn", { static: false }) private rightBtn: MatButton;
|
@ViewChild("rightBtn", { static: false }) private rightBtn: MatButton;
|
||||||
@ViewChild("episode", { static: false }) private episode: ElementRef;
|
@ViewChild("episodeDom", { static: false }) private episode: ElementRef;
|
||||||
|
|
||||||
constructor(private sanitizer: DomSanitizer) { }
|
constructor(private sanitizer: DomSanitizer) { }
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<div class="container-fluid mt-3">
|
<div *ngIf="items.shows.length > 0" class="container-fluid mt-3">
|
||||||
<h3>Shows</h3>
|
<h3>Shows</h3>
|
||||||
</div>
|
</div>
|
||||||
<app-shows-list [shows]="items.shows"></app-shows-list>
|
<app-shows-list [shows]="items.shows"></app-shows-list>
|
||||||
<div class="container-fluid mt-5">
|
<div *ngIf="items.episodes.length > 0" class="container-fluid mt-5">
|
||||||
<h3>Episodes</h3>
|
<h3>Episodes</h3>
|
||||||
</div>
|
</div>
|
||||||
<app-episodes-list displayShowTitle="true" [episodes]="items.episodes"></app-episodes-list>
|
<app-episodes-list displayShowTitle="true" [episodes]="items.episodes"></app-episodes-list>
|
||||||
<div class="container-fluid mt-5">
|
<div *ngIf="items.people.length > 0" class="container-fluid mt-5">
|
||||||
<h3>People</h3>
|
<h3>People</h3>
|
||||||
</div>
|
</div>
|
||||||
<app-people-list [people]="items.people"></app-people-list>
|
<app-people-list [people]="items.people"></app-people-list>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute } from "@angular/router";
|
import { ActivatedRoute } from "@angular/router";
|
||||||
import { SearchResut } from "../../models/search-result";
|
import { SearchResut } from "../../models/search-result";
|
||||||
|
import { Title } from "@angular/platform-browser";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-search',
|
selector: 'app-search',
|
||||||
@ -11,13 +12,14 @@ export class SearchComponent implements OnInit
|
|||||||
{
|
{
|
||||||
items: SearchResut;
|
items: SearchResut;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute) { }
|
constructor(private route: ActivatedRoute, private title: Title) { }
|
||||||
|
|
||||||
ngOnInit()
|
ngOnInit()
|
||||||
{
|
{
|
||||||
this.route.data.subscribe((data) =>
|
this.route.data.subscribe((data) =>
|
||||||
{
|
{
|
||||||
this.items = data.items;
|
this.items = data.items;
|
||||||
|
this.title.setTitle(this.items.query + " - Kyoo");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import { Genre } from "./genre";
|
|||||||
|
|
||||||
export interface SearchResut
|
export interface SearchResut
|
||||||
{
|
{
|
||||||
|
query: string;
|
||||||
shows: Show[];
|
shows: Show[];
|
||||||
episodes: Episode[];
|
episodes: Episode[];
|
||||||
people: People[];
|
people: People[];
|
||||||
|
@ -20,6 +20,7 @@ namespace Kyoo.Controllers
|
|||||||
{
|
{
|
||||||
SearchResult result = new SearchResult
|
SearchResult result = new SearchResult
|
||||||
{
|
{
|
||||||
|
query = query,
|
||||||
shows = libraryManager.GetShows(query),
|
shows = libraryManager.GetShows(query),
|
||||||
episodes = libraryManager.SearchEpisodes(query),
|
episodes = libraryManager.SearchEpisodes(query),
|
||||||
people = libraryManager.SearchPeople(query),
|
people = libraryManager.SearchPeople(query),
|
||||||
|
@ -4,6 +4,7 @@ namespace Kyoo.Models
|
|||||||
{
|
{
|
||||||
public class SearchResult
|
public class SearchResult
|
||||||
{
|
{
|
||||||
|
public string query;
|
||||||
public IEnumerable<Show> shows;
|
public IEnumerable<Show> shows;
|
||||||
public IEnumerable<Episode> episodes;
|
public IEnumerable<Episode> episodes;
|
||||||
public IEnumerable<People> people;
|
public IEnumerable<People> people;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user