mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 09:50:24 +00:00
Fix for error-video in list not being updated when replaced
This commit is contained in:
@@ -199,7 +199,6 @@ function skip(list, guid, coll, offline, socket, callback) {
|
||||
} else if(trueError) {
|
||||
error = true;
|
||||
}
|
||||
error = false;
|
||||
hash = adminpass;
|
||||
//db.collection(coll + "_settings").find(function(err, docs){
|
||||
var strictSkip = false;
|
||||
|
||||
@@ -11,6 +11,7 @@ try {
|
||||
}
|
||||
var request = require('request');
|
||||
var db = require(pathThumbnails + '/handlers/db.js');
|
||||
var countryCodes = ["US", "NO", "SE", "DK", "CA", "EU", "UK"];
|
||||
|
||||
function check_if_error_or_blocked(id, channel, errored, callback) {
|
||||
if(!errored) {
|
||||
@@ -26,7 +27,7 @@ function check_if_error_or_blocked(id, channel, errored, callback) {
|
||||
if(song_info.source != "soundcloud") {
|
||||
request({
|
||||
type: "GET",
|
||||
url: "https://www.googleapis.com/youtube/v3/videos?part=id,status&key="+key+"&id=" + song_info.id,
|
||||
url: "https://www.googleapis.com/youtube/v3/videos?part=id,status,contentDetails&key="+key+"&id=" + song_info.id,
|
||||
}, function(error, response, body) {
|
||||
try {
|
||||
var resp = JSON.parse(body);
|
||||
@@ -36,7 +37,17 @@ function check_if_error_or_blocked(id, channel, errored, callback) {
|
||||
} else if(!resp.items[0].status.embeddable) {
|
||||
callback(true);
|
||||
return;
|
||||
}
|
||||
} else if(resp.items[0].contentDetails.hasOwnProperty("regionRestriction") &&
|
||||
resp.items[0].contentDetails.regionRestriction.hasOwnProperty("blocked") &&
|
||||
resp.items[0].contentDetails.regionRestriction.blocked.length > 0) {
|
||||
var any = resp.items[0].contentDetails.blocked.some(function(element) {
|
||||
return countryCodes.indexOf(element) > -1;
|
||||
});
|
||||
if(any) {
|
||||
callback(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
callback(false);
|
||||
return;
|
||||
} catch(e){
|
||||
|
||||
@@ -86,13 +86,13 @@ var List = {
|
||||
changedValues: function(song) {
|
||||
if(song.type == "suggested") {
|
||||
try {
|
||||
document.getElementById("#suggested-" + song.id).querySelector(".vote-container").setAttribute("title", song.title);
|
||||
document.getElementById("#suggested-" + song.id).querySelector(".list-title").setAttribute("title", song.title);
|
||||
document.getElementById("#suggested-" + song.id).querySelector(".list-title").innerText = song.title;
|
||||
document.querySelector("#suggested-" + song.id).querySelector(".vote-container").setAttribute("title", song.title);
|
||||
document.querySelector("#suggested-" + song.id).querySelector(".list-title").setAttribute("title", song.title);
|
||||
document.querySelector("#suggested-" + song.id).querySelector(".list-title").innerText = song.title;
|
||||
var _temp_duration = Helper.secondsToOther(song.duration);
|
||||
document.getElementById("#suggested-" + song.id).querySelector(".card-duration").innerText = Helper.pad(_temp_duration[0]) + ":" + Helper.pad(_temp_duration[1]);
|
||||
document.getElementById("#suggested-" + song.id).querySelector(".list-image").setAttribute("style", "background-image:url('//img.youtube.com/vi/"+song.new_id+"/mqdefault.jpg');");
|
||||
document.getElementById("#suggested-" + song.id).setAttribute("id", song.new_id);
|
||||
document.querySelector("#suggested-" + song.id).querySelector(".card-duration").innerText = Helper.pad(_temp_duration[0]) + ":" + Helper.pad(_temp_duration[1]);
|
||||
document.querySelector("#suggested-" + song.id).querySelector(".list-image").setAttribute("style", "background-image:url('//img.youtube.com/vi/"+song.new_id+"/mqdefault.jpg');");
|
||||
document.querySelector("#suggested-" + song.id).setAttribute("id", song.new_id);
|
||||
} catch(e) {}
|
||||
return;
|
||||
}
|
||||
@@ -104,13 +104,13 @@ var List = {
|
||||
full_playlist[i].end = song.end;
|
||||
full_playlist[i].id = song.new_id;
|
||||
try {
|
||||
document.getElementById("#" + song.id).querySelector(".vote-container").setAttribute("title", song.title);
|
||||
document.getElementById("#" + song.id).querySelector(".list-title").setAttribute("title", song.title);
|
||||
document.getElementById("#" + song.id).querySelector(".list-title").innerText = song.title;
|
||||
document.querySelector("#" + song.id).querySelector(".vote-container").setAttribute("title", song.title);
|
||||
document.querySelector("#" + song.id).querySelector(".list-title").setAttribute("title", song.title);
|
||||
document.querySelector("#" + song.id).querySelector(".list-title").innerText = song.title;
|
||||
var _temp_duration = Helper.secondsToOther(song.duration);
|
||||
document.getElementById("#" + song.id).querySelector(".card-duration").innerText = Helper.pad(_temp_duration[0]) + ":" + Helper.pad(_temp_duration[1]);
|
||||
document.getElementById("#" + song.id).querySelector(".list-image").setAttribute("style", "background-image:url('//img.youtube.com/vi/"+song.new_id+"/mqdefault.jpg');");
|
||||
document.getElementById("#" + song.id).setAttribute("id", song.new_id);
|
||||
document.querySelector("#" + song.id).querySelector(".card-duration").innerText = Helper.pad(_temp_duration[0]) + ":" + Helper.pad(_temp_duration[1]);
|
||||
document.querySelector("#" + song.id).querySelector(".list-image").setAttribute("style", "background-image:url('//img.youtube.com/vi/"+song.new_id+"/mqdefault.jpg');");
|
||||
document.querySelector("#" + song.id).setAttribute("id", song.new_id);
|
||||
} catch(e) {}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user