Module:Ep time

local p = {} -- function to create and format the reference function p.epTime(frame) -- ep=|part=|vod=|START|END|cite=|punc=|hideep=|hidewords= -- receiving parameters local ep = frame.args["ep"] or "" local part = frame.args["part"] or nil local vod = frame.args["vod"] or nil local startTime = frame.args[1] or nil local endTime = frame.args[2] or nil local cite = frame.args["cite"] or nil local punc = frame.args["punc"] or nil local hideep = frame.args["hideep"] or nil local hidewords = frame.args["hidewords"] or nil -- get YouTube URL from Module:Ep/YTURLSwitcher/URLs local ytURL = mw.loadData('Module:Ep/YTURLSwitcher/URLs') local url if isnotempty(vod) then url = vod elseif isnotempty(part) then url = ytURL[epCode .. part] else url = ytURL[epCode] or ytURL["default"] end

-- convert the input into the standardized epCode local epMatcher = require('Module:Ep/Matcher') local epCode = epMatcher.matchIndividualCode(ep) -- get formatted episode info local epInfo = p.epForRef(epCode) -- format timestamp local epRef = require('Module:Ep ref2') if startTime then startTime = epRef.formatTimestamp(startTime) end -- get wikilinked timestamped YouTube URL local epTimestamp = epRef.buildLinkedTimestamp(url, startTime) if endTime then endTime = epRef.formatTimestamp(endTime) eptimeString = 'See' .. epInfo .. 'from' .. epTimestamp .. 'to' .. endTime else eptimeString = 'See' .. epInfo .. 'at' .. epTimestamp end return eptimeString end

return p