mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-22 16:19:53 +05:30
Playlists: Fix pagination of Invidious playlists (#3861)
This commit is contained in:
commit
ff6166edf7
@ -421,8 +421,13 @@ module Invidious::Routes::Playlists
|
|||||||
return error_template(500, ex)
|
return error_template(500, ex)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if playlist.is_a? InvidiousPlaylist
|
||||||
|
page_count = (playlist.video_count / 100).to_i
|
||||||
|
page_count += 1 if (playlist.video_count % 100) > 0
|
||||||
|
else
|
||||||
page_count = (playlist.video_count / 200).to_i
|
page_count = (playlist.video_count / 200).to_i
|
||||||
page_count += 1 if (playlist.video_count % 200) > 0
|
page_count += 1 if (playlist.video_count % 200) > 0
|
||||||
|
end
|
||||||
|
|
||||||
if page > page_count
|
if page > page_count
|
||||||
return env.redirect "/playlist?list=#{plid}&page=#{page_count}"
|
return env.redirect "/playlist?list=#{plid}&page=#{page_count}"
|
||||||
@ -433,7 +438,11 @@ module Invidious::Routes::Playlists
|
|||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if playlist.is_a? InvidiousPlaylist
|
||||||
|
items = get_playlist_videos(playlist, offset: (page - 1) * 100)
|
||||||
|
else
|
||||||
items = get_playlist_videos(playlist, offset: (page - 1) * 200)
|
items = get_playlist_videos(playlist, offset: (page - 1) * 200)
|
||||||
|
end
|
||||||
rescue ex
|
rescue ex
|
||||||
return error_template(500, "Error encountered while retrieving playlist videos.<br>#{ex.message}")
|
return error_template(500, "Error encountered while retrieving playlist videos.<br>#{ex.message}")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user