aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2023-12-04 18:48:41 +0530
committersinanmohd <sinan@sinanmohd.com>2023-12-04 19:04:30 +0530
commit421aeafa298f020f9a83e427d908b753fdb54a7d (patch)
treebde25c2f824cdf21f6a457d7d0c6a6533a84bf52
parenta30a250c87c0641ee1267107689fba3c6ca7fc8e (diff)
mpv: check nil for duration property
for live streams mpv will return nil
-rw-r--r--main.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/main.lua b/main.lua
index 98a4ad1..21854df 100644
--- a/main.lua
+++ b/main.lua
@@ -21,10 +21,10 @@ local sub_needed = function ()
return false
end
- duration = tonumber(mp.get_property('duration'))
- if duration < 900 then -- duration is less than 15 minutes
+ duration = mp.get_property('duration')
+ if not duration or tonumber(duration) < 900 then
return false
- end
+ end -- ensure duration is less than 15 minutes
for _, v in pairs(mp.get_property_native('track-list')) do
if v['type'] == 'sub' then