+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ currSearchResult['Title'] }} ( {{ currSearchResult['Year'] }} )
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/imdb-search/imdb-search.page.scss b/src/app/imdb-search/imdb-search.page.scss
new file mode 100644
index 0000000..600cf59
--- /dev/null
+++ b/src/app/imdb-search/imdb-search.page.scss
@@ -0,0 +1,36 @@
+
+.ion-list-parent {
+ width: 100%;
+ overflow: auto;
+}
+
+ion-col {
+ vertical-align: top;
+}
+
+ion-content {
+ overflow: auto;
+}
+
+ion-icon {
+ width: 35px;
+ height: 35px;
+}
+
+ion-img {
+ width: 200px;
+ height: 200px;
+}
+
+ion-input {
+ border-style: dashed;
+ border-width: 1px;
+}
+
+ion-label {
+ font-size: 28px;
+}
+
+ion-label.labelMobile {
+ font-size: 18px;
+}
\ No newline at end of file
diff --git a/src/app/imdb-search/imdb-search.page.ts b/src/app/imdb-search/imdb-search.page.ts
new file mode 100644
index 0000000..b3801f5
--- /dev/null
+++ b/src/app/imdb-search/imdb-search.page.ts
@@ -0,0 +1,54 @@
+import { Component } from '@angular/core';
+import { DataService } from '../core/data.service';
+
+@Component({
+ selector: 'app-imdbsearch',
+ templateUrl: 'imdb-search.page.html',
+ styleUrls: ['imdb-search.page.scss']
+})
+export class IMDBSearchPage {
+ searchTerm = '';
+ searchResults: any;
+
+ constructor(public dataService: DataService) { }
+
+ addSearchResult(currSearchResult: any, index: number) {
+ const currWatchListItem: any=[];
+ currWatchListItem.Name=currSearchResult['Title'];
+
+ if (currSearchResult['Type'] == "movie")
+ currWatchListItem.Type=1
+ else if (currSearchResult['Type'] == "series")
+ currWatchListItem.Type=2
+ else
+ currWatchListItem.Type=3 // Other
+
+ currWatchListItem.IMDB_URL=`https://www.imdb.com/title/${currSearchResult['imdbID']}/`
+
+ this.dataService.addWatchListItem(currWatchListItem).subscribe((response) => {
+ this.searchResults.splice(index,1); // Remove it from the the search results since its been added
+
+ this.dataService.getWatchListItemsSubscription(true);
+ },
+ error => {
+ this.dataService.handleError(error);
+ });
+ }
+
+ handleKeyUp(e) { // Submit search when enter is pressed in search field
+ if (e.keyCode === 13) // Submit when enter is pressed
+ this.searchIMDB();
+ }
+
+ searchIMDB() {
+ if (this.searchTerm != '' && this.searchTerm != null) {
+ this.dataService.searchIMDB(this.searchTerm).subscribe((response) => {
+ this.searchResults=Object.entries(response)[0][1]; // This contains the actual search results
+ },
+ error => {
+ console.log(`An error occurred searching IMDB`)
+ });
+ } else
+ alert("Please enter a search term");
+ }
+}
\ No newline at end of file
diff --git a/src/app/tabs/tabs-routing.module.ts b/src/app/tabs/tabs-routing.module.ts
index c289dff..0669537 100644
--- a/src/app/tabs/tabs-routing.module.ts
+++ b/src/app/tabs/tabs-routing.module.ts
@@ -1,7 +1,8 @@
import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
+import { RouterModule, Router, Routes } from '@angular/router';
import { TabsPage } from './tabs.page';
import { AuthGuardService as AuthGuard } from '../core/auth-guard-service';
+import { DataService } from '../core/data.service';
const routes: Routes = [
{
@@ -23,6 +24,11 @@ const routes: Routes = [
loadChildren: () => import('../watchlist-queue/watchlistqueue.module').then(m => m.WatchListQueuePageModule),
canActivate: [AuthGuard]
},
+ {
+ path: 'imdb-search', // The route settings are always here but this route won't get activated if IMDB API key is not provided because the IMDB Search tab gets hidden when API key is not present
+ loadChildren: () => import('../imdb-search/imdb-search.module').then(m => m.IMDBSearchPageModule),
+ canActivate: [AuthGuard]
+ },
{
path: 'watchlist-stats',
loadChildren: () => import('../watchlist-stats/watchlist-stats.modules').then(m => m.WatchListStatsPageModule),
diff --git a/src/app/tabs/tabs.page.html b/src/app/tabs/tabs.page.html
index 8245922..0f70c29 100644
--- a/src/app/tabs/tabs.page.html
+++ b/src/app/tabs/tabs.page.html
@@ -15,6 +15,11 @@