Fix playlist limit
This commit is contained in:
parent
4818b89ab1
commit
7c45026383
4 changed files with 13 additions and 13 deletions
|
@ -453,7 +453,13 @@ feed_threads: 1
|
||||||
##
|
##
|
||||||
#modified_source_code_url: ""
|
#modified_source_code_url: ""
|
||||||
|
|
||||||
|
##
|
||||||
|
## Maximum custom playlist length limit.
|
||||||
|
##
|
||||||
|
## Accepted values: Integer
|
||||||
|
## Default: 500
|
||||||
|
##
|
||||||
|
#playlist_length_limit: 500
|
||||||
|
|
||||||
#########################################
|
#########################################
|
||||||
#
|
#
|
||||||
|
@ -869,11 +875,3 @@ default_user_preferences:
|
||||||
## Default: false
|
## Default: false
|
||||||
##
|
##
|
||||||
#extend_desc: false
|
#extend_desc: false
|
||||||
|
|
||||||
##
|
|
||||||
## Maximum custom playlist length limit.
|
|
||||||
##
|
|
||||||
## Accepted values: Integer
|
|
||||||
## Default: 500
|
|
||||||
##
|
|
||||||
#playlist_length_limit: 500
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ module Invidious::Database::PlaylistVideos
|
||||||
return PG_DB.query_one?(request, plid, index, as: String)
|
return PG_DB.query_one?(request, plid, index, as: String)
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_ids(plid : String, index : VideoIndex, limit = CONFIG.playlist_length_limit) : Array(String)
|
def select_ids(plid : String, index : VideoIndex, limit = 500) : Array(String)
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT id FROM playlist_videos
|
SELECT id FROM playlist_videos
|
||||||
WHERE plid = $1
|
WHERE plid = $1
|
||||||
|
|
|
@ -120,7 +120,7 @@ module Invidious::Routes::Subscriptions
|
||||||
json.field "privacy", playlist.privacy.to_s
|
json.field "privacy", playlist.privacy.to_s
|
||||||
json.field "videos" do
|
json.field "videos" do
|
||||||
json.array do
|
json.array do
|
||||||
Invidious::Database::PlaylistVideos.select_ids(playlist.id, playlist.index, limit: CONFIG.playlist_length_limit).each do |video_id|
|
Invidious::Database::PlaylistVideos.select_ids(playlist.id, playlist.index, limit: 500).each do |video_id|
|
||||||
json.string video_id
|
json.string video_id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,7 +71,9 @@ struct Invidious::User
|
||||||
Invidious::Database::Playlists.update_description(playlist.id, description)
|
Invidious::Database::Playlists.update_description(playlist.id, description)
|
||||||
|
|
||||||
videos = item["videos"]?.try &.as_a?.try &.each_with_index do |video_id, idx|
|
videos = item["videos"]?.try &.as_a?.try &.each_with_index do |video_id, idx|
|
||||||
raise InfoException.new("Playlist cannot have more than #{CONFIG.playlist_length_limit} videos") if idx > 500
|
if idx > CONFIG.playlist_length_limit
|
||||||
|
raise InfoException.new("Playlist cannot have more than #{CONFIG.playlist_length_limit} videos")
|
||||||
|
end
|
||||||
|
|
||||||
video_id = video_id.try &.as_s?
|
video_id = video_id.try &.as_s?
|
||||||
next if !video_id
|
next if !video_id
|
||||||
|
|
Loading…
Reference in a new issue