summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2020-07-28 17:21:39 -0400
committerOmar Roth <omarroth@protonmail.com>2020-07-28 17:21:39 -0400
commit62f015fc34194979ef2cbb5bfef2f8df608177bc (patch)
treec43a1547f6fa70d51fd197430a408daa2a12bb1b /src
parentb508787037b24221717ba14844c3734714156445 (diff)
downloadinvidious-62f015fc34194979ef2cbb5bfef2f8df608177bc.tar.gz
invidious-62f015fc34194979ef2cbb5bfef2f8df608177bc.tar.bz2
invidious-62f015fc34194979ef2cbb5bfef2f8df608177bc.zip
Fix playlist export for playlists with more than 100 videos
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index d9db2fda..10722162 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -2449,8 +2449,8 @@ get "/subscription_manager" do |env|
json.field "privacy", playlist.privacy.to_s
json.field "videos" do
json.array do
- get_playlist_videos(PG_DB, playlist, offset: 0, locale: locale, continuation: nil).each_with_index do |video, index|
- json.string video.id
+ PG_DB.query_all("SELECT id FROM playlist_videos WHERE plid = $1 ORDER BY array_position($2, index) LIMIT 500", playlist.id, playlist.index, as: String).each do |video_id|
+ json.string video_id
end
end
end
@@ -2563,7 +2563,9 @@ post "/data_control" do |env|
playlist = create_playlist(PG_DB, title, privacy, user)
PG_DB.exec("UPDATE playlists SET description = $1 WHERE id = $2", description, playlist.id)
- videos = item["videos"]?.try &.as_a?.try &.each do |video_id|
+ videos = item["videos"]?.try &.as_a?.try &.each_with_index do |video_id, idx|
+ raise "Playlist cannot have more than 500 videos" if idx > 500
+
video_id = video_id.try &.as_s?
next if !video_id