Code: Select all
system_time = string.format((TIME_Thm and "%02d:%02d" or "%02d:%02d:%02d") , (systemTime.hour<13 and systemTime.hour or systemTime.hour%12), systemTime.min, systemTime.sec)..(systemTime.hour<12 and "a" or "p")
Code: Select all
ending_time = TIME_Time2string(ending_time, 0, nil, TIME_Thm) -- h:m > D/h:m
-- 12-hour format
local h=tonumber(string.match(ending_time,"(%d%d):"))
ending_time = string.gsub(ending_time, "%d%d:", string.format("%02d:", (h<13 and h or h%12)), 1)..(h<12 and "a" or "p")
Code: Select all
ending_time = TIME_Time2string(ending_time, 0, nil, TIME_Thm) -- h:m > D/h:m
-- 12-hour format
local t = os.time({year=1970, month=1, day=1, hour=tonumber(string.match(ending_time,"(%d%d):")), min=0, sec=0})
local hh = os.date("%I", t)
local ampm = os.date("%p", t)
ending_time = string.gsub(ending_time, "%d%d:", hh..":", 1)..ampm
The O time string can be reprocessed.I can add the "[T] 12hr" checkbox in the future. USA?Code: Select all
ending_time = TIME_Time2string(ending_time, 0, nil, TIME_Thm) -- h:m > D/h:m -- 12-hour format local h=tonumber(string.match(ending_time,"(%d%d):")) ending_time = string.gsub(ending_time, "%d%d:", string.format("%02d:", (h<13 and h or h%12)), 1)..(h<12 and "a" or "p")
But the previous update to format "[T] actual time" doesn't seem to account for midnight and still displays as "00:00 AM" instead of "12:00 AM".orCode: Select all
ending_time = TIME_Time2string(ending_time, 0, nil, TIME_Thm) -- h:m > D/h:m -- 12-hour format local t = os.time({year=1970, month=1, day=1, hour=tonumber(string.match(ending_time,"(%d%d):")), min=0, sec=0}) local hh = os.date("%I", t) local ampm = os.date("%p", t) ending_time = string.gsub(ending_time, "%d%d:", hh..":", 1)..ampm
I tried to update the script to format the "[T] actual time" as "12:00 AM" instead of "00:00 AM", but no dice.I can show you, how to format T time. Edit the "time_intf.lua" file in a text editor. Find the line:
system_time = string.format(...The O time would be more complicated to do as it is formatted within general TIME_Time2string() function. ending_time = TIME_Time2string(...Code: Select all
system_time = string.format((TIME_Thm and "%02d:%02d" or "%02d:%02d:%02d") , (systemTime.hour<13 and systemTime.hour or systemTime.hour%12), systemTime.min, systemTime.sec)..(systemTime.hour<12 and "a" or "p")
Code: Select all
system_time = string.format((TIME_Thm and "%02d:%02d" or "%02d:%02d:%02d") , (systemTime.hour<13 and (systemTime.hour>0 and systemTime.hour or 12) or systemTime.hour%12), systemTime.min, systemTime.sec)..(systemTime.hour<12 and "a" or "p")
Code: Select all
local t = os.time({year=1970, month=1, day=1, hour=systemTime.hour, min=0, sec=0})
local hh = os.date("%I", t)
local ampm = os.date("%p", t)
system_time = string.format((TIME_Thm and "%02d:%02d" or "%02d:%02d:%02d") , hh, systemTime.min, systemTime.sec)..ampm
dementia
1 year ago
Updated code- 1) Detects the currently playing video stream used to determine the FPS. 2) changed variable from "fps" to "vlc_fps" so as not to clobber an existing variable. The following code goes directly above the line
"local osd_output = string.gsub(TIME_time_format, "%[E%]", elapsed_time)"
local input_object_info = vlc.input.item():info()
local key
local value
local vlc_fps
local cur_stream_name = "Stream " .. vlc.var.get(input, "video-es")
for key, value in pairs( input_object_info ) do
if key == cur_stream_name and value["Frame rate"] then
vlc_fps = value["Frame rate"]
end
end
if not vlc_fps then vlc_fps="--" end
To add an [F] tag to display the video FPS, the following line goes directly below the same line-- "local osd_output = string.gsub(TIME_time_format, "%[E%]", elapsed_time)"
osd_output = string.gsub(osd_output, "%[F%]", vlc_fps)
Thank you mederi for the nice plugin.Patches published at http://addons.videolan.org/content/show ... ent=149618
Elapsed time with miliseconds:
...
Code: Select all
...
vlc.osd.message(TIME_Decode_time_format(), 1111111111, TIME_osd_position)
...
Code: Select all
...
local f = vlc.io.open("/Users/f/Library/Application Support/org.videolan.vlc/lua/intf/time_marquee.txt", "w")
if f then
f:write(TIME_Decode_time_format())
f:close()
end
...
Code: Select all
...
local f = vlc.io.open(vlc.config.userdatadir().."\\lua\\intf\\time_marquee.txt", "w")
if f then
f:write(TIME_Decode_time_format())
f:close()
end
...
Return to “Scripting VLC in lua”
Users browsing this forum: No registered users and 2 guests