summaryrefslogtreecommitdiffstats
path: root/player/lua
diff options
context:
space:
mode:
authorJulian <MyFakeAcc.4@googlemail.com>2015-05-07 00:18:35 +0200
committerwm4 <wm4@nowhere>2017-10-09 20:40:31 +0200
commita78fce46765c75a47512cd4d638b66fa9a40bd31 (patch)
tree8992df51492d1c8f14e9a1732df51671559f7f9e /player/lua
parent81efbc3921b411065774efa7c56f24046e598531 (diff)
downloadmpv-a78fce46765c75a47512cd4d638b66fa9a40bd31.tar.bz2
mpv-a78fce46765c75a47512cd4d638b66fa9a40bd31.tar.xz
stats: don't add superfluous EOL characters
Previously we unnecessarily added newline characters at the end. Only noticeable when printed on terminal, though.
Diffstat (limited to 'player/lua')
-rw-r--r--player/lua/stats.lua21
1 files changed, 12 insertions, 9 deletions
diff --git a/player/lua/stats.lua b/player/lua/stats.lua
index e7e119a4f1..961a326217 100644
--- a/player/lua/stats.lua
+++ b/player/lua/stats.lua
@@ -86,8 +86,6 @@ function add_file(s)
if append_property(s, "file", "cache-used", "Cache:") then
append_property_inline(s, "file", "demuxer-cache-duration", "+", " sec", true, true)
end
-
- s.file = s.file .. o.nl .. o.nl
end
@@ -116,8 +114,6 @@ function add_video(s)
append_property(s, "video", "video-params/primaries", "Primaries:")
append_property(s, "video", "video-params/colorlevels", "Levels:")
append_property(s, "video", "packet-video-bitrate", "Bitrate:", " kbps")
-
- s.video = s.video .. o.nl .. o.nl
end
@@ -132,8 +128,6 @@ function add_audio(s)
append_property(s, "audio", "audio-samplerate", "Sample Rate:")
append_property(s, "audio", "audio-channels", "Channels:")
append_property(s, "audio", "packet-audio-bitrate", "Bitrate:", " kbps")
-
- s.audio = s.audio .. o.nl .. o.nl
end
@@ -199,7 +193,16 @@ end
function join_stats(s)
- return s.header .. s.file .. s.video .. s.audio
+ r = s.header .. s.file
+
+ if s.video and s.video ~= "" then
+ r = r .. o.nl .. o.nl .. s.video
+ end
+ if s.audio and s.audio ~= "" then
+ r = r .. o.nl .. o.nl .. s.audio
+ end
+
+ return r
end
@@ -210,13 +213,13 @@ end
function has_video()
local r = mp.get_property("video")
- return r ~= nil and r ~= "no" and r ~= ""
+ return r and r ~= "no" and r ~= ""
end
function has_audio()
local r = mp.get_property("audio")
- return r ~= nil and r ~= "no" and r ~= ""
+ return r and r ~= "no" and r ~= ""
end