This commit is contained in:
Kasper Rynning-Tønnesen
2019-07-31 13:02:41 +02:00
parent b3a7b95fd6
commit 3739a15049

View File

@@ -200,88 +200,70 @@ function addFromOtherList(arr, guid, offline, socket) {
frontpage: true, frontpage: true,
accessed: Functions.get_time() accessed: Functions.get_time()
}; };
to_change.id =
np[0].id;
to_change.title =
np[0].title;
db.collection( db.collection(
channel "frontpage_lists"
).find( ).find(
{ {
now_playing: true _id: new_channel
}, },
function( function(e, doc) {
e, if (
np_docs doc.length >
) { 0 &&
to_change.id = ((doc[0]
np_docs[0].id; .thumbnail !=
to_change.title = "" &&
np_docs[0].title; doc[0]
.thumbnail !=
undefined &&
(doc[0].thumbnail.indexOf(
"https://i1.sndcdn.com"
) > -1 ||
doc[0].thumbnail.indexOf(
"https://w1.sndcdn.com"
) > -1)) ||
(doc[0]
.thumbnail ==
"" ||
doc[0]
.thumbnail ==
undefined))
) {
to_change.thumbnail =
np[0].thumbnail;
}
db.collection( db.collection(
"frontpage_lists" "frontpage_lists"
).find( ).update(
{ {
_id: new_channel _id: channel
}, },
function( {
e, $set: to_change
doc },
) { function(e, d) {
if ( List.send_list(
doc.length > channel,
0 && undefined,
((doc[0] false,
.thumbnail != true,
"" && false
doc[0]
.thumbnail !=
undefined &&
(doc[0].thumbnail.indexOf(
"https://i1.sndcdn.com"
) > -1 ||
doc[0].thumbnail.indexOf(
"https://w1.sndcdn.com"
) >
-1)) ||
(doc[0]
.thumbnail ==
"" ||
doc[0]
.thumbnail ==
undefined))
) {
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
);
socket.emit(
"toast",
"addedplaylist"
);
_db.close();
}
); );
List.send_play(
channel,
undefined
);
socket.emit(
"toast",
"addedplaylist"
);
_db.close();
} }
); );
} }