Module:Live song

local p = {}

local function link(name, title) local out = '[['

if title == '' then out = out .. name else out = out .. name .. '|' .. title end

return out .. ']]' end

local function live_debut(name) -- local page_title = mw.getCurrentFrame:getTitle -- local show_date = p._parse_date(page_title) -- local cargo = mw.ext.cargo -- local shows = cargo.query(	-- 	'live_songs, ',	-- 	"track_listings._pageName=title, releases.release_date=date, release_date__precision=precision, albums.type=type, track_listings.listing_id=listing_id, headline",	-- 	{	-- 		where = "releases.release_date != '' AND song_page_title = \"" .. song .. '"',	-- 		join = 'track_listings._pageName=albums._pageName,albums.name=releases._pageName',	-- 		groupBy = 'track_listings.work',	-- 		orderBy = 'releases.release_date ASC'	-- 	}	-- ) return false end

function p._entry(name, title, note, cover, tease, abandoned, length, acoustic) local out = '"'

if cover ~=  or tease ~=  or abandoned ~= '' then local mw_title = mw.title.makeTitle(0, name)

if mw_title.exists then out = out .. link(name, title) elseif title == '' then out = out .. name else out = out .. title end else out = out .. link(name, title) end

out = out .. '" '

if cover ~= '' then out = out .. '&#91;' .. cover .. '&#93; '	end

if tease ~=  and abandoned ~=  then out = out .. '(tease / abandoned) ' elseif tease ~= '' then out = out .. '(tease) ' elseif abandoned ~= '' then out = out .. '(abandoned) ' end

if acoustic ~= '' then out = out .. '(acoustic)' end

if note ~= '' then out = out .. '(' .. note .. ') ' end if length ~= '' then out = out .. '[' .. length .. '] '	end if live_debut(name) then out = out .. "[ live debut ]" end

return out end

function p.entry(frame) local name = frame.args[1] local title = frame.args[2] local note = frame.args[3] local cover = frame.args[4] local tease = frame.args[5] local abandoned = frame.args[6] local length = frame.args[7] local acoustic = frame.args[8] return p._entry(name, title, note, cover, tease, abandoned, length, acoustic) end

function p._parse_date(title) return string.match(title, "%d%d%d%d.%d%d.%d%d") end

function p.parse_date(frame) local name = frame.args[1] return p._parse_date(name) end

return p