mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Improved finding errorounus songs, and fix error with embedded player
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
|
||||
var slider_type = "horizontal";
|
||||
var timed_remove_check;
|
||||
var gotten_np = false;
|
||||
var song_title = "";
|
||||
var paused = false;
|
||||
var player_ready = false;
|
||||
|
||||
@@ -153,7 +153,7 @@ var List = {
|
||||
|
||||
changedValues: function(song) {
|
||||
var i = List.getIndexOfSong(song.id);
|
||||
if(i >= 0) {
|
||||
if(i >= 0 && window.location.pathname != "/") {
|
||||
full_playlist[i].title = song.title;
|
||||
full_playlist[i].duration = song.duration;
|
||||
full_playlist[i].start = song.start;
|
||||
@@ -289,26 +289,34 @@ var List = {
|
||||
$("#settings").css("opacity", "1");
|
||||
$("#wrapper").css("opacity", "1");
|
||||
|
||||
clearTimeout(timed_remove_check);
|
||||
timed_remove_check = setTimeout(function() {
|
||||
$.each(full_playlist, function(j, _current_song) {
|
||||
$.getJSON('https://www.googleapis.com/youtube/v3/videos?id=' + _current_song.id
|
||||
+ "&key=" + api_key + "&part=snippet",
|
||||
function (data, status, xhr) {
|
||||
if (data.items.length == 0) {
|
||||
setTimeout(function() {
|
||||
socket.emit("error_video", {channel: chan.toLowerCase(), id: _current_song.id, title: _current_song.title});
|
||||
}, 500);
|
||||
}
|
||||
if(!embed) {
|
||||
clearTimeout(timed_remove_check);
|
||||
timed_remove_check = setTimeout(function() {
|
||||
if(full_playlist.length > 0) {
|
||||
List.check_error_videos(0);
|
||||
}
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
|
||||
}).error(function (xhr, errorType, exception) {
|
||||
//var errorMessage = exception || xhr.statusText || xhr.responseText;
|
||||
setTimeout(function() {
|
||||
socket.emit("error_video", {channel: chan.toLowerCase(), id: _current_song.id, title: _current_song.title});
|
||||
}, 500);
|
||||
});
|
||||
check_error_videos: function(i) {
|
||||
console.log(i);
|
||||
$.getJSON('https://www.googleapis.com/youtube/v3/videos?id=' + full_playlist[i].id
|
||||
+ "&key=" + api_key + "&part=snippet",
|
||||
function (data, status, xhr) {
|
||||
if (data.items.length == 0) {
|
||||
socket.emit("error_video", {channel: chan.toLowerCase(), id: full_playlist[i].id, title: full_playlist[i].title});
|
||||
}
|
||||
if(full_playlist.length > i + 1 && window.location.pathname != "/") {
|
||||
List.check_error_videos(i + 1);
|
||||
}
|
||||
|
||||
}).error(function (xhr, errorType, exception) {
|
||||
socket.emit("error_video", {channel: chan.toLowerCase(), id: full_playlist[i].id, title: full_playlist[i].title});
|
||||
if(full_playlist.length > i + 1 && window.location.pathname != "/") {
|
||||
List.check_error_videos(i + 1);
|
||||
}
|
||||
});
|
||||
}, 1500);
|
||||
},
|
||||
|
||||
dynamicContentPageJumpTo: function(page) {
|
||||
|
||||
@@ -594,6 +594,12 @@ var Player = {
|
||||
//currDurr = currDurr - Player.np.start;
|
||||
minutes = Math.floor(currDurr / 60);
|
||||
seconds = currDurr - (minutes * 60);
|
||||
/*if(isNan(minutes)) {
|
||||
minutes = 0;
|
||||
}
|
||||
if(isNan(seconds)) {
|
||||
seconds = 0;
|
||||
}*/
|
||||
document.getElementById("duration").innerHTML = Helper.pad(minutes)+":"+Helper.pad(seconds)+" <span id='dash'>/</span> "+Helper.pad(dMinutes)+":"+Helper.pad(dSeconds);
|
||||
per = (100 / duration) * currDurr;
|
||||
if(per >= 100) {
|
||||
|
||||
Reference in New Issue
Block a user