mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-02 11:41:08 +05:30
Query DB for timestamps after current id
This commit is contained in:
parent
472a2d7e76
commit
510d85c045
@ -200,19 +200,12 @@ if (!video_data.params.listen && video_data.vr && video_data.params.vr_mode) {
|
|||||||
// Add markers
|
// Add markers
|
||||||
if (video_data.params.video_start > 0 || video_data.params.video_end > 0) {
|
if (video_data.params.video_start > 0 || video_data.params.video_end > 0) {
|
||||||
var markers = [{ time: video_data.params.video_start, text: 'Start' }];
|
var markers = [{ time: video_data.params.video_start, text: 'Start' }];
|
||||||
if (video_data.starting_timestamp_seconds) {
|
|
||||||
markers = [{ time: video_data.starting_timestamp_seconds, text: 'Start' }];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!video_data.ending_timestamp_seconds) {
|
|
||||||
if (video_data.params.video_end < 0) {
|
if (video_data.params.video_end < 0) {
|
||||||
markers.push({ time: video_data.length_seconds - 0.5, text: 'End' });
|
markers.push({ time: video_data.length_seconds - 0.5, text: 'End' });
|
||||||
} else {
|
} else {
|
||||||
markers.push({ time: video_data.params.video_end, text: 'End' });
|
markers.push({ time: video_data.params.video_end, text: 'End' });
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
markers.push({ time: video_data.ending_timestamp_seconds, text: 'End' });
|
|
||||||
}
|
|
||||||
|
|
||||||
player.markers({
|
player.markers({
|
||||||
onMarkerReached: function (marker) {
|
onMarkerReached: function (marker) {
|
||||||
|
@ -111,6 +111,7 @@ function get_compilation(compid) {
|
|||||||
compid_url = '/api/v1/compilations/' + compid +
|
compid_url = '/api/v1/compilations/' + compid +
|
||||||
'?index=' + video_data.index +
|
'?index=' + video_data.index +
|
||||||
'&continuation=' + video_data.id +
|
'&continuation=' + video_data.id +
|
||||||
|
//'&t=' + video_data.video_data.starting_timestamp_seconds +
|
||||||
'&format=html&hl=' + video_data.preferences.locale;
|
'&format=html&hl=' + video_data.preferences.locale;
|
||||||
|
|
||||||
console.log("Send "+compid_url);
|
console.log("Send "+compid_url);
|
||||||
@ -138,6 +139,7 @@ function get_compilation(compid) {
|
|||||||
url.searchParams.set('speed', video_data.params.speed);
|
url.searchParams.set('speed', video_data.params.speed);
|
||||||
if (video_data.params.local !== video_data.preferences.local)
|
if (video_data.params.local !== video_data.preferences.local)
|
||||||
url.searchParams.set('local', video_data.params.local);
|
url.searchParams.set('local', video_data.params.local);
|
||||||
|
url.searchParams.set('t',video_data.starting_timestamp_seconds);
|
||||||
|
|
||||||
location.assign(url.pathname + url.search);
|
location.assign(url.pathname + url.search);
|
||||||
});
|
});
|
||||||
|
@ -128,7 +128,7 @@ module Invidious::Database::Compilations
|
|||||||
LIMIT 1
|
LIMIT 1
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
PG_DB.query_one?(request, id, as: String)
|
PG_DB.query_one?(request, id, as: Array(Int64))
|
||||||
end
|
end
|
||||||
|
|
||||||
# -------------------
|
# -------------------
|
||||||
|
@ -45,12 +45,27 @@ module Invidious::Routes::Watch
|
|||||||
elsif env.params.query["list"]?.try &.starts_with? "IVCMP"
|
elsif env.params.query["list"]?.try &.starts_with? "IVCMP"
|
||||||
compid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
|
compid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
|
||||||
if (!compid.nil?)
|
if (!compid.nil?)
|
||||||
timestamps = Invidious::Database::CompilationVideos.select_timestamps(compid, id)
|
index=Invidious::Database::CompilationVideos.select_index(compid,id)
|
||||||
|
indices_array=Invidious::Database::Compilations.select_index_array(compid)
|
||||||
|
if (!indices_array.nil?)
|
||||||
|
position_of_index=indices_array.index(index)
|
||||||
|
if (!position_of_index.nil? && position_of_index != indices_array.size - 1)
|
||||||
|
next_index=indices_array[position_of_index+1]
|
||||||
|
else
|
||||||
|
next_index=indices_array[0]
|
||||||
|
end
|
||||||
|
if (!next_index.nil?)
|
||||||
|
next_id=Invidious::Database::CompilationVideos.select_id_from_index(next_index)
|
||||||
|
if (!next_id.nil?)
|
||||||
|
timestamps = Invidious::Database::CompilationVideos.select_timestamps(compid, next_id)
|
||||||
if (!timestamps.nil?)
|
if (!timestamps.nil?)
|
||||||
starting_timestamp_seconds=timestamps[0]
|
starting_timestamp_seconds=timestamps[0]
|
||||||
ending_timestamp_seconds=timestamps[1]
|
ending_timestamp_seconds=timestamps[1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
continuation = process_continuation(env.params.query, compid, id)
|
continuation = process_continuation(env.params.query, compid, id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user