Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a4f4f28
added user ratings to the movie display
j-stevenson-hobsons Sep 6, 2016
624ff60
Merge pull request #1 from bromigos/ratings
a-faraz Sep 6, 2016
4a900ff
rearrange page, with additional padding
j-stevenson-hobsons Sep 6, 2016
8fd08de
Merge pull request #2 from bromigos/ratings
aecostilla Sep 6, 2016
fa75061
sent to another site to stream movie on click
j-stevenson-hobsons Sep 7, 2016
11bb09a
Merge pull request #3 from bromigos/streamOnClick
a-faraz Sep 7, 2016
349afb9
able to play the movie on netflix or for free
j-stevenson-hobsons Sep 7, 2016
0393528
Merge pull request #4 from bromigos/streamOnClick
a-faraz Sep 7, 2016
15ea1d1
dynamically play video on pirate click
j-stevenson-hobsons Sep 8, 2016
1a847f3
Merge pull request #5 from bromigos/movieTrailer
ja-stevenson Sep 8, 2016
3e9b15a
Decode and verify working for iframe implementation
malignantz Sep 8, 2016
b6820b6
Commit success...decodes and returns JWplayer html
malignantz Sep 8, 2016
c2d9fcc
Works for actors in db
malignantz Sep 8, 2016
662ef24
Merge pull request #6 from bromigos/pirateShip
ja-stevenson Sep 8, 2016
1dbe93e
Frontend injection of pirate links maybe complete
malignantz Sep 8, 2016
76289ff
Merge pull request #7 from bromigos/pirateShip2
ja-stevenson Sep 8, 2016
431aadb
Injects when actor name has to be fixed
malignantz Sep 8, 2016
b29c6fa
Merge pull request #8 from bromigos/pirateShip2
aecostilla Sep 8, 2016
ca7361f
Grabbing underlying mediaFile. Double scrape
malignantz Sep 8, 2016
cd742f5
Merge pull request #9 from bromigos/pirateShip2
a-faraz Sep 8, 2016
2b092c7
Able to check if netflix is avaible on a single actor, not multiple. …
aecostilla Sep 8, 2016
20e1446
merged psrc with netflix functions and api calls
aecostilla Sep 8, 2016
22ee918
Merge pull request #10 from bromigos/featCanI
ja-stevenson Sep 8, 2016
5134722
remove comment
malignantz Sep 8, 2016
2b12efe
fullscreen enabled
j-stevenson-hobsons Sep 8, 2016
45b8859
File was deleted fix put in
malignantz Sep 8, 2016
21d91f1
Merge pull request #12 from bromigos/trailer
ja-stevenson Sep 8, 2016
7619e58
Merge pull request #11 from bromigos/pirateShip2
malignantz Sep 8, 2016
10f64b8
Added dependencies
Sep 8, 2016
1b3019c
app dependencies
Sep 8, 2016
ac6596b
movie li animates on exit
Sep 8, 2016
82860b4
iframe hidden at load
Sep 8, 2016
89c5678
changes to animations, iframe, overview
Sep 8, 2016
e2e654d
comments
a-faraz Sep 8, 2016
f08977e
resize actor images
a-faraz Sep 8, 2016
59a0a8c
animation duration
a-faraz Sep 8, 2016
4033308
modified opacity
a-faraz Sep 9, 2016
64cbed4
Merge pull request #14 from bromigos/feat23
ja-stevenson Sep 9, 2016
c66cfff
trailer and itunes functionality working
ja-stevenson Sep 9, 2016
8ce5c93
Merge pull request #16 from bromigos/itunesSearch
a-faraz Sep 9, 2016
496f755
game made easier
malignantz Sep 9, 2016
75dfad2
Only scrapes when pirate flag button clicked
malignantz Sep 9, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion client/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ angular.module('costars', [
'costars.home',
'costars.game',
'costars.leaderboard',
'ngRoute'])
'ngRoute',
'ng-fx',
'ngAnimate'
])

.config(function($routeProvider, $httpProvider){
$routeProvider
Expand Down
39 changes: 35 additions & 4 deletions client/app/factories.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ angular.module('costars.factories', [])
});
})
.then(function(resp){
// console.log("Success retrieving " + actor + "!\nGot back: ", resp);
console.log("Success retrieving " + actor + "!\nGot back: ", resp);
return resp.data;
})
.catch(function(err){
Expand Down Expand Up @@ -65,7 +65,7 @@ angular.module('costars.factories', [])
});
})
.then(function(resp){
// console.log("Resp directly from discover call: ", resp);
console.log("Resp directly from discover call: ", resp);
return resp.data.results;
})
.catch(function(err){
Expand All @@ -74,10 +74,21 @@ angular.module('costars.factories', [])
throw new Error(err);
});
};

////////*** 2nd attempt to get movie data from canistreamit
var netflix = function(movie){
return $http({
method: "GET",
url: '/' + movie
}).then(function(data){
console.log('netflix checker api call: ', data);
return data
})
}

return {
searchByPerson: searchByPerson,
discover: discover
discover: discover,
netflix: netflix
};
}) //END OF API FACTORY

Expand Down Expand Up @@ -204,4 +215,24 @@ angular.module('costars.factories', [])
getScores: getScores,
postScore: postScore
};
}).factory('PirateShip', function($http){
var getAndVerifyLink = function(movieObj) {
console.log(movieObj);
//use newly created endpoint to get URL, the
var urlTitle = movieObj.original_title.replace(' ','+');

// console.log('getAndVerifyLink:',movieObj);
// window.open("http://putlocker.is/watch-" + movie.split(' ').join('-').split(':').join('').split('&').join('and') + "-online-free-putlocker.html", '_blank');


// readme: need to send server the year.
return $http({method: 'GET',url: '/movielink/'+urlTitle+'?'+movieObj.release_date.substring(0,4)}).then(resp=>{
var url = resp.data;

movieObj.pirate_src = url;
movieObj.pirate_src_fallback = 'not_ready_yet';
console.log(movieObj);
});
};
return {getAndVerifyLink: getAndVerifyLink };
});
4 changes: 2 additions & 2 deletions client/app/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ angular.module('costars.game', [])
$scope.choices.push(correctChoice);
}
else{
if(Math.random() < 0.7){ //reroll 70% of the time -> Increases the number of good questions at the cost of load time
if(Math.random() < 0.99){ //reroll 70% of the time -> Increases the number of good questions at the cost of load time
return $scope.create();
}else{
answer = "";
Expand Down Expand Up @@ -195,7 +195,7 @@ angular.module('costars.game', [])

var startTimer = function(){
stopTimer();
$scope.time = 10; //reset to 10 seconds
$scope.time = 30; //reset to 10 seconds
timer = $interval(function(){
$scope.time -= 1;
if($scope.time <= 0){
Expand Down
22 changes: 16 additions & 6 deletions client/app/home.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<div>
<div class="wrapper">
<h2></h2>
<button class="gameBtn" ng-click="goToGame()">I like games.</button>
<button class="rulesBtn" ng-click="showRules()">{{rules ? "I know how it works" : "I don't know how it works"}}</button>
<!-- <button class="rulesBtn" ng-click="showRules()">{{rules ? "I know how it works" : "I don't know how it works"}}</button> -->
<br>
<div class="embedded">
<iframe ng-show="showIFrame" width=728px height=410px type="text/html" ng-src="{{detailFrame}}" frameborder="1" allowfullscreen></iframe>
</div>
<div class="movieOverview" ng-repeat="movie in movies" ng-show=movie.showOverview>{{movie.title}}
<br><br>{{movie.overview}}</div>
<div class="rules" ng-show=rules>
<br>
How it works:
Expand All @@ -20,7 +25,7 @@ <h2></h2>
<button class="searchBtn" ng-click="addActorInput(actorInput)">Search Actor</button>
</form>
<!--Display for each actor-->
<div class="actorInfo" ng-repeat="actor in currentSearches">
<div class="actorInfo animate fx-bounce-left fx-ease-sine fx-dur-800 fx-stagger-100" style="width:110px;height:160px;" ng-repeat="actor in currentSearches">
<img ng-if=actor.profile_path ng-src='https://image.tmdb.org/t/p/w396/{{actor.profile_path}}'>
<!--"Image not found" image-->
<img ng-if=!actor.profile_path ng-src='http://imgur.com/Rg00Mu8.png'>
Expand All @@ -32,16 +37,21 @@ <h3 class="actorName"> <button class="removeActor" ng-click="removeActorInput(a
<div ng-if="currentSearches.length && !movies.length">No movies found</div>
<ul>
<!--Format for each movie display-->
<li class="movies" ng-repeat="movie in movies" ng-mouseover="showOverview(movie)" ng-mouseleave="hideOverview(movie)">
<div class="movieOverview" ng-show=movie.showOverview>{{movie.title}}
<br><br>{{movie.overview}}</div>
<li class="movies animate fx-bounce-left fx-ease-sine fx-dur-500 fx-stagger-100" ng-repeat="movie in movies" ng-mouseover="showOverview(movie)" ng-mouseleave="hideOverview(movie)">
<img ng-if=movie.poster_path ng-src='https://image.tmdb.org/t/p/w396/{{movie.poster_path}}'>
<!--"Image not found" image-->
<img ng-if=!movie.poster_path ng-src='http://imgur.com/Rg00Mu8.png'>
<div class="movieTitle">{{movie.title}}</div>
<!--Slices the year out of the full release date-->
<div class="movieYear">{{movie.release_date.slice(0,4)}}</div>
<!--Only shows if movie.showOverview, which changes on mouseEnter and mouseLeave-->
<div class="rating">Rating: {{movie.vote_average}}</div>
<button class="watch-trailer" ng-click="watchTrailer(movie)" style="width:137px;">Watch Trailer!</button>
<span>
<button class="watch-free" ng-click="watchForFree(movie)"><img src="http://www.elizabethan-era.org.uk/images/calico-jack-rackhams-pirate-flag.jpg" style="width:25px;height:25px;"></button>
<button class="watch-netflix" ng-disabled="!movie.onNetflix" ng-click="watchOnNetflix(movie)"><img ng-if="movie.onNetflix" ng-src="http://a4.mzstatic.com/eu/r30/Purple71/v4/f9/73/38/f9733819-8408-d6d1-2208-94365fc6e36f/icon175x175.png" style="width:25px;height:25px;"><img ng-if="!movie.onNetflix" ng-src="http://i.imgur.com/Q8jXEk9.png" style="width:25px;height:25px;"></button>
<button class="buy-itunes" ng-click="buyOnItunes(movie.title)"><img src="http://www.teleread.com/wp-content/uploads/2014/09/unnamed.png" style="width:25px;height:25px;"></button>
</span>
</li>
</ul>
</div>
Expand Down
138 changes: 125 additions & 13 deletions client/app/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ angular.module('costars.home' , [])

//THE CONTROLLER FOR THE ENTIRE COSTARS WEBSITE

.controller('HomeController', function($scope, $location, $http, ApiCalls, DB) {
.controller('HomeController', function($scope, $location, $sce, $http, ApiCalls, DB, PirateShip) {
$scope.movies = []; //the movies we're currently displaying
$scope.currentSearches = []; //array of actor objects, stored as {name: String, id: Number, profile_path: String, popularity: Number}
$scope.actorIds = []; //it will be a list of ids
$scope.rules = true; //rules display if this is true
$scope.loaded = true; //displays loading gif if false

$scope.netflixData = []; // will be an array of object with info about netflix
$scope.notOnNetflix = true; // means button won't work until false;
$scope.showIFrame = false; // don't display iframe on load
//getMovies is called every time an actor is removed or added to the list
$scope.getMovies = function (){
if(!$scope.currentSearches.length){
Expand All @@ -19,13 +21,27 @@ angular.module('costars.home' , [])
}
if($scope.currentSearches.length === 1){
//api call for one persons stuff
// console.log("In getMovies, length is one, about to make DB call for: ", $scope.currentSearches[0].name);
//console.log("In getMovies, length is one, about to make DB call for: ", $scope.currentSearches[0].name);
return DB.getActor($scope.currentSearches[0].name)
.then(function(data){
// console.log('DB call getActor retrieved: ', data);
// console.log("Setting $scope.movies to: ", data.known_for);
$scope.movies = data.known_for; //set it to the well known movies
$scope.loaded = true;
//console.log('DB call getActor retrieved: ', data);
//console.log("Setting $scope.movies to: ", data.known_for);
// adds pirate links for movies currently in DB
data.known_for.forEach(function(val){ //*** val.original_title
// set data from netflix call
val.onNetflix = false;
val.external_id = 0;

ApiCalls.netflix(val.original_title)
.then(function(netflixInfo){
val.onNetflix = netflixInfo.data.available;
val.external_id = netflixInfo.data.netflixId;
// PirateShip.getAndVerifyLink(val);
console.log('object after netflix call', data.known_for);
$scope.loaded = true;
})
})
$scope.movies = data.known_for;
})
.catch(function(){
//wasn't in the data base so do an api call, this probably means there's a DB error
Expand All @@ -36,8 +52,21 @@ angular.module('costars.home' , [])
if(data.results[0].profile_path){ //don't store if they don't have a picture
$scope.storeActorDb(data.results[0]);
}
$scope.movies = data.results[0].known_for;
$scope.loaded = true;
data.results[0].known_for.forEach(function(val){ //*** val.original_title
// set data from netflix call
val.onNetflix = false;
val.external_id = 0;

ApiCalls.netflix(val.original_title)
.then(function(netflixInfo){
$scope.loaded = true;
val.onNetflix = netflixInfo.data.available;
val.external_id = netflixInfo.data.netflixId;
//PirateShip.getAndVerifyLink(val);
console.log('object after netflix call', data.results[0].known_for);
})
})
$scope.movies = data.results[0].known_for;
})
.catch(function(err){
console.error("Error making SBP call: ", err);
Expand All @@ -49,14 +78,28 @@ angular.module('costars.home' , [])
return ApiCalls.discover($scope.actorIds)
.then(function(movies) {
// console.log("Movies from discover call: ", movies);
$scope.movies = movies;
$scope.loaded = true;
movies.forEach(function(val){ //*** val.original_title
// set data from netflix call
val.onNetflix = false;
val.external_id = 0;

ApiCalls.netflix(val.original_title)
.then(function(netflixInfo){
$scope.loaded = true;
val.onNetflix = netflixInfo.data.available;
val.external_id = netflixInfo.data.netflixId;
//PirateShip.getAndVerifyLink(val);
console.log('object after netflix call', movies[0]);
})
})
$scope.movies = movies;
})
.catch(function(error) {
console.error("Error making discover call: ", error);
$scope.loaded = true;
});
}

};

/*
Expand All @@ -77,6 +120,9 @@ angular.module('costars.home' , [])
* @param data should be an object, formatted the same as the "results" returned from a SBP API call
*/
$scope.storeActorDb = function(data){
console.log('Store actor Db: ',data);
// PirateShip.getAndVerifyLink(data.known_for[0]);
//console.log('storeActorDb:',data.known_for[0]);
return DB.storeActor(data)
.then(function(resp){
// console.log("actor stored",resp);
Expand Down Expand Up @@ -121,8 +167,21 @@ angular.module('costars.home' , [])
}); //add the actor to our current searches
// console.log("In addActorInput, before getMovies call, currentSearches: ", $scope.currentSearches);
if($scope.currentSearches.length === 1){
$scope.movies = actorData.known_for; //set the movies here, no need to make another DB call
$scope.loaded = true;
actorData.known_for.forEach(function(val){ //*** val.original_title
// set data from netflix call
val.onNetflix = false;
val.external_id = 0;

ApiCalls.netflix(val.original_title)
.then(function(netflixInfo){
$scope.loaded = true;
val.onNetflix = netflixInfo.data.available;
val.external_id = netflixInfo.data.netflixId;
//PirateShip.getAndVerifyLink(val);
console.log('object after netflix call', actorData.known_for);
})
})
$scope.movies = actorData.known_for;
}else{
$scope.getMovies();
}
Expand Down Expand Up @@ -189,6 +248,50 @@ angular.module('costars.home' , [])
}
};

$scope.detailFrame = undefined;

$scope.watchTrailer = function(movie){
console.log("movie info is: ", movie.title)
$http.get("https://www.googleapis.com/youtube/v3/search?part=snippet&order=rating&q=" + movie.title.split(' ').join('+').split(':').join('').split('&').join('and') + movie.release_date.slice(0,4) + "+official+trailer&type=video&videoEmbeddable=true&key=AIzaSyAPOEAEiT5MYrlCXLxn2eVMAShpSTcDpS4")
.then(function(response) {
$scope.showIFrame = true;
var videoId = response.data.items[0].id.videoId;
console.log('youtube api call: ', response.data.items[0].id.videoId);
$scope.detailFrame = $sce.trustAsResourceUrl("https://www.youtube.com/embed/" + videoId + "?autoplay=1");
// $scope.myWelcome = response.data;
});
}

$scope.watchForFree = function(movieInfo){
PirateShip.getAndVerifyLink(movieInfo).then(resp=>{
$scope.showIFrame = true; // display iframe on pirate click
console.log("pirate source is: ", movieInfo.pirate_src);
$scope.detailFrame = $sce.trustAsResourceUrl(movieInfo.pirate_src);
});

// window.open("http://putlocker.is/watch-" + movie.split(' ').join('-').split(':').join('').split('&').join('and') + "-online-free-putlocker.html", '_blank');
}

$scope.watchOnNetflix = function(movieInfo){
var id = movieInfo.external_id
window.open("http://www.netflix.com/watch/" + id);
}

$scope.buyOnItunes = function(movieTitle){
console.log("Link clicked to watch " + movieTitle + " on Amazon.")
$http.jsonp("https://itunes.apple.com/search?callback=JSON_CALLBACK&media=movie&entity=movie&limit=1&explict=yes&term=" + movieTitle.split(' ').join('+').split(':').join('').split('&').join('and'))
.then(function(response) {
var itunesUrl = response.data.results[0].trackViewUrl;
console.log('itunes api call: ', itunesUrl);
window.open(itunesUrl);
})
// $scope.detailFrame = $sce.trustAsResourceUrl("https://www.youtube.com/embed/" + videoId + "?autoplay=1");
// $scope.myWelcome = response.data;
// window.open("http://www.netflix.com/search/" + movie.split(' ').join('-'));
// The following line needs to be changed to work with amazon maybe???
// window.open("http://www.netflix.com/search/" + movie.split(' ').join('-'));
}

$scope.startGame = function(){
$scope.playing = !$scope.playing;
};
Expand All @@ -200,4 +303,13 @@ angular.module('costars.home' , [])
$scope.goToGame = function(){
$location.path("/game");
};

$scope.enableNetflix = function(){
$scope.notOnNetflix = false; // to make button work
};

$scope.disableNetflix = function(){
$scope.notOnNetflix = true; // disable button
};

}); //END OF CONTROLLER
2 changes: 2 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/lumx/dist/lumx.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-animate.js"></script>
<script src="ng-fx.min.js"></script>
<div>
<img class="banner" onclick="location.href = '/#/'; location.reload()" ng-src=https://imgur.com/WRRBDbb.png>
</div>
Expand Down
2 changes: 2 additions & 0 deletions client/ng-fx.min.js

Large diffs are not rendered by default.

Loading