mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Merge pull request #522 from zoff-music/fix/520
Other channel is the counter and deciding part
This commit is contained in:
@@ -200,70 +200,88 @@ 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(
|
||||||
"frontpage_lists"
|
new_channel
|
||||||
).find(
|
).find(
|
||||||
{
|
{
|
||||||
_id: new_channel
|
now_playing: true
|
||||||
},
|
},
|
||||||
function(e, doc) {
|
function(
|
||||||
if (
|
e,
|
||||||
doc.length >
|
np_docs
|
||||||
0 &&
|
) {
|
||||||
((doc[0]
|
to_change.id =
|
||||||
.thumbnail !=
|
np_docs[0].id;
|
||||||
"" &&
|
to_change.title =
|
||||||
doc[0]
|
np_docs[0].title;
|
||||||
.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"
|
||||||
).update(
|
).find(
|
||||||
{
|
{
|
||||||
_id: channel
|
_id: new_channel
|
||||||
},
|
},
|
||||||
{
|
function(
|
||||||
$set: to_change
|
e,
|
||||||
},
|
doc
|
||||||
function(e, d) {
|
) {
|
||||||
List.send_list(
|
if (
|
||||||
channel,
|
doc.length >
|
||||||
undefined,
|
0 &&
|
||||||
false,
|
((doc[0]
|
||||||
true,
|
.thumbnail !=
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user