Module:Setlist/AlbumSelector: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 24: | Line 24: | ||
-- Главная функция | -- Главная функция | ||
function p. | function p.getAlbumForSong(songTitle) | ||
local page = mw.title.getCurrentTitle().text | local page = mw.title.getCurrentTitle().text | ||
local year = string.match(page, '%.(%d%d%d%d)$') | local year = string.match(page, '%.(%d%d%d%d)$') | ||
local data = mw.loadData('Module:Setlist/Songs') | local data = mw.loadData('Module:Setlist/Songs') | ||
Line 39: | Line 35: | ||
end | end | ||
if conflictSongs[songTitle] and year then | |||
if conflictSongs[songTitle] then | |||
if rabYears[year] then | if rabYears[year] then | ||
return {"Regional At Best"} | return {"Regional At Best"} | ||
elseif vesselYears[year] then | elseif vesselYears[year] then | ||
return {"Vessel"} | return {"Vessel"} | ||
end | end | ||
end | end |
Latest revision as of 19:23, 11 July 2025
Documentation for this module may be created at Module:Setlist/AlbumSelector/doc
-- Module:Setlist/AlbumSelector local p = {} -- Годы, при которых песня будет считаться из "Regional At Best" local rabYears = { ["2009"] = true, ["2010"] = true, ["2011"] = true, ["2012"] = true } -- Годы, при которых песня будет считаться из "Vessel" local vesselYears = { ["2013"] = true, ["2014"] = true, ["2015"] = true, ["2016"] = true, ["2017"] = true, ["2018"] = true, ["2019"] = true, ["2020"] = true, ["2021"] = true, ["2022"] = true, ["2023"] = true, ["2024"] = true, ["2025"] = true } -- Перечень песен, которые одновременно находятся в RAB и Vessel local conflictSongs = { ["Guns For Hands"] = true, ["Holding On To You"] = true, ["Ode To Sleep"] = true, ["Car Radio"] = true, ["Trees"] = true } -- Главная функция function p.getAlbumForSong(songTitle) local page = mw.title.getCurrentTitle().text local year = string.match(page, '%.(%d%d%d%d)$') local data = mw.loadData('Module:Setlist/Songs') local original = data.songs[songTitle] if not original then return nil end if conflictSongs[songTitle] and year then if rabYears[year] then return {"Regional At Best"} elseif vesselYears[year] then return {"Vessel"} end end return original end return p