<commit_before>module.exports = function(app, passport) {

// normal routes ===============================================================
	var multipart = require('connect-multiparty');
	var multipartMiddleware = multipart();
	var fs = require('fs');
	var Upload = require('../app/models/upload');
	var flash = require('connect-flash');
	var omdb = require('omdb');
	var session = require('express-session');
	var request = require('request');
	var mdb = require('moviedb')('3e5eb7fc233740076d8b3044de9ef228');

	// show the home page (will also have our login links)
	app.get('/', function(req, res) {
		// Sessions to register what to send user to after login etc.
		req.session.lastPage = "/";

		res.render('pages/index.ejs', {
			user : req.user
		}); 
	});
	
	// show the home page (will also have our login links)
	app.get('/about', function(req, res) {
		// Sessions to register what to send user to after login etc.
		req.session.lastPage = "/about";

		res.render('pages/about.ejs', {
			user : req.user
		});
	});
	
	// show the home page (will also have our login links)
	// PROFILE SECTION =========================
	app.get('/profile', isLoggedIn, function(req, res) {
		// Sessions to register what to send user to after login etc.
		req.session.lastPage = "/profile";

		res.render('pages/profile.ejs', {
			user : req.user
		});
	});	
	
	
	// // PROFILE SECTION =========================
	app.get('/myuploads', isLoggedIn, function(req, res) {
		

		// Sessions to register what to send user to after login etc.
		req.session.lastPage = "/myuploads";

		// Determine user_id
		if(req.user.facebook.id) {
	    	var userid = req.user.facebook.id;
	    }
	    else if(req.user.google.id) {
	    	var userid = req.user.google.id;
	    }

	   
	    allinfo = [];
		movieinfo = [];
		modusdata = [];
		i = 0;
	    
	    //console.log(userid);
	    getUploadedMovies(userid, function(modusinfo){
			
			console.log('Got uploaded movies for user '+userid);

			function final(){
	    		
				movieinfo.forEach(function(object){
					//console.log(modusdata.id);
					// Function to convert string value in "bpmvalue" to precision 3
					bpmvalue = parseFloat(modusdata[i].bpmvalue).toPrecision(3);
					console.log(object);
					allinfo.push({
						"upload_id" : modusdata[i]._id,
						"title" : object.title,
						"year" : object.year,
						"bpmvalue" : bpmvalue,
						"poster_path" : object.poster_path,
						"bpmdata" : modusdata[i].bpmdata
					})
					//console.log(allinfo);
<<<<<<< HEAD
					
=======
>>>>>>> 10e6fa37b1c69147846d65fdff27c6fc37e34b7f
					i++;
					
				});
				//res.send(allinfo);
				res.render('pages/myuploads.ejs', { data: allinfo, user: req.user });
	    	}
			
			function series(obj){
				//console.log(modusinfo);
				modusdata.push(obj);

				if(obj){
					getMovieInfo(obj.imdb_id, function(omdb, poster){
						
						omdb = JSON.parse(JSON.stringify(omdb));
<<<<<<< HEAD
						
=======
						//console.log('omdb.title');
						//console.log(omdb);
>>>>>>> 10e6fa37b1c69147846d65fdff27c6fc37e34b7f
						movieinfo.push({
						    "title" : omdb[0]['title'],
						    "year" : omdb[0]['year'],
						    "rating" : omdb[0]['rating'],
						    "poster_path" : poster

						});
						
						return series(modusinfo.shift());
					
					});
				}
				else{<commit_msg>Commiting and fixing merge error in routes.js<commit_after>module.exports = function(app, passport) {

// normal routes ===============================================================
	var multipart = require('connect-multiparty');
	var multipartMiddleware = multipart();
	var fs = require('fs');
	var Upload = require('../app/models/upload');
	var flash = require('connect-flash');
	var omdb = require('omdb');
	var session = require('express-session');
	var request = require('request');
	var mdb = require('moviedb')('3e5eb7fc233740076d8b3044de9ef228');

	// show the home page (will also have our login links)
	app.get('/', function(req, res) {
		// Sessions to register what to send user to after login etc.
		req.session.lastPage = "/";

		res.render('pages/index.ejs', {
			user : req.user
		}); 
	});
	
	// show the home page (will also have our login links)
	app.get('/about', function(req, res) {
		// Sessions to register what to send user to after login etc.
		req.session.lastPage = "/about";

		res.render('pages/about.ejs', {
			user : req.user
		});
	});
	
	// show the home page (will also have our login links)
	// PROFILE SECTION =========================
	app.get('/profile', isLoggedIn, function(req, res) {
		// Sessions to register what to send user to after login etc.
		req.session.lastPage = "/profile";

		res.render('pages/profile.ejs', {
			user : req.user
		});
	});	
	
	
	// // PROFILE SECTION =========================
	app.get('/myuploads', isLoggedIn, function(req, res) {
		

		// Sessions to register what to send user to after login etc.
		req.session.lastPage = "/myuploads";

		// Determine user_id
		if(req.user.facebook.id) {
	    	var userid = req.user.facebook.id;
	    }
	    else if(req.user.google.id) {
	    	var userid = req.user.google.id;
	    }

	   
	    allinfo = [];
		movieinfo = [];
		modusdata = [];
		i = 0;
	    
	    //console.log(userid);
	    getUploadedMovies(userid, function(modusinfo){
			
			console.log('Got uploaded movies for user '+userid);

			function final(){
	    		
				movieinfo.forEach(function(object){
					//console.log(modusdata.id);
					// Function to convert string value in "bpmvalue" to precision 3
					bpmvalue = parseFloat(modusdata[i].bpmvalue).toPrecision(3);
					console.log(object);
					allinfo.push({
						"upload_id" : modusdata[i]._id,
						"title" : object.title,
						"year" : object.year,
						"bpmvalue" : bpmvalue,
						"poster_path" : object.poster_path,
						"bpmdata" : modusdata[i].bpmdata
					})
					//console.log(allinfo);

					i++;
					
				});
				//res.send(allinfo);
				res.render('pages/myuploads.ejs', { data: allinfo, user: req.user });
	    	}
			
			function series(obj){
				//console.log(modusinfo);
				modusdata.push(obj);

				if(obj){
					getMovieInfo(obj.imdb_id, function(omdb, poster){
						
						omdb = JSON.parse(JSON.stringify(omdb));

						movieinfo.push({
						    "title" : omdb[0]['title'],
						    "year" : omdb[0]['year'],
						    "rating" : omdb[0]['rating'],
						    "poster_path" : poster

						});
						
						return series(modusinfo.shift());
					
					});
				}
				else{
{'fraction_non_alphanumeric': 0.1882644372193838, 'fraction_numerical': 0.01579191825359963, 'mean_word_length': 2.8452380952380953, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5470760', 'n_tokens_mistral': 2707, 'n_tokens_neox': 2121, 'n_words': 461}