mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	Merge branch 'dev' of github.com:nixolas1/Zoff into dev
This commit is contained in:
		| @@ -115,6 +115,7 @@ io.on('connection', function(socket){ | ||||
|   	var id = arr[0]; | ||||
|   	var title = arr[1]; | ||||
|     var hash = hash_pass(arr[2]); | ||||
|     var duration = arr[3]; | ||||
|     db.collection(coll).find({views:{$exists:true}}, function(err, docs) | ||||
|     { | ||||
|       if((docs[0]["addsongs"] == true && (hash == docs[0]["adminpass"] || docs[0]["adminpass"] == "")) || docs[0]["addsongs"] == false) | ||||
| @@ -129,7 +130,7 @@ io.on('connection', function(socket){ | ||||
|                 np = true; | ||||
|               else | ||||
|                 np = false; | ||||
|         			db.collection(coll).insert({"added":get_time(),"guids":guids,"id":id,"now_playing":np,"title":title,"votes":votes}, function(err, docs){ | ||||
|         			db.collection(coll).insert({"added":get_time(),"guids":guids,"id":id,"now_playing":np,"title":title,"votes":votes, "duration":duration}, function(err, docs){ | ||||
|       		  		sort_list(coll, undefined, np); | ||||
|       		  	}); | ||||
|             }); | ||||
| @@ -327,6 +328,7 @@ function vote(coll, id, guid, socket) | ||||
| function change_song(coll, id, np_id) | ||||
| { | ||||
|   db.collection(coll).find({views:{$exists:true}}, function(err, docs){ | ||||
|     var startTime = docs[0]["startTime"]; | ||||
|     if(docs[0]["removeplay"] == true) | ||||
|     { | ||||
|       db.collection(coll).remove({now_playing:true}, function(err, docs) | ||||
| @@ -349,18 +351,19 @@ function change_song(coll, id, np_id) | ||||
|               change_song_post(coll); | ||||
|         }); | ||||
|       }else{ | ||||
|         console.log(id); | ||||
|         console.log(np_id); | ||||
|         db.collection(coll).update({now_playing:true, id:id}, | ||||
|           {$set:{ | ||||
|             now_playing:false, | ||||
|             votes:0, | ||||
|             guids:[] | ||||
|           }}, function(err, docs) | ||||
|         db.collection(coll).find({id:id}, function(err, docs){ | ||||
|           if(startTime+docs[0]["duration"]<=get_time()-1) | ||||
|           { | ||||
|               console.log(err); | ||||
|               console.log(docs); | ||||
|               change_song_post(coll); | ||||
|             db.collection(coll).update({now_playing:true, id:id}, | ||||
|               {$set:{ | ||||
|                 now_playing:false, | ||||
|                 votes:0, | ||||
|                 guids:[] | ||||
|               }}, function(err, docs) | ||||
|               { | ||||
|                   change_song_post(coll); | ||||
|             }); | ||||
|           } | ||||
|         }); | ||||
|       } | ||||
|     } | ||||
|   | ||||
| @@ -141,7 +141,7 @@ function search(search_input){ | ||||
| 								var video_thumb = "http://i.ytimg.com/vi/"+data.id+"/default.jpg"; | ||||
| 								var length = Math.floor(data.duration/60)+":"+(data.duration-Math.floor(data.duration / 60)*60); | ||||
| 								var finalhtml="\ | ||||
| 								<div id='result' class='result' onclick=\"submitAndClose('"+data.id+"','"+video_title+"');\">\ | ||||
| 								<div id='result' class='result' onclick=\"submitAndClose('"+data.id+"','"+video_title+"', "+data.duration+");\">\ | ||||
| 									<img src='"+video_thumb+"' class='thumb'>\ | ||||
| 									<div id='title'>"+data.title+"\ | ||||
| 										<div class='result_info'>"+views+" views • "+length+"</div>\ | ||||
| @@ -179,16 +179,16 @@ function search(search_input){ | ||||
|  | ||||
| } | ||||
|  | ||||
| function submitAndClose(id,title){ | ||||
| 	submit(id,title, true); | ||||
| function submitAndClose(id,title,duration){ | ||||
| 	submit(id,title, true, duration); | ||||
| 	$("#results").html(''); | ||||
| 	console.log("sub&closed"); | ||||
|  | ||||
| } | ||||
|  | ||||
| function submit(id,title,type){ | ||||
| function submit(id,title,type, duration){ | ||||
|  | ||||
| 	socket.emit("add", [id, decodeURIComponent(title), adminpass]); | ||||
| 	socket.emit("add", [id, decodeURIComponent(title), adminpass, duration]); | ||||
| 	if(type){ | ||||
| 		document.getElementById("search").value = ""; | ||||
| 		$("#results").html = ""; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user