mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed issues with window-history and soundcloud.load function
This commit is contained in:
@@ -17,11 +17,12 @@ function frontpage_lists(msg, socket) {
|
||||
});
|
||||
}
|
||||
|
||||
function update_frontpage(coll, id, title, callback) {
|
||||
function update_frontpage(coll, id, title, thumbnail, callback) {
|
||||
coll = coll.replace(/ /g,'');
|
||||
db.collection("frontpage_lists").update({_id: coll}, {$set: {
|
||||
id: id,
|
||||
title: title,
|
||||
thumbnail: thumbnail,
|
||||
accessed: Functions.get_time()}
|
||||
},{upsert: true}, function(err, returnDocs){
|
||||
if(typeof(callback) == "function") callback();
|
||||
|
||||
@@ -471,6 +471,7 @@ module.exports = function() {
|
||||
socket.on('change_channel', function(obj)
|
||||
{
|
||||
if(obj == undefined && coll != undefined) {
|
||||
obj = {};
|
||||
obj.channel = coll;
|
||||
} else if(obj.hasOwnProperty("channel") && obj.channel.indexOf("?") > -1){
|
||||
var _list = obj.channel.substring(0, obj.channel.indexOf("?"));
|
||||
|
||||
@@ -382,7 +382,7 @@ function change_song_post(coll, next_song, callback, socket) {
|
||||
List.send_play(coll, socket, true);
|
||||
callback();
|
||||
}
|
||||
Frontpage.update_frontpage(coll, docs[0].id, docs[0].title);
|
||||
Frontpage.update_frontpage(coll, docs[0].id, docs[0].title, docs[0].thumbnail);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -440,7 +440,7 @@ function send_list(coll, socket, send, list_send, configs, shuffled)
|
||||
skips:[]
|
||||
}
|
||||
}, function(err, returnDocs){
|
||||
Frontpage.update_frontpage(coll, now_playing_doc[0].id, now_playing_doc[0].title);
|
||||
Frontpage.update_frontpage(coll, now_playing_doc[0].id, now_playing_doc[0].title, now_playing_doc[0].thumbnail);
|
||||
List.send_list(coll, socket, send, list_send, configs, shuffled);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -88,6 +88,7 @@ function addFromOtherList(arr, guid, offline, socket) {
|
||||
db.collection(channel).find({now_playing: true}, function(e, np_docs) {
|
||||
to_change.id = np_docs[0].id;
|
||||
to_change.title = np_docs[0].title;
|
||||
to_change.thumbnail = np_docs[0].thumbnail;
|
||||
db.collection("frontpage_lists").update({_id: channel}, {$set: to_change}, function(e, d) {
|
||||
List.send_list(channel, undefined, false, true, false);
|
||||
List.send_play(channel, undefined);
|
||||
@@ -218,6 +219,7 @@ function addPlaylist(arr, guid, offline, socket) {
|
||||
db.collection(channel).find({now_playing: true}, function(e, np_docs) {
|
||||
to_change.id = np_docs[0].id;
|
||||
to_change.title = np_docs[0].title;
|
||||
to_change.thumbnail = np_docs[0].thumbnail;
|
||||
db.collection("frontpage_lists").update({_id: channel}, {$set: to_change}, function(e, d) {
|
||||
List.send_list(channel, undefined, false, true, false);
|
||||
List.send_play(channel, undefined);
|
||||
@@ -387,7 +389,8 @@ function add_function(arr, coll, guid, offline, socket) {
|
||||
List.send_list(coll, undefined, false, true, false);
|
||||
db.collection(coll + "_settings").update({ id: "config" }, {$set:{startTime: Functions.get_time()}});
|
||||
List.send_play(coll, undefined);
|
||||
Frontpage.update_frontpage(coll, id, title);
|
||||
var thumbnail = arr.thumbnail != undefined ? arr.thumbnail : undefined;
|
||||
Frontpage.update_frontpage(coll, id, title, thumbnail);
|
||||
if(source != "soundcloud") Search.get_correct_info(new_song, coll, false);
|
||||
} else {
|
||||
io.to(coll).emit("channel", {type: "added", value: new_song});
|
||||
|
||||
Reference in New Issue
Block a user