mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-06 05:24:28 -04:00
set max_lookback as configurable
This commit is contained in:
parent
ce45203fcf
commit
c9e89b2353
2 changed files with 4 additions and 4 deletions
|
@ -67,7 +67,6 @@ SOFTWARE = {
|
||||||
}
|
}
|
||||||
|
|
||||||
YT_POOL = YoutubeConnectionPool.new(YT_URL, capacity: CONFIG.pool_size, timeout: 2.0, use_quic: CONFIG.use_quic)
|
YT_POOL = YoutubeConnectionPool.new(YT_URL, capacity: CONFIG.pool_size, timeout: 2.0, use_quic: CONFIG.use_quic)
|
||||||
MAX_LOOKBACK = 20
|
|
||||||
|
|
||||||
# CLI
|
# CLI
|
||||||
Kemal.config.extra_options do |parser|
|
Kemal.config.extra_options do |parser|
|
||||||
|
@ -2463,9 +2462,9 @@ end
|
||||||
next error_json(404, "Playlist does not exist.")
|
next error_json(404, "Playlist does not exist.")
|
||||||
end
|
end
|
||||||
|
|
||||||
# includes into the playlist a maximum of 20 videos, before the offset
|
# includes into the playlist a maximum of CONFIG.max_loopback videos, before the offset
|
||||||
if offset > 0
|
if offset > 0
|
||||||
lookback = offset < MAX_LOOKBACK ? offset : MAX_LOOKBACK
|
lookback = offset < CONFIG.max_loopback ? offset : CONFIG.max_loopback
|
||||||
response = playlist.to_json(offset - lookback, locale)
|
response = playlist.to_json(offset - lookback, locale)
|
||||||
json_response = JSON.parse(response)
|
json_response = JSON.parse(response)
|
||||||
else
|
else
|
||||||
|
@ -2480,7 +2479,7 @@ end
|
||||||
|
|
||||||
if json_response["videos"].as_a[0]["index"] != offset
|
if json_response["videos"].as_a[0]["index"] != offset
|
||||||
offset = json_response["videos"].as_a[0]["index"].as_i
|
offset = json_response["videos"].as_a[0]["index"].as_i
|
||||||
lookback = offset < MAX_LOOKBACK ? offset : MAX_LOOKBACK
|
lookback = offset < CONFIG.max_loopback ? offset : CONFIG.max_loopback
|
||||||
response = playlist.to_json(offset - lookback, locale)
|
response = playlist.to_json(offset - lookback, locale)
|
||||||
json_response = JSON.parse(response)
|
json_response = JSON.parse(response)
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,6 +73,7 @@ class Config
|
||||||
property output : String = "STDOUT" # Log file path or STDOUT
|
property output : String = "STDOUT" # Log file path or STDOUT
|
||||||
property log_level : LogLevel = LogLevel::Info # Default log level, valid YAML values are ints and strings, see src/invidious/helpers/logger.cr
|
property log_level : LogLevel = LogLevel::Info # Default log level, valid YAML values are ints and strings, see src/invidious/helpers/logger.cr
|
||||||
property db : DBConfig? = nil # Database configuration with separate parameters (username, hostname, etc)
|
property db : DBConfig? = nil # Database configuration with separate parameters (username, hostname, etc)
|
||||||
|
property max_loopback : Int32 = 100 # Maximum videos to be loaded into the playlist before the video playing
|
||||||
|
|
||||||
@[YAML::Field(converter: Preferences::URIConverter)]
|
@[YAML::Field(converter: Preferences::URIConverter)]
|
||||||
property database_url : URI = URI.parse("") # Database configuration using 12-Factor "Database URL" syntax
|
property database_url : URI = URI.parse("") # Database configuration using 12-Factor "Database URL" syntax
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue