mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed thumbnail issue
This commit is contained in:
@@ -17,7 +17,7 @@ function frontpage_lists(msg, socket) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_frontpage(coll, id, title, thumbnail, callback) {
|
function update_frontpage(coll, id, title, thumbnail, source, callback) {
|
||||||
coll = coll.replace(/ /g,'');
|
coll = coll.replace(/ /g,'');
|
||||||
db.collection("frontpage_lists").find({_id: coll}, function(e, doc) {
|
db.collection("frontpage_lists").find({_id: coll}, function(e, doc) {
|
||||||
var updateObject = {
|
var updateObject = {
|
||||||
@@ -25,7 +25,7 @@ function update_frontpage(coll, id, title, thumbnail, callback) {
|
|||||||
title: title,
|
title: title,
|
||||||
accessed: Functions.get_time()
|
accessed: Functions.get_time()
|
||||||
};
|
};
|
||||||
if(doc.length > 0 && (doc[0].thumbnail == "" || doc[0].thumbnail == undefined || doc[0].thumbnail.indexOf("ttps://i1.sndcdn.com") > -1)) {
|
if(doc.length > 0 && ((doc[0].thumbnail != "" && doc[0].thumbnail != undefined && doc[0].thumbnail.indexOf("https://i1.sndcdn.com") > -1) || (doc[0].thumbnail == "" || doc[0].thumbnail == undefined))) {
|
||||||
updateObject.thumbnail = thumbnail;
|
updateObject.thumbnail = thumbnail;
|
||||||
if(thumbnail == undefined) updateObject.thumbnail = "";
|
if(thumbnail == undefined) updateObject.thumbnail = "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ function change_song_post(coll, next_song, callback, socket) {
|
|||||||
List.send_play(coll, socket, true);
|
List.send_play(coll, socket, true);
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
Frontpage.update_frontpage(coll, docs[0].id, docs[0].title, docs[0].thumbnail);
|
Frontpage.update_frontpage(coll, docs[0].id, docs[0].title, docs[0].thumbnail, docs[0].source);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -439,7 +439,7 @@ function send_list(coll, socket, send, list_send, configs, shuffled)
|
|||||||
skips:[]
|
skips:[]
|
||||||
}
|
}
|
||||||
}, function(err, returnDocs){
|
}, function(err, returnDocs){
|
||||||
Frontpage.update_frontpage(coll, now_playing_doc[0].id, now_playing_doc[0].title, now_playing_doc[0].thumbnail);
|
Frontpage.update_frontpage(coll, now_playing_doc[0].id, now_playing_doc[0].title, now_playing_doc[0].thumbnail, now_playing_doc[0].source);
|
||||||
List.send_list(coll, socket, send, list_send, configs, shuffled);
|
List.send_list(coll, socket, send, list_send, configs, shuffled);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ function addFromOtherList(arr, guid, offline, socket) {
|
|||||||
project_object.now_playing = { "$literal": false };
|
project_object.now_playing = { "$literal": false };
|
||||||
to_set_np = false;
|
to_set_np = false;
|
||||||
}
|
}
|
||||||
db.collection(new_channel + "_settings").find({id: "config"}, function(e, new_conf) {
|
db.collection(new_channel + "_settings").find({id: "config"}, function(e, this_conf) {
|
||||||
if(new_conf.length > 0 && (new_conf[0].userpass == "" || !new_conf[0].userpass || new_conf[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(otheruser)).digest("base64"))) {
|
if(this_conf.length > 0 && (this_conf[0].userpass == "" || !this_conf[0].userpass || this_conf[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(otheruser)).digest("base64"))) {
|
||||||
db.collection(channel + "_settings").find({id: "config"}, function(e, this_conf) {
|
db.collection(channel + "_settings").find({id: "config"}, function(e, this_conf) {
|
||||||
var hash = Functions.hash_pass(Functions.hash_pass(Functions.decrypt_string(arr.adminpass), true));
|
var hash = Functions.hash_pass(Functions.hash_pass(Functions.decrypt_string(arr.adminpass), true));
|
||||||
if((this_conf[0].userpass == "" || !this_conf[0].userpass || this_conf[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(arr.userpass)).digest("base64"))) {
|
if((this_conf[0].userpass == "" || !this_conf[0].userpass || this_conf[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(arr.userpass)).digest("base64"))) {
|
||||||
@@ -89,7 +89,7 @@ function addFromOtherList(arr, guid, offline, socket) {
|
|||||||
to_change.id = np_docs[0].id;
|
to_change.id = np_docs[0].id;
|
||||||
to_change.title = np_docs[0].title;
|
to_change.title = np_docs[0].title;
|
||||||
db.collection("frontpage_lists").find({_id: coll}, function(e, doc) {
|
db.collection("frontpage_lists").find({_id: coll}, function(e, doc) {
|
||||||
if(doc.length > 0 && doc[0].thumbnail != "" && doc[0].thumbnail != undefined) {
|
if(doc.length > 0 && ((doc[0].thumbnail != "" && doc[0].thumbnail != undefined && doc[0].thumbnail.indexOf("https://i1.sndcdn.com") > -1) || (doc[0].thumbnail == "" || doc[0].thumbnail == undefined))) {
|
||||||
to_change.thumbnail = np_docs[0].thumbnail;
|
to_change.thumbnail = np_docs[0].thumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ function addPlaylist(arr, guid, offline, socket) {
|
|||||||
to_change.id = np_docs[0].id;
|
to_change.id = np_docs[0].id;
|
||||||
to_change.title = np_docs[0].title;
|
to_change.title = np_docs[0].title;
|
||||||
db.collection("frontpage_lists").find({_id: channel}, function(e, doc) {
|
db.collection("frontpage_lists").find({_id: channel}, function(e, doc) {
|
||||||
if(doc.length > 0 && doc[0].thumbnail != "" && doc[0].thumbnail != undefined) {
|
if(doc.length > 0 && ((doc[0].thumbnail != "" && doc[0].thumbnail != undefined && doc[0].thumbnail.indexOf("https://i1.sndcdn.com") > -1) || (doc[0].thumbnail == "" || doc[0].thumbnail == undefined))) {
|
||||||
to_change.thumbnail = np_docs[0].thumbnail;
|
to_change.thumbnail = np_docs[0].thumbnail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ function add_function(arr, coll, guid, offline, socket) {
|
|||||||
db.collection(coll + "_settings").update({ id: "config" }, {$set:{startTime: Functions.get_time()}});
|
db.collection(coll + "_settings").update({ id: "config" }, {$set:{startTime: Functions.get_time()}});
|
||||||
List.send_play(coll, undefined);
|
List.send_play(coll, undefined);
|
||||||
var thumbnail = arr.thumbnail != undefined ? arr.thumbnail : undefined;
|
var thumbnail = arr.thumbnail != undefined ? arr.thumbnail : undefined;
|
||||||
Frontpage.update_frontpage(coll, id, title, thumbnail);
|
Frontpage.update_frontpage(coll, id, title, thumbnail, arr.source);
|
||||||
if(source != "soundcloud") Search.get_correct_info(new_song, coll, false);
|
if(source != "soundcloud") Search.get_correct_info(new_song, coll, false);
|
||||||
} else {
|
} else {
|
||||||
io.to(coll).emit("channel", {type: "added", value: new_song});
|
io.to(coll).emit("channel", {type: "added", value: new_song});
|
||||||
|
|||||||
@@ -712,7 +712,6 @@ router.route('/api/list/:channel_name/:video_id').post(function(req,res) {
|
|||||||
var type = fetch_only ? "fetch_song" : "add";
|
var type = fetch_only ? "fetch_song" : "add";
|
||||||
validateLogin(adminpass, userpass, channel_name, type, res, function(exists, conf, authenticated) {
|
validateLogin(adminpass, userpass, channel_name, type, res, function(exists, conf, authenticated) {
|
||||||
db.collection(channel_name).find({id: video_id}, function(err, result) {
|
db.collection(channel_name).find({id: video_id}, function(err, result) {
|
||||||
console.log(result);
|
|
||||||
if(result.length == 0 || result[0].type == "suggested") {
|
if(result.length == 0 || result[0].type == "suggested") {
|
||||||
var song_type = authenticated ? "video" : "suggested";
|
var song_type = authenticated ? "video" : "suggested";
|
||||||
if(fetch_only && result.length == 0) {
|
if(fetch_only && result.length == 0) {
|
||||||
@@ -764,7 +763,7 @@ router.route('/api/list/:channel_name/:video_id').post(function(req,res) {
|
|||||||
});
|
});
|
||||||
} else if(set_np) {
|
} else if(set_np) {
|
||||||
var thumbnail = req.body.thumbnail != undefined ? req.body.thumbnail : undefined;
|
var thumbnail = req.body.thumbnail != undefined ? req.body.thumbnail : undefined;
|
||||||
Frontpage.update_frontpage(channel_name, video_id, title, thumbnail, function() {
|
Frontpage.update_frontpage(channel_name, video_id, title, thumbnail, source, function() {
|
||||||
io.to(channel_name).emit("np", {np: [new_song], conf: [conf]});
|
io.to(channel_name).emit("np", {np: [new_song], conf: [conf]});
|
||||||
postEnd(channel_name, configs, new_song, guid, res, authenticated, authorized);
|
postEnd(channel_name, configs, new_song, guid, res, authenticated, authorized);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user