From aa5778c037c1793d0c096a3d0d31009b901a708e Mon Sep 17 00:00:00 2001 From: Ab30657 Date: Sun, 11 Apr 2021 15:32:57 +0545 Subject: connected with api --- src/web/src/app/film/film.component.html | 11 ++++++--- src/web/src/app/film/film.component.ts | 38 +++++++++++++------------------- src/web/src/app/home/home.component.html | 5 ++++- src/web/src/app/scrape.service.ts | 2 +- src/web/src/assets/movies pic.svg | 1 + src/web/src/assets/movies.svg | 1 - src/web/src/styles.css | 8 ++----- 7 files changed, 31 insertions(+), 35 deletions(-) create mode 100644 src/web/src/assets/movies pic.svg delete mode 100644 src/web/src/assets/movies.svg diff --git a/src/web/src/app/film/film.component.html b/src/web/src/app/film/film.component.html index 7e18536..273dab1 100644 --- a/src/web/src/app/film/film.component.html +++ b/src/web/src/app/film/film.component.html @@ -36,14 +36,19 @@ Watch It Here
-
+
-
+
+ {{ getPrice(i) }} +
diff --git a/src/web/src/app/film/film.component.ts b/src/web/src/app/film/film.component.ts index 7d2f6cc..6dac982 100644 --- a/src/web/src/app/film/film.component.ts +++ b/src/web/src/app/film/film.component.ts @@ -11,12 +11,13 @@ import { ScrapeService } from '../scrape.service'; styleUrls: ['./film.component.css'], }) export class FilmComponent implements OnInit { - providers = ['Netflix']; + providers; model: any; loading: boolean = true; img: string; type: string; id: string; + prices; constructor( private route: ActivatedRoute, private service: MovieTVService, @@ -26,33 +27,21 @@ export class FilmComponent implements OnInit { this.route.paramMap.subscribe((x) => { this.type = x.get('type'); this.id = x.get('id'); - //Start Scraping and loading the spinner - - //this.data.getUsers().subscribe((data) => { - // this.users = data; - //}); - /// }); this.service.searchById(this.type, +this.id).subscribe((x: any) => { + let a; this.model = x; - console.log(this.model); - }); - this.scraper - .performCheck(this.id, this.model, this.type) - .subscribe((x) => { + if (this.type === 'tv') { + a = this.model.name; + } else { + a = this.model.original_title; + } + this.scraper.performCheck(this.id, a, this.type).subscribe((x) => { + this.providers = x[0]; + this.prices = x[1]; this.loading = false; }); - // - //Get Providers List - /*this.service - .getProviderList(this.model.media_type, this.model.id) - .pipe( - map((x: any) => { - x.results.US.flatrate; - }) - ) - .subscribe((x) => (this.model.watch_providers = x)); - console.log(this.model.watch_providers);*/ + }); } getImage() { @@ -60,4 +49,7 @@ export class FilmComponent implements OnInit { ? 'https://image.tmdb.org/t/p/original' + this.model.poster_path : ''; } + getPrice(i: number) { + return this.prices[i]; + } } diff --git a/src/web/src/app/home/home.component.html b/src/web/src/app/home/home.component.html index 7e59fe0..88dd292 100644 --- a/src/web/src/app/home/home.component.html +++ b/src/web/src/app/home/home.component.html @@ -2,7 +2,10 @@
- +
diff --git a/src/web/src/app/scrape.service.ts b/src/web/src/app/scrape.service.ts index 85eed58..fa25601 100644 --- a/src/web/src/app/scrape.service.ts +++ b/src/web/src/app/scrape.service.ts @@ -10,7 +10,7 @@ export class ScrapeService { constructor(private service: HttpClient) {} performCheck(id, query, type) { - return this.service.get(this.apiURL, { + return this.service.get(this.apiURL + 'performCheck', { params: { id: id, query: query, type: type }, }); } diff --git a/src/web/src/assets/movies pic.svg b/src/web/src/assets/movies pic.svg new file mode 100644 index 0000000..0f5cc91 --- /dev/null +++ b/src/web/src/assets/movies pic.svg @@ -0,0 +1 @@ +movie_night \ No newline at end of file diff --git a/src/web/src/assets/movies.svg b/src/web/src/assets/movies.svg deleted file mode 100644 index 0f5cc91..0000000 --- a/src/web/src/assets/movies.svg +++ /dev/null @@ -1 +0,0 @@ -movie_night \ No newline at end of file diff --git a/src/web/src/styles.css b/src/web/src/styles.css index 8c0c651..b1664ee 100644 --- a/src/web/src/styles.css +++ b/src/web/src/styles.css @@ -97,6 +97,7 @@ body { height: 120px; box-shadow: 3px 3px 15px 5px rgba(0, 0, 0, 0.3); transition: 0.3s; + margin: 20px auto; } .card .card-img { @@ -117,8 +118,7 @@ body { border-radius: 0px 0px 40px 40px; font-family: sans-serif; font-weight: bold; - font-size: 30px; - margin-top: -80px; + font-size: 20px; height: 40px; } @@ -131,10 +131,6 @@ body { color: white; } -.title-black { - color: black; -} - @media all and (max-width: 500px) { .card-list { /* On small screens, we are no longer using row direction but column */ -- cgit v1.2.3