mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-19 04:34:30 -05:00
Remove useless auto_generated param from PlaylistVideo#to_xml
given the variables available in this function's context, 'author' and 'ucid' provide the same data 'self.author' and 'self.ucid', respectively. Given that fact, the variable `auto_generated` has no impact on the logic of this function, and hence can be safely removed. this greatly simplifies the code and makes it perfectly compatible with crystal's calling convention for '#to_xml' methods.
This commit is contained in:
parent
86f75758a7
commit
6cf0ff6b49
@ -11,7 +11,7 @@ struct PlaylistVideo
|
|||||||
property index : Int64
|
property index : Int64
|
||||||
property live_now : Bool
|
property live_now : Bool
|
||||||
|
|
||||||
def to_xml(auto_generated, xml : XML::Builder)
|
def to_xml(xml : XML::Builder)
|
||||||
xml.element("entry") do
|
xml.element("entry") do
|
||||||
xml.element("id") { xml.text "yt:video:#{self.id}" }
|
xml.element("id") { xml.text "yt:video:#{self.id}" }
|
||||||
xml.element("yt:videoId") { xml.text self.id }
|
xml.element("yt:videoId") { xml.text self.id }
|
||||||
@ -20,13 +20,8 @@ struct PlaylistVideo
|
|||||||
xml.element("link", rel: "alternate", href: "#{HOST_URL}/watch?v=#{self.id}")
|
xml.element("link", rel: "alternate", href: "#{HOST_URL}/watch?v=#{self.id}")
|
||||||
|
|
||||||
xml.element("author") do
|
xml.element("author") do
|
||||||
if auto_generated
|
xml.element("name") { xml.text self.author }
|
||||||
xml.element("name") { xml.text self.author }
|
xml.element("uri") { xml.text "#{HOST_URL}/channel/#{self.ucid}" }
|
||||||
xml.element("uri") { xml.text "#{HOST_URL}/channel/#{self.ucid}" }
|
|
||||||
else
|
|
||||||
xml.element("name") { xml.text author }
|
|
||||||
xml.element("uri") { xml.text "#{HOST_URL}/channel/#{ucid}" }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
xml.element("content", type: "xhtml") do
|
xml.element("content", type: "xhtml") do
|
||||||
@ -47,14 +42,8 @@ struct PlaylistVideo
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_xml(auto_generated, xml : XML::Builder? = nil)
|
def to_xml(_xml : Nil = nil)
|
||||||
if xml
|
XML.build { |xml| to_xml(xml) }
|
||||||
to_xml(auto_generated, xml)
|
|
||||||
else
|
|
||||||
XML.build do |xml|
|
|
||||||
to_xml(auto_generated, xml)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_json(json : JSON::Builder, index : Int32? = nil)
|
def to_json(json : JSON::Builder, index : Int32? = nil)
|
||||||
|
@ -281,9 +281,7 @@ module Invidious::Routes::Feeds
|
|||||||
xml.element("name") { xml.text playlist.author }
|
xml.element("name") { xml.text playlist.author }
|
||||||
end
|
end
|
||||||
|
|
||||||
videos.each do |video|
|
videos.each &.to_xml(xml)
|
||||||
video.to_xml(false, xml)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user