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 id = arr[0];
|
||||||
var title = arr[1];
|
var title = arr[1];
|
||||||
var hash = hash_pass(arr[2]);
|
var hash = hash_pass(arr[2]);
|
||||||
|
var duration = arr[3];
|
||||||
db.collection(coll).find({views:{$exists:true}}, function(err, docs)
|
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)
|
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;
|
np = true;
|
||||||
else
|
else
|
||||||
np = false;
|
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);
|
sort_list(coll, undefined, np);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -327,6 +328,7 @@ function vote(coll, id, guid, socket)
|
|||||||
function change_song(coll, id, np_id)
|
function change_song(coll, id, np_id)
|
||||||
{
|
{
|
||||||
db.collection(coll).find({views:{$exists:true}}, function(err, docs){
|
db.collection(coll).find({views:{$exists:true}}, function(err, docs){
|
||||||
|
var startTime = docs[0]["startTime"];
|
||||||
if(docs[0]["removeplay"] == true)
|
if(docs[0]["removeplay"] == true)
|
||||||
{
|
{
|
||||||
db.collection(coll).remove({now_playing:true}, function(err, docs)
|
db.collection(coll).remove({now_playing:true}, function(err, docs)
|
||||||
@@ -349,8 +351,9 @@ function change_song(coll, id, np_id)
|
|||||||
change_song_post(coll);
|
change_song_post(coll);
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
console.log(id);
|
db.collection(coll).find({id:id}, function(err, docs){
|
||||||
console.log(np_id);
|
if(startTime+docs[0]["duration"]<=get_time()-1)
|
||||||
|
{
|
||||||
db.collection(coll).update({now_playing:true, id:id},
|
db.collection(coll).update({now_playing:true, id:id},
|
||||||
{$set:{
|
{$set:{
|
||||||
now_playing:false,
|
now_playing:false,
|
||||||
@@ -358,11 +361,11 @@ function change_song(coll, id, np_id)
|
|||||||
guids:[]
|
guids:[]
|
||||||
}}, function(err, docs)
|
}}, function(err, docs)
|
||||||
{
|
{
|
||||||
console.log(err);
|
|
||||||
console.log(docs);
|
|
||||||
change_song_post(coll);
|
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 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 length = Math.floor(data.duration/60)+":"+(data.duration-Math.floor(data.duration / 60)*60);
|
||||||
var finalhtml="\
|
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'>\
|
<img src='"+video_thumb+"' class='thumb'>\
|
||||||
<div id='title'>"+data.title+"\
|
<div id='title'>"+data.title+"\
|
||||||
<div class='result_info'>"+views+" views • "+length+"</div>\
|
<div class='result_info'>"+views+" views • "+length+"</div>\
|
||||||
@@ -179,16 +179,16 @@ function search(search_input){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitAndClose(id,title){
|
function submitAndClose(id,title,duration){
|
||||||
submit(id,title, true);
|
submit(id,title, true, duration);
|
||||||
$("#results").html('');
|
$("#results").html('');
|
||||||
console.log("sub&closed");
|
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){
|
if(type){
|
||||||
document.getElementById("search").value = "";
|
document.getElementById("search").value = "";
|
||||||
$("#results").html = "";
|
$("#results").html = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user