mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-22 16:19:53 +05:30
Refactor storyboard generation
This commit is contained in:
parent
d36c536107
commit
9dcc87c705
@ -715,14 +715,15 @@ struct Video
|
|||||||
storyboards = player_response["storyboards"]?
|
storyboards = player_response["storyboards"]?
|
||||||
.try &.as_h
|
.try &.as_h
|
||||||
.try &.["playerStoryboardSpecRenderer"]?
|
.try &.["playerStoryboardSpecRenderer"]?
|
||||||
|
.try &.["spec"]?
|
||||||
|
.try &.as_s.split("|")
|
||||||
|
|
||||||
if !storyboards
|
if !storyboards
|
||||||
storyboards = player_response["storyboards"]?
|
if storyboard = player_response["storyboards"]?
|
||||||
.try &.as_h
|
.try &.as_h
|
||||||
.try &.["playerLiveStoryboardSpecRenderer"]?
|
.try &.["playerLiveStoryboardSpecRenderer"]?
|
||||||
|
.try &.["spec"]?
|
||||||
if storyboard = storyboards.try &.["spec"]?
|
.try &.as_s
|
||||||
.try &.as_s
|
|
||||||
return [{
|
return [{
|
||||||
url: storyboard.split("#")[0],
|
url: storyboard.split("#")[0],
|
||||||
width: 106,
|
width: 106,
|
||||||
@ -736,9 +737,6 @@ struct Video
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
storyboards = storyboards.try &.["spec"]?
|
|
||||||
.try &.as_s.split("|")
|
|
||||||
|
|
||||||
items = [] of NamedTuple(
|
items = [] of NamedTuple(
|
||||||
url: String,
|
url: String,
|
||||||
width: Int32,
|
width: Int32,
|
||||||
@ -767,6 +765,7 @@ struct Video
|
|||||||
interval = interval.to_i
|
interval = interval.to_i
|
||||||
storyboard_width = storyboard_width.to_i
|
storyboard_width = storyboard_width.to_i
|
||||||
storyboard_height = storyboard_height.to_i
|
storyboard_height = storyboard_height.to_i
|
||||||
|
storyboard_count = (count / (storyboard_width * storyboard_height)).ceil.to_i
|
||||||
|
|
||||||
items << {
|
items << {
|
||||||
url: url.to_s.sub("$L", i).sub("$N", "M$M"),
|
url: url.to_s.sub("$L", i).sub("$N", "M$M"),
|
||||||
@ -776,7 +775,7 @@ struct Video
|
|||||||
interval: interval,
|
interval: interval,
|
||||||
storyboard_width: storyboard_width,
|
storyboard_width: storyboard_width,
|
||||||
storyboard_height: storyboard_height,
|
storyboard_height: storyboard_height,
|
||||||
storyboard_count: (count.to_f / (storyboard_width.to_f * storyboard_height.to_f)).ceil.to_i,
|
storyboard_count: storyboard_count,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user