mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Updated thumbnailchecking
- Borrowing youtube 404 image for now if someone tries to trick the server to use other thumbnail than soundlcoud thumbnail when adding soundcloud song - Setting thumbnail in db even for youtube-videos, for more consistency
This commit is contained in:
@@ -245,23 +245,26 @@ var List = {
|
||||
|
||||
check_error_videos: function(i) {
|
||||
//Helper.log("Empty-checker at " + i);
|
||||
if(full_playlist.length == 0 || full_playlist[i].source == "soundcloud") return;
|
||||
Helper.ajax({
|
||||
method: "get",
|
||||
url: 'https://www.googleapis.com/youtube/v3/videos?id=' + full_playlist[i].id
|
||||
+ "&key=" + api_key + "&part=snippet",
|
||||
success: function (data) {
|
||||
data = JSON.parse(data);
|
||||
//Helper.log("Empty-checker items " + data.items.length);
|
||||
if (data.items.length == 0) {
|
||||
Helper.log(["Emtpy-checker error at " + full_playlist[i].id + " " + full_playlist[i].title]);
|
||||
socket.emit("error_video", {channel: chan.toLowerCase(), id: full_playlist[i].id, title: full_playlist[i].title, source: full_playlist[i].source});
|
||||
if(full_playlist.length == 0) return;
|
||||
else if(full_playlist[i].source == "soundcloud" && full_playlist.length > i + 1 && window.location.pathname != "/") List.check_error_videos(i + 1);
|
||||
else {
|
||||
Helper.ajax({
|
||||
method: "get",
|
||||
url: 'https://www.googleapis.com/youtube/v3/videos?id=' + full_playlist[i].id
|
||||
+ "&key=" + api_key + "&part=snippet",
|
||||
success: function (data) {
|
||||
data = JSON.parse(data);
|
||||
//Helper.log("Empty-checker items " + data.items.length);
|
||||
if (data.items.length == 0) {
|
||||
Helper.log(["Emtpy-checker error at " + full_playlist[i].id + " " + full_playlist[i].title]);
|
||||
socket.emit("error_video", {channel: chan.toLowerCase(), id: full_playlist[i].id, title: full_playlist[i].title, source: full_playlist[i].source});
|
||||
}
|
||||
if(full_playlist.length > i + 1 && window.location.pathname != "/") {
|
||||
List.check_error_videos(i + 1);
|
||||
}
|
||||
}
|
||||
if(full_playlist.length > i + 1 && window.location.pathname != "/") {
|
||||
List.check_error_videos(i + 1);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
dynamicContentPageJumpTo: function(page) {
|
||||
|
||||
Reference in New Issue
Block a user