Module:Setlist/Songs: Difference between revisions

From TwentyOneWiki
Jump to navigation Jump to search
mNo edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 1: Line 1:
local p = {}
-- Функция для определения актуального альбома по названию страницы
function p.getCurrentAlbum()
    local title = mw.title.getCurrentTitle().text or ""
    local year = mw.ustring.match(title, "%.(%d%d%d%d)$")
    year = tonumber(year)
    if year and year >= 2008 and year <= 2012 then
        return "Regional At Best"
    elseif year and year >= 2013 then
        return "Vessel"
    end
    return nil
end
local songs = {
local songs = {
     ["Implicit Demand For Proof"] = {"Twenty One Pilots"},
     ["Implicit Demand For Proof"] = {"Twenty One Pilots"},
Line 112: Line 127:
}
}


-- Функция для получения таблицы песен в зависимости от даты
-- Пример функции: возвращает песни, относящиеся к альбому для текущей страницы
local function getSongsForDate(date)
function p.getSongsForCurrentAlbum(frame)
    -- Дата выхода Vessel: 8 января 2013 года
     local album = p.getCurrentAlbum()
     local vesselReleaseDate = os.time{year=2013, month=1, day=8}
    if not album then
     local modifiedSongs = {}
        return "Альбом не определён"
 
    end
    -- Проходим по всем песням в исходной таблице
     local result = {}
     for song, albums in pairs(songs) do
     for song, albums in pairs(songs) do
         if #albums == 1 then
         for _, a in ipairs(albums) do
             -- Если песня в одном альбоме, оставляем как есть
             if a == album then
            modifiedSongs[song] = albums
                table.insert(result, song)
        elseif #albums == 2 and albums[1] == "Regional At Best" and albums[2] == "Vessel" then
                 break
            -- Если песня в обоих альбомах, выбираем альбом в зависимости от даты
            if date < vesselReleaseDate then
                modifiedSongs[song] = {"Regional At Best"}
            else
                 modifiedSongs[song] = {"Vessel"}
             end
             end
        else
            -- Для всех остальных случаев (хотя в текущих данных таких нет)
            modifiedSongs[song] = albums
         end
         end
     end
     end
 
     return table.concat(result, "<br>")
     return modifiedSongs
end
end


-- Возвращаем модуль с таблицами и функцией
return p
return {
    songs = songs,
    albumColors = albumColors,
    albumLinks = albumLinks,
    getSongsForDate = getSongsForDate
}

Revision as of 04:45, 11 July 2025

Documentation for this module may be created at Module:Setlist/Songs/doc

local p = {}

-- Функция для определения актуального альбома по названию страницы
function p.getCurrentAlbum()
    local title = mw.title.getCurrentTitle().text or ""
    local year = mw.ustring.match(title, "%.(%d%d%d%d)$")
    year = tonumber(year)
    if year and year >= 2008 and year <= 2012 then
        return "Regional At Best"
    elseif year and year >= 2013 then
        return "Vessel"
    end
    return nil
end

local songs = {
    ["Implicit Demand For Proof"] = {"Twenty One Pilots"},
    ["Fall Away"] = {"Twenty One Pilots"},
    ["The Pantaloon"] = {"Twenty One Pilots"},
    ["Addict With A Pen"] = {"Twenty One Pilots"},
    ["Friend, Please"] = {"Twenty One Pilots"},
    ["March To The Sea"] = {"Twenty One Pilots"},
    ["Johnny Boy"] = {"Twenty One Pilots"},
    ["Oh Ms Believer"] = {"Twenty One Pilots"},
    ["Air Catcher"] = {"Twenty One Pilots"},
    ["Trapdoor"] = {"Twenty One Pilots"},
    ["A Car, A Torch, A Death"] = {"Twenty One Pilots"},
    ["Taxi Cab"] = {"Twenty One Pilots"},
    ["Before You Start Your Day"] = {"Twenty One Pilots"},
    ["Isle Of Flightless Birds"] = {"Twenty One Pilots"},
    ["Guns For Hands"] = {"Regional At Best", "Vessel"},
    ["Holding On To You"] = {"Regional At Best", "Vessel"},
    ["Ode To Sleep"] = {"Regional At Best", "Vessel"},
    ["Slowtown"] = {"Regional At Best"},
    ["Car Radio"] = {"Regional At Best", "Vessel"},
    ["Forest"] = {"Regional At Best"},
    ["Glowing Eyes"] = {"Regional At Best"},
    ["Kitchen Sink"] = {"Regional At Best"},
    ["Anathema"] = {"Regional At Best"},
    ["Lovely"] = {"Regional At Best"},
    ["Ruby"] = {"Regional At Best"},
    ["Trees"] = {"Regional At Best", "Vessel"},
    ["Be Concerned"] = {"Regional At Best"},
    ["Clear"] = {"Regional At Best"},
    ["Migraine"] = {"Vessel"},
    ["House Of Gold"] = {"Vessel"},
    ["Semi-Automatic"] = {"Vessel"},
    ["Screen"] = {"Vessel"},
    ["The Run And Go"] = {"Vessel"},
    ["Fake You Out"] = {"Vessel"},
    ["Truce"] = {"Vessel"},
    ["Heavydirtysoul"] = {"Blurryface"},
    ["Stressed Out"] = {"Blurryface"},
    ["Ride"] = {"Blurryface"},
    ["Fairly Local"] = {"Blurryface"},
    ["Tear In My Heart"] = {"Blurryface"},
    ["Lane Boy"] = {"Blurryface"},
    ["The Judge"] = {"Blurryface"},
    ["Doubt"] = {"Blurryface"},
    ["Polarize"] = {"Blurryface"},
    ["We Don't Believe What's On TV"] = {"Blurryface"},
    ["Message Man"] = {"Blurryface"},
    ["Hometown"] = {"Blurryface"},
    ["Not Today"] = {"Blurryface"},
    ["Goner"] = {"Blurryface"},
    ["Jumpsuit"] = {"Trench"},
    ["Levitate"] = {"Trench"},
    ["Morph"] = {"Trench"},
    ["My Blood"] = {"Trench"},
    ["Chlorine"] = {"Trench"},
    ["Smithereens"] = {"Trench"},
    ["Neon Gravestones"] = {"Trench"},
    ["The Hype"] = {"Trench"},
    ["Nico And The Niners"] = {"Trench"},
    ["Cut My Lip"] = {"Trench"},
    ["Bandito"] = {"Trench"},
    ["Pet Cheetah"] = {"Trench"},
    ["Legend"] = {"Trench"},
    ["Leave The City"] = {"Trench"},
    ["Good Day"] = {"Scaled And Icy"},
    ["Choker"] = {"Scaled And Icy"},
    ["Shy Away"] = {"Scaled And Icy"},
    ["The Outside"] = {"Scaled And Icy"},
    ["Saturday"] = {"Scaled And Icy"},
    ["Never Take It"] = {"Scaled And Icy"},
    ["Mulberry Street"] = {"Scaled And Icy"},
    ["Formidable"] = {"Scaled And Icy"},
    ["Bounce Man"] = {"Scaled And Icy"},
    ["No Chances"] = {"Scaled And Icy"},
    ["Redecorate"] = {"Scaled And Icy"},
    ["Overcompensate"] = {"Clancy"},
    ["Next Semester"] = {"Clancy"},
    ["Backslide"] = {"Clancy"},
    ["Midwest Indigo"] = {"Clancy"},
    ["Routines In The Night"] = {"Clancy"},
    ["Vignette"] = {"Clancy"},
    ["The Craving (Jenna's Version)"] = {"Clancy"},
    ["Lavish"] = {"Clancy"},
    ["Navigating"] = {"Clancy"},
    ["Snap Back"] = {"Clancy"},
    ["Oldies Station"] = {"Clancy"},
    ["At The Risk Of Feeling Dumb"] = {"Clancy"},
    ["Paladin Strait"] = {"Clancy"},
    ["Time To Say Goodbye"] = {"Johnny Boy"}
}

-- Определяем цвета альбомов
local albumColors = {
    ["Twenty One Pilots"] = "#87B22A",
    ["Regional At Best"] = "#21ABC6",
    ["Vessel"] = "#d5d8dd",
    ["Blurryface"] = "#dc4747",
    ["Trench"] = "#ffcc4d",
    ["Scaled And Icy"] = "#b3e7fa",
    ["Johnny Boy"] = "#CECECE",
}

-- Определяем ссылки для альбомов
local albumLinks = {
    ["Twenty One Pilots"] = "Twenty One Pilots (album)",
    ["Regional at Best"] = "Regional at Best",
    ["Vessel"] = "Vessel (album)",
    ["Blurryface"] = "Blurryface (album)",
    ["Trench"] = "Trench (album)",
    ["Scaled and Icy"] = "Scaled and Icy",
    ["Johnny Boy (EP)"] = "Johnny Boy",
}

-- Пример функции: возвращает песни, относящиеся к альбому для текущей страницы
function p.getSongsForCurrentAlbum(frame)
    local album = p.getCurrentAlbum()
    if not album then
        return "Альбом не определён"
    end
    local result = {}
    for song, albums in pairs(songs) do
        for _, a in ipairs(albums) do
            if a == album then
                table.insert(result, song)
                break
            end
        end
    end
    return table.concat(result, "<br>")
end

return p