-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement optional IMDB search. Add AUTH key (see backend service for…
… details). Create Windows & Linux build scripts
- Loading branch information
Segi Hovav
committed
Dec 15, 2021
1 parent
1712cf6
commit 193db1e
Showing
14 changed files
with
223 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@echo off | ||
ionic build | ||
ionic cap copy | ||
ionic cap sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
ionic build | ||
ionic cap copy | ||
ionic cap sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
import { IMDBSearchPage } from './imdb-search.page'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: IMDBSearchPage, | ||
} | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class IMDBSearchPageRoutingModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { IonicModule } from '@ionic/angular'; | ||
import { NgModule, OnInit } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { IMDBSearchPage } from './imdb-search.page'; | ||
|
||
import { IMDBSearchPageRoutingModule } from './imdb-search-routing.module'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
FormsModule, | ||
IonicModule, | ||
IMDBSearchPageRoutingModule | ||
], | ||
declarations: [IMDBSearchPage] | ||
}) | ||
export class IMDBSearchPageModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<ion-header [translucent]="true"> | ||
<ion-toolbar> | ||
<ion-buttons slot="start"> | ||
<ion-menu-button></ion-menu-button> | ||
</ion-buttons> | ||
<ion-title>IMDB Search</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content> | ||
<ion-grid> | ||
<ion-row> | ||
<ion-col size="6"> | ||
<ion-input type="text" [(ngModel)]="searchTerm" (keyup)="handleKeyUp($event)"></ion-input> | ||
</ion-col> | ||
|
||
<ion-col size="1"> | ||
<ion-icon name="search-outline" (click)="searchIMDB()"></ion-icon> | ||
</ion-col> | ||
</ion-row> | ||
</ion-grid> | ||
|
||
<div class="ion-list-parent"> | ||
<ion-list> | ||
<ion-item *ngFor="let currSearchResult of searchResults;let index=index;"> <!-- Table headers --> | ||
<ion-grid> | ||
<ion-row> | ||
<ion-col size="12"> | ||
<ion-label><ion-icon name="add-outline" (click)="addSearchResult(currSearchResult,index)"></ion-icon> {{ currSearchResult['Title'] }} ( {{ currSearchResult['Year'] }} )</ion-label> | ||
</ion-col> | ||
|
||
<ion-col size="3"> | ||
<ion-img [src]="currSearchResult.Poster"></ion-img> | ||
</ion-col> | ||
|
||
<ion-col size="6"></ion-col> | ||
</ion-row> | ||
</ion-grid> | ||
</ion-item> | ||
</ion-list> | ||
</div> | ||
</ion-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters