From b1b09e87e75cf4adc0ae027b35358cf72e2ad3cc Mon Sep 17 00:00:00 2001 From: Ab30657 Date: Sun, 11 Apr 2021 13:41:05 +0545 Subject: api connect --- src/web/src/app/film/film.component.ts | 10 ++++++++-- src/web/src/app/scrape.service.spec.ts | 16 ++++++++++++++++ src/web/src/app/scrape.service.ts | 17 +++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 src/web/src/app/scrape.service.spec.ts create mode 100644 src/web/src/app/scrape.service.ts (limited to 'src/web') diff --git a/src/web/src/app/film/film.component.ts b/src/web/src/app/film/film.component.ts index d4e90f5..7d2f6cc 100644 --- a/src/web/src/app/film/film.component.ts +++ b/src/web/src/app/film/film.component.ts @@ -3,6 +3,7 @@ import { ActivatedRoute } from '@angular/router'; import { filter, map } from 'rxjs/operators'; import { MovieTVService } from '../movie-tv.service'; import { AppService } from '../app.service'; +import { ScrapeService } from '../scrape.service'; @Component({ selector: 'app-film', @@ -18,7 +19,8 @@ export class FilmComponent implements OnInit { id: string; constructor( private route: ActivatedRoute, - private service: MovieTVService + private service: MovieTVService, + private scraper: ScrapeService ) {} ngOnInit(): void { this.route.paramMap.subscribe((x) => { @@ -33,9 +35,13 @@ export class FilmComponent implements OnInit { }); this.service.searchById(this.type, +this.id).subscribe((x: any) => { this.model = x; - this.loading = false; console.log(this.model); }); + this.scraper + .performCheck(this.id, this.model, this.type) + .subscribe((x) => { + this.loading = false; + }); // //Get Providers List /*this.service diff --git a/src/web/src/app/scrape.service.spec.ts b/src/web/src/app/scrape.service.spec.ts new file mode 100644 index 0000000..45c2849 --- /dev/null +++ b/src/web/src/app/scrape.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { ScrapeService } from './scrape.service'; + +describe('ScrapeService', () => { + let service: ScrapeService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ScrapeService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/web/src/app/scrape.service.ts b/src/web/src/app/scrape.service.ts new file mode 100644 index 0000000..85eed58 --- /dev/null +++ b/src/web/src/app/scrape.service.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root', +}) +export class ScrapeService { + apiURL = 'http://localhost:5000/api/'; + + constructor(private service: HttpClient) {} + + performCheck(id, query, type) { + return this.service.get(this.apiURL, { + params: { id: id, query: query, type: type }, + }); + } +} -- cgit v1.2.3 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 (limited to 'src/web') 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 From eacca54ef20e34a8fff5353bd0854ab9cf882883 Mon Sep 17 00:00:00 2001 From: Ab30657 Date: Sun, 11 Apr 2021 15:59:53 +0545 Subject: update on image cards -css --- src/web/src/app/film/film.component.html | 6 +++++- src/web/src/app/film/film.component.ts | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/web') diff --git a/src/web/src/app/film/film.component.html b/src/web/src/app/film/film.component.html index 273dab1..0619f72 100644 --- a/src/web/src/app/film/film.component.html +++ b/src/web/src/app/film/film.component.html @@ -43,7 +43,11 @@
diff --git a/src/web/src/app/film/film.component.ts b/src/web/src/app/film/film.component.ts index 6dac982..26dd507 100644 --- a/src/web/src/app/film/film.component.ts +++ b/src/web/src/app/film/film.component.ts @@ -52,4 +52,11 @@ export class FilmComponent implements OnInit { getPrice(i: number) { return this.prices[i]; } + + getProviderImage(i: number) { + console.log( + (this.providers[i] as string).toLowerCase().replace(/ /g, '') + ); + return (this.providers[i] as string).toLowerCase().replace(/ /g, ''); + } } -- cgit v1.2.3 From 32455166bb3639f0b83fc916e1b2845ff1f137ae Mon Sep 17 00:00:00 2001 From: Ab30657 Date: Sun, 11 Apr 2021 16:22:29 +0545 Subject: probably final update --- src/web/src/assets/img/platforms/googleplay.png | Bin 1900 -> 0 bytes .../src/assets/img/platforms/googleplaymovies&tv.png | Bin 0 -> 7071 bytes src/web/src/assets/img/platforms/itunes.png | Bin 2495 -> 76794 bytes src/web/src/assets/img/platforms/youtube.png | Bin 872 -> 8085 bytes 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/web/src/assets/img/platforms/googleplay.png create mode 100644 src/web/src/assets/img/platforms/googleplaymovies&tv.png (limited to 'src/web') diff --git a/src/web/src/assets/img/platforms/googleplay.png b/src/web/src/assets/img/platforms/googleplay.png deleted file mode 100644 index a44a779..0000000 Binary files a/src/web/src/assets/img/platforms/googleplay.png and /dev/null differ diff --git a/src/web/src/assets/img/platforms/googleplaymovies&tv.png b/src/web/src/assets/img/platforms/googleplaymovies&tv.png new file mode 100644 index 0000000..1262012 Binary files /dev/null and b/src/web/src/assets/img/platforms/googleplaymovies&tv.png differ diff --git a/src/web/src/assets/img/platforms/itunes.png b/src/web/src/assets/img/platforms/itunes.png index 3c0acb5..8d0c18e 100644 Binary files a/src/web/src/assets/img/platforms/itunes.png and b/src/web/src/assets/img/platforms/itunes.png differ diff --git a/src/web/src/assets/img/platforms/youtube.png b/src/web/src/assets/img/platforms/youtube.png index 15d5984..36248e4 100644 Binary files a/src/web/src/assets/img/platforms/youtube.png and b/src/web/src/assets/img/platforms/youtube.png differ -- cgit v1.2.3