Module:Live song: Difference between revisions

From SPCodex, The Smashing Pumpkins wiki
No edit summary
No edit summary
Line 11: Line 11:


return out .. ']]'
return out .. ']]'
end
local function live_debut(name)
-- 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
end


Line 47: Line 62:
if length ~= '' then
if length ~= '' then
out = out .. '[' .. length .. ']'
out = out .. '[' .. length .. '] '
end
if live_debut(name) then
out = out .. "[<span style='color:green'>live debut</span>]"
end
end



Revision as of 05:42, 11 September 2020

Documentation for this module may be created at Module:Live song/doc

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 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)
	local out = '"'

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

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

	out = out .. '"&nbsp;'

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

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

	if note ~= '' then
		out = out .. '(' .. note .. ')&nbsp;'
	end
	
	if length ~= '' then
		out = out .. '[' .. length .. ']&nbsp;'
	end
	
	if live_debut(name) then
		out = out .. "[<span style='color:green'>live debut</span>]"
	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]
	return p._entry(name, title, note, cover, tease, abandoned, length)
end

return p