Jump to content

Module:AlbumParam

From SiIvaGunner Wiki

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

-- Implements the album parameter of Template:Rip
-- Written by Ironwestie
local p = {}
 
--checks if a string has any link syntax
local function hasLinkSyntax(str)
    if string.match(str, "%[") or string.match(str,"%]") then
        return true
    else
        return false
    end
end

-- map album article titles to album links
local function transform(str)
	assert (str, 'str must exist')
    
    str = tostring(str)

    if (not str or str == "") then
        return str
    end
	
	str = mw.text.trim(str)
	
	local link_map = {
    	-- Non-Bandcamp releases
		["GiIvaSunner's HighestQuality Video Game Rips Volume 2"] = "",
		["GilvaSunner's Highest Quality Video Game Rips Volume 5"] = "",
		["A High Quality Journey Through the Undergrand"] = "",
		["Mediatonic's HighestQuality Video Game Rips Volume WOO"] = "",
		["GilvaSunner's Highest Quality Video Game Rips Volume 5 (Beta Mix)"] = "",
		["CHAD WARDEN's ABAP Raps Ballume Triple"] = "",
		["The Phantom Rips: SiIVa has come to"] = "https://www.youtube.com/playlist?list=PLL0CQjrcN8D2LpKwfEONnKzirIsWLZBQo",

    	-- Slamcamp
		["KORIBALL"] = "https://web.archive.org/web/0/https://giivasunner.bandcamp.com/album/koriball",
		["The Space Jam Charity SLAM!: First Quarter"] = "https://web.archive.org/web/0/https://giivasunner.bandcamp.com/album/the-space-jam-charity-slam-first-quarter",
		["The Space Jam Charity SLAM!: B-Ball Side"] = "https://web.archive.org/web/0/https://giivasunner.bandcamp.com/album/the-space-jam-charity-slam-b-ball-side",

    	-- Album in parenthesis
		["The Harlem Shakeover (album)"] = "https://web.archive.org/web/0/https://gilvasunner.bandcamp.com/album/the-harlem-shakeover",

    	-- J.E.'s Archive
		["garten of bamm-bamm (reference to the child of barney rubble flinstones)"] = "https://jearchive.bandcamp.com/album/garten-of-bamm-bamm-reference-to-the-child-of-barney-rubble-flinstones",
		["7 Grand Sunshine!!"] = "https://jearchive.bandcamp.com/album/7-grand-sunshine",
		["SGFR Presents: B💣MBERTRACKS"] = "https://jearchive.bandcamp.com/album/sgfr-presents-b-mbertracks",
		["WorIds (A 10th Anniversary Tribute)"] = "https://jearchive.bandcamp.com/album/worids-a-10th-anniversary-tribute",
		["...Presented by Cryptid Hunt: The Cryptid Collection"] = "https://jearchive.bandcamp.com/album/presented-by-cryptid-hunt-the-cryptid-collection",
		["These Are My Gummy Rips"] = "https://jearchive.bandcamp.com/album/these-are-my-gummy-rips",
		["The Joke-Explainer™ 7000's Highest Quality Rips: Sunrise"] = "https://jearchive.bandcamp.com/album/the-joke-explainer-7000s-highest-quality-rips-sunrise",
		["The Joke-Explainer™ 7000's Highest Quality Rips: Sunset"] = "https://jearchive.bandcamp.com/album/the-joke-explainer-7000s-highest-quality-rips-sunset",
		["Gedagsgiving"] = "https://jearchive.bandcamp.com/album/gedagsgiving",
		["SiIvaGunner's Highest Quality Rips: Volume L Again (Side A)"] = "https://jearchive.bandcamp.com/album/siivagunners-highest-quality-rips-volume-l-again-side-a",
		["SiIvaGunner's Highest Quality Rips: Volume L Again (Side B)"] = "https://jearchive.bandcamp.com/album/siivagunners-highest-quality-rips-volume-l-again-side-b",
		["SGFR Presents: INSTALLER INSANITY"] = "https://jearchive.bandcamp.com/album/sgfr-presents-installer-insanity",
		["Caveman Story"] = "https://jearchive.bandcamp.com/album/caveman-story",
		["OGG AND GADGET'S FUCKING COOL COVER ALBUM"] = "https://jearchive.bandcamp.com/album/ogg-and-gadgets-fucking-cool-cover-album",
		["Thickmas"] = "https://jearchive.bandcamp.com/album/thickmas",
		["RE:SPH (album)"] = "https://jearchive.bandcamp.com/album/re-sph",
		["Stingy's Highest Quality Rips: Volume Mine"] = "https://jearchive.bandcamp.com/album/stingys-highest-quality-rips-volume-mine",
		["The Joke-Explainer™ 7000's Highest Quality Rips: Nightfall"] = "https://jearchive.bandcamp.com/album/the-joke-explainer-7000s-highest-quality-rips-nightfall",
		["876 GRAND DAD"] = "https://jearchive.bandcamp.com/album/876-grand-dad",
		["An empty bliss beyond this Forgotten Land"] = "https://jearchive.bandcamp.com/album/an-empty-bliss-beyond-this-forgotten-land",
		["7 GRAND DETECTIVE"] = "https://jearchive.bandcamp.com/album/7-grand-detective",
		["1000 box"] = "https://jearchive.bandcamp.com/album/1000-box",
		["LIMITLESS QUALITY ACHIEVED"] = "https://jearchive.bandcamp.com/album/limitless-quality-achieved",

    	-- J.E.'s Archive (former titles)
		["The Joke-Explainer 7000™'s Highest Quality Rips: Sunrise"] = "https://jearchive.bandcamp.com/album/the-joke-explainer-7000-s-highest-quality-rips-sunrise",
		["The Joke-Explainer 7000™'s Highest Quality Rips: Sunset"] = "https://jearchive.bandcamp.com/album/the-joke-explainer-7000-s-highest-quality-rips-sunset",

    	-- SGFR albums
		["Halation Celebration ~ 10th Anniversary Tribute to Snow halation"] = "https://sgfr.highquality.rip/sgfr-0001/index.html",
		["SGFR Presents: Super Star Symphony"] = "https://sgfr.highquality.rip/sgfr-0002/index.html",
		["SGFR Presents: Musical Monkey Madness"] = "https://sgfr.highquality.rip/sgfr-0003/index.html",
		["SGFR Presents: PSY 9th Arrangements"] = "https://sgfr.highquality.rip/sgfr-0004/index.html",
		["SGFR Presents: Tactical Stealth Arrangements"] = "https://sgfr.highquality.rip/sgfr-0005/index.html",
		["SGFR Presents: Shovelware from Beyond the Deep!"] = "https://sgfr.highquality.rip/sgfr-0006/index.html",
		["SGFR Presents: RIP²"] = "https://sgfr.highquality.rip/sgfr-0007/index.html",
		["SGFR Presents: B💣MBERTRACKS"] = "https://sgfr.highquality.rip/sgfr-0008/index.html",
		["SGFR Presents: INSTALLER INSANITY"] = "https://sgfr.highquality.rip/sgfr-0009/index.html",
		["SGFR Presents: The Steam-Powered Melody Machine"] = "https://sgfr.highquality.rip/sgfr-0010/index.html",
		["SGFR Presents: LazyTunes"] = "https://sgfr.highquality.rip/sgfr-0011/index.html",
	}

	if link_map[str] then
		return link_map[str]
	else
		--makes all characters lowercase
		str = str:lower()
		--removes ASCII quotation marks, apostrophes and backticks
		str = str:gsub("[\"'`]","")
		--removes "." when surrounded by numbers
		str = str:gsub("([0-9])%.([0-9])","%1%2")
		str = str:gsub("([0-9])%.([0-9])","%1%2")
		--replaces all other characters not alphanumeric with "-"
		str = str:gsub("[^a-z0-9]","-")
		--removes "-" at start and end
		str = str:gsub("^%-*(..-)%-*$", "%1")
		--ensures that there is only ever at most one "-" between words
		str = str:gsub("%-%-+","-")
		return 'https://web.archive.org/web/0/https://gilvasunner.bandcamp.com/album/' .. str .. ''
	end
end
	
	local mirror_map = {
    	-- Google Drive releases
		["garten of bamm-bamm (reference to the child of barney rubble flinstones)"] = "https://drive.google.com/drive/folders/1qjmkMmGXCt7OllziobTfCBhPlRzHXhvB",
		["7 Grand Sunshine!!"] = "https://drive.google.com/drive/folders/1-FIWCOc64VVaRwA_69IiuA3Kr8XQdWC-",
		["WorIds (A 10th Anniversary Tribute)"] = "https://drive.google.com/drive/folders/1zoM-7ib2hThTqGTAhjXePVFrpGYC1XWs",
		["...Presented by Cryptid Hunt: The Cryptid Collection"] = "https://drive.google.com/drive/folders/1x4D5sstY-49qEuhkcVP9FfHxWEFuT0kr",
		["These Are My Gummy Rips"] = "https://drive.google.com/drive/folders/1-9iP6eoMaQeuLeXGIBotlIXzA3q28VpY",
	}

-- format album links
local function link_label(str)
    assert (str, 'str must exist')
    
    str = tostring(str)

    if (not str or str == "") then
        return str
    end
    
    str = mw.text.trim(str)

    local label_map = {
    	-- Album links
        ["."] = "-|.",
        ["-"] = "-|.",
        ["The Phantom Rips: SiIVa has come to"] = ":Category:The Phantom Rips: SiIVa has come to (Album)|The Phantom Rips: SiIVa has come to",
        ["KORIBALL"] = "KORIBALL (album)|KORIBALL",
        ["MAXIMUM QUALITY ACHIEVED"] = "MAXIMUM QUALITY ACHIEVED (album)|MAXIMUM QUALITY ACHIEVED",
        ["2018.UnregisteredHyperCam2.FullAlbum.XviD.KfaD.320kbps(CDRip)"] = "2018.UnregisteredHyperCam2.FullAlbum.XviD.KfaD.320kbps(CDRip)|2018.­Unregistered­HyperCam­2.­Full­Album.­XviD.­KfaD.­320­kbps­[CDRip]",
        ["SiIvaGunner's Highest Quality Rips: Volume L (Side A)"] = "SiIvaGunner's Highest Quality Rips: Volume L (Side A)|SiIvaGunner's Highest Quality Rips: Volume L [Side A]",
        ["SiIvaGunner's Highest Quality Rips: Volume L (Side B)"] = "SiIvaGunner's Highest Quality Rips: Volume L (Side B)|SiIvaGunner's Highest Quality Rips: Volume L [Side B]",
        ["Sensational Celebrations ~ The SiIvaSummer All-Star Festival Collection (Event Side)"] = "Sensational Celebrations ~ The SiIvaSummer All-Star Festival Collection (Event Side)|Sensational Celebrations ~ The SiIvaSummer All-Star Festival Collection [Event Side]",
        ["Bloodstained Bounties ~ The SiIvaGunner All-Star Summer Festival 2021 Collection (Event Side)"] = "Bloodstained Bounties ~ The SiIvaGunner All-Star Summer Festival 2021 Collection (Event Side)|Bloodstained Bounties ~ The SiIvaGunner All-Star Summer Festival 2021 Collection [Event Side]",
        ["The Harlem Shakeover (album)"] = "The Harlem Shakeover (album)|The Harlem Shakeover",
        ["7 Quality Royale"] = "7 Quality Royale|#7 Quality Royale",
        ["The Year of Grand Dad Sound Selection (Side A)"] = "The Year of Grand Dad Sound Selection (Side A)|The Year of Grand Dad Sound Selection [Side A]",
        ["The Year of Grand Dad Sound Selection (Side B)"] = "The Year of Grand Dad Sound Selection (Side B)|The Year of Grand Dad Sound Selection [Side B]",
        ["ULTIMATE QUALITY ACHIEVED"] = "ULTIMATE QUALITY ACHIEVED (album)|ULTIMATE QUALITY ACHIEVED",
        ["SiIvaGunner's Highest Quality Rips: Volume L Again (Side A)"] = "SiIvaGunner's Highest Quality Rips: Volume L Again (Side A)|SiIvaGunner's Highest Quality Rips: Volume L Again [Side A]",
        ["SiIvaGunner's Highest Quality Rips: Volume L Again (Side B)"] = "SiIvaGunner's Highest Quality Rips: Volume L Again (Side B)|SiIvaGunner's Highest Quality Rips: Volume L Again [Side B]",
        ["RE:SPH (album)"] = "RE:SPH",
        ["LIMITLESS QUALITY ACHIEVED"] = "LIMITLESS QUALITY ACHIEVED (album)|LIMITLESS QUALITY ACHIEVED",
        
        -- Event links
		["SilvaGunner: Rebooted"] = "SilvaGunner: Rebooted|''SilvaGunner: Rebooted''",
		["Super Mario 64 20th Anniversary"] = "Super Mario 64 20th Anniversary|''Super Mario 64'' 20th Anniversary",
		["Sonic the Hedgehog 25th Anniversary"] = "Sonic the Hedgehog 25th Anniversary|''Sonic the Hedgehog'' 25th Anniversary",
		["Super Mario Bros. 31st Anniversary"] = "Super Mario Bros. 31st Anniversary|''Super Mario Bros.'' 31st Anniversary",
		["Undertale 1st Anniversary"] = "Undertale 1st Anniversary|''Undertale'' 1st Anniversary",
		["Animal Crossing: The Movie 10th Anniversary"] = "Animal Crossing: The Movie 10th Anniversary|''Animal Crossing: The Movie'' 10th Anniversary",
		["Beginning of The SilvaGunner Christmas Comeback Crisis"] = "Beginning of The SilvaGunner Christmas Comeback Crisis|Beginning of ''The SilvaGunner Christmas Comeback Crisis''",
		["Snow halation 6th Anniversary"] = "Snow halation 6th Anniversary|\"Snow halation\" 6th Anniversary",
		["Ocarina of Time 3D Day"] = "Ocarina of Time 3D Day|''Ocarina of Time 3D'' Day",
		["Chain of Memories Day"] = "Chain of Memories Day|''Chain of Memories'' Day",
		["Bad Apple!! Day"] = "Bad Apple!! Day|\"Bad Apple!!\" Day",
		["SilvaGunner: Rebooted 1st Anniversary"] = "SilvaGunner: Rebooted 1st Anniversary|''SilvaGunner: Rebooted'' 1st Anniversary",
		["Puzzle Room Rip 1st Anniversary"] = "Puzzle Room Rip 1st Anniversary|\"Puzzle Room\" Rip 1st Anniversary",
		["Rhythm Tengoku 11th Anniversary"] = "Rhythm Tengoku 11th Anniversary|''Rhythm Tengoku'' 11th Anniversary",
		["ToME 6th Anniversary"] = "ToME 6th Anniversary|''ToME'' 6th Anniversary",
		["Super Mario Maker 3rd Anniversary"] = "Super Mario Maker 3rd Anniversary|''Super Mario Maker'' 3rd Anniversary",
		["Minecraft 10th Anniversary"] = "Minecraft 10th Anniversary|''Minecraft'' 10th Anniversary",
		["Coaster Day"] = "Coaster Day|\"Coaster\" Day",
		["Revenge 8th Anniversary"] = "Revenge 8th Anniversary|\"Revenge\" 8th Anniversary",
		["Chain of Memories II Day"] = "Chain of Memories II Day|''Chain of Memories II'' Day",
		["Back to the Future Day"] = "Back to the Future Day|''Back to the Future'' Day",
		["MAXIMUM QUALITY ACHIEVED Day"] = "MAXIMUM QUALITY ACHIEVED Day|''MAXIMUM QUALITY ACHIEVED'' Day",
		["Homestuck 11th Anniversary"] = "Homestuck 11th Anniversary|''Homestuck'' 11th Anniversary",
		["MOTHER 3 14th Anniversary"] = "MOTHER 3 14th Anniversary|''MOTHER 3'' 14th Anniversary",
		["Paper Mario 20th Anniversary"] = "Paper Mario 20th Anniversary|''Paper Mario'' 20th Anniversary",
		["Sonic Mania 3rd Anniversary"] = "Sonic Mania 3rd Anniversary|''Sonic Mania'' 3rd Anniversary",
		["Undertale 5th Anniversary"] = "Undertale 5th Anniversary|''Undertale'' 5th Anniversary",
		["Doki Doki Literature Club! 3rd Anniversary"] = "Doki Doki Literature Club! 3rd Anniversary|''Doki Doki Literature Club!'' 3rd Anniversary",
		["Friendship Is Magic 10th Anniversary"] = "Friendship Is Magic 10th Anniversary|''Friendship Is Magic'' 10th Anniversary",
		["Battle for BFB 3rd Anniversary"] = "Battle for BFB 3rd Anniversary|''Battle for BFB'' 3rd Anniversary",
		["Paper Mario Event 2020"] = "Paper Mario Event 2020|''Paper Mario'' Event 2020",
		["Cave Story 16th Anniversary"] = "Cave Story 16th Anniversary|''Cave Story'' 16th Anniversary",
		["Panty & Stocking Finale 10th Anniversary"] = "Panty & Stocking Finale 10th Anniversary|''Panty & Stocking'' Finale 10th Anniversary",
		["Snow halation 10th Anniversary"] = "Snow halation 10th Anniversary|\"Snow halation\" 10th Anniversary",
		["Phantasmagoria of Dim. Dream 23rd Anniversary"] = "Phantasmagoria of Dim. Dream 23rd Anniversary|''Phantasmagoria of Dim. Dream'' 23rd Anniversary",
		["Big Time Rush 11th Anniversary"] = "Big Time Rush 11th Anniversary|''Big Time Rush'' 11th Anniversary",
		["Super Mario 3D World + Bowser's Fury Release Day"] = "Super Mario 3D World + Bowser's Fury Release Day|''Super Mario 3D World + Bowser's Fury'' Release Day",
		["Astronaut in the Ocean 2nd Anniversary"] = "Astronaut in the Ocean 2nd Anniversary|\"Astronaut in the Ocean\" 2nd Anniversary",
		["Spirited Away 20th Anniversary"] = "Spirited Away 20th Anniversary|''Spirited Away'' 20th Anniversary",
		["Undertale 6th Anniversary"] = "Undertale 6th Anniversary|''Undertale'' 6th Anniversary",
		["Umineko no Naku Koro ni Event"] = "Umineko no Naku Koro ni Event|''Umineko no Naku Koro ni'' Event",
		["The Grimm Troupe 4th Anniversary"] = "The Grimm Troupe 4th Anniversary|''The Grimm Troupe'' 4th Anniversary",
		["OMORI 1st Anniversary"] = "OMORI 1st Anniversary|''OMORI'' 1st Anniversary",
		["Space Jam Charity SLAM!#JAM!uary"] = "Space Jam Charity SLAM!#JAM!uary|JAM!uary",
		["Big Time Rush 12th Anniversary"] = "Big Time Rush 12th Anniversary|''Big Time Rush'' 12th Anniversary",
		["Damn Daniel 6th Anniversary"] = "Damn Daniel 6th Anniversary|\"Damn Daniel\" 6th Anniversary",
		["Kirby and the Forgotten Land Release Day"] = "Kirby and the Forgotten Land Release Day|''Kirby and the Forgotten Land'' Release Day",
		["Family Guy Event"] = "Family Guy Event|''Family Guy'' Event",
		["Hampsterdance 22nd Anniversary"] = "Hampsterdance 22nd Anniversary|\"Hampsterdance\" 22nd Anniversary",
		["Minecraft - Volume Alpha and Beta Day"] = "Minecraft - Volume Alpha and Beta Day|''Minecraft - Volume Alpha'' and ''Beta'' Day",
		["ROBLOX 16th Anniversary"] = "ROBLOX 16th Anniversary|''ROBLOX'' 16th Anniversary",
		["Fortnite Battle Royale 5th Anniversary"] = "Fortnite Battle Royale 5th Anniversary|''Fortnite Battle Royale'' 5th Anniversary",
		["Undertale 7th Anniversary"] = "Undertale 7th Anniversary|''Undertale'' 7th Anniversary",
		["Deltarune Chapter 2 1st Anniversary"] = "Deltarune Chapter 2 1st Anniversary|''Deltarune'' Chapter 2 1st Anniversary",
		["Bear in the Big Blue House 25th Anniversary"] = "Bear in the Big Blue House 25th Anniversary|''Bear in the Big Blue House'' 25th Anniversary",
		["Paper Mario Day 2022"] = "Paper Mario Day 2022|''Paper Mario'' Day 2022",
		["The Legend of Cage: Beneath the Mask Day"] = "The Legend of Cage: Beneath the Mask Day|''The Legend of Cage: Beneath the Mask'' Day",
		["Final Fantasy 35th Anniversary"] = "Final Fantasy 35th Anniversary|''Final Fantasy'' 35th Anniversary",
		["Season 7"] = "Season 7|Season 7: The Year of Grand Dad",
		["Kirby's Return to Dream Land Deluxe Release Day"] = "Kirby's Return to Dream Land Deluxe Release Day|''Kirby's Return to Dream Land Deluxe'' Release Day",
		["Five Nights at Freddy's 3 8th Anniversary"] = "Five Nights at Freddy's 3 8th Anniversary|''Five Nights at Freddy's 3'' 8th Anniversary",
		["Homestuck 14th Anniversary"] = "Homestuck 14th Anniversary|''Homestuck'' 14th Anniversary",
		["Lucid Dreams 5th Anniversary"] = "Lucid Dreams 5th Anniversary|\"Lucid Dreams\" 5th Anniversary",
		["Garten of Banban 3 Event"] = "Garten of Banban 3 Event|''Garten of Banban 3'' Event",
		["Densha de GO!! Day"] = "Densha de GO!! Day|''Densha de GO!!'' Day",
		["Minecraft 14th Anniversary"] = "Minecraft 14th Anniversary|''Minecraft'' 14th Anniversary",
		["Raft Ride Day"] = "Raft Ride Day|\"Raft Ride\" Day",
		["South Park Day"] = "South Park Day|''South Park'' Day",
		["The Legend of Zelda: Link's Awakening 30th Anniversary"] = "The Legend of Zelda: Link's Awakening 30th Anniversary|''The Legend of Zelda: Link's Awakening'' 30th Anniversary",
		["The Great Ace Attorney Chronicles 2nd Anniversary"] = "The Great Ace Attorney Chronicles 2nd Anniversary|''The Great Ace Attorney Chronicles'' 2nd Anniversary",
		["Garten of Banban 4 Event"] = "Garten of Banban 4 Event|''Garten of Banban 4'' Event",
		["ROBLOX 17th Anniversary"] = "ROBLOX 17th Anniversary|''ROBLOX'' 17th Anniversary",
		["What Makes You Beautiful 12th Anniversary"] = "What Makes You Beautiful 12th Anniversary|\"What Makes You Beautiful\" 12th Anniversary",
		["Eastward 2nd Anniversary"] = "Eastward 2nd Anniversary|''Eastward'' 2nd Anniversary",
		["Five Nights at Freddy's Movie Release Day"] = "Five Nights at Freddy's Movie Release Day|''Five Nights at Freddy's'' Movie Release Day",
		["Street Fighter Day"] = "Street Fighter Day|''Street Fighter'' Day",
		["Super Mario RPG Switch Release Day"] = "Super Mario RPG Switch Release Day|''Super Mario RPG'' Switch Release Day",
		["Goomba Got Back Day"] = "Goomba Got Back Day|\"Goomba Got Back\" Day",
		["Return of The SilvaGunner Christmas Comeback Crisis"] = "Return of The SilvaGunner Christmas Comeback Crisis|Return of ''The SilvaGunner Christmas Comeback Crisis''",
		["Mega Man 1st Anniversary"] = "Mega Man 1st Anniversary|\"Mega Man\" 1st Anniversary",
		["Garten of Banban 6 Event"] = "Garten of Banban 6 Event|''Garten of Banban 6'' Event",
		["ULTIMATE QUALITY ACHIEVED Day"] = "ULTIMATE QUALITY ACHIEVED Day|''ULTIMATE QUALITY ACHIEVED'' Day",
		["Puyo Puyo Day"] = "Puyo Puyo Day|''Puyo Puyo'' Day",
		["Baby 14th Anniversary"] = "Baby 14th Anniversary|\"Baby\" 14th Anniversary",
		["SiIvaGunner SmashUp! Day"] = "SiIvaGunner SmashUp! Day|\"SiIvaGunner SmashUp!\" Day",
		["Othello World 32nd Anniversary"] = "Othello World 32nd Anniversary|''Othello World'' 32nd Anniversary",
		["SpongeBob SquarePants 25th Anniversary"] = "SpongeBob SquarePants 25th Anniversary|''SpongeBob SquarePants'' 25th Anniversary",
		["Smoke 'Em Out Struggle 3rd Anniversary"] = "Smoke 'Em Out Struggle 3rd Anniversary|''Smoke 'Em Out Struggle'' 3rd Anniversary",
		["Garten of Banban 7 Event"] = "Garten of Banban 7 Event|''Garten of Banban 7'' Event",
		["Minecraft 15th Anniversary"] = "Minecraft 15th Anniversary|''Minecraft'' 15th Anniversary",
		["ANTONYMPH 3rd Anniversary"] = "ANTONYMPH 3rd Anniversary|\"ANTONYMPH\" 3rd Anniversary",
		["7 Grand Sunshine!! Day"] = "7 Grand Sunshine!! Day|''7 Grand Sunshine!!'' Day",
		["Worlds 10th Anniversary"] = "Worlds 10th Anniversary|''Worlds'' 10th Anniversary",
		["Spore 16th Anniversary"] = "Spore 16th Anniversary|''Spore'' 16th Anniversary",
		["Undertale 9th Anniversary"] = "Undertale 9th Anniversary|''Undertale'' 9th Anniversary",
		["We Are Number One Day"] = "We Are Number One Day|\"We Are Number One\" Day",
		["Cave Story 20th Anniversary"] = "Cave Story 20th Anniversary|''Cave Story'' 20th Anniversary",
		["Me at the zoo 20th Anniversary"] = "Me at the zoo 20th Anniversary|\"Me at the zoo\" 20th Anniversary",
		["Touch Detective 2½ 18th Anniversary"] = "Touch Detective 2½ 18th Anniversary|''Touch Detective 2½'' 18th Anniversary",
		["LIMITLESS QUALITY ACHIEVED Day"] = "LIMITLESS QUALITY ACHIEVED Day|''LIMITLESS QUALITY ACHIEVED'' Day",

        -- former event titles
		["PAC-MAN's 36th Anniversary"] = "PAC-MAN's 36th Anniversary|<i>PAC-MAN</i>'s 36th Anniversary",
		["Smooth 18th Anniversary"] = "Smooth 18th Anniversary|\"Smooth\" 18th Anniversary",
		["All Star 20th Anniversary"] = "All Star 20th Anniversary|\"All Star\" 20th Anniversary",
		["Hamood Habibi 15th Anniversary"] = "Hamood Habibi 15th Anniversary|\"Hamood Habibi\" 15th Anniversary",
		["We Are Number One 10th Anniversary"] = "We Are Number One 10th Anniversary|\"We Are Number One\" 10th Anniversary",
		["Teen Titans GO Mini-Event"] = "Teen Titans GO Mini-Event|''Teen Titans GO'' Mini-Event",
		["I'm a Gummy Bear (The Gummy Bear Song) Day"] = "I'm a Gummy Bear (The Gummy Bear Song) Day|\"I'm a Gummy Bear (The Gummy Bear Song)\" Day",
    }

    if label_map[str] then
        str = label_map[str]
    end
    
    return str
end

-- formats a string of album names into something like:
-- ''[[Album_name]]'' ({{Icon|<site>|size=x20|2={{{album}}}}}),
local function format_param(str, url_only)
    assert (str, 'str must exist')
	
    local result = ""
    if (str == "") then
        return str
    end
    t = mw.text.split(str, ";")
    local site
	for index,value in ipairs(t) do 
		local link = transform(value)
		
		if link:find("//www%.youtube%.com/") ~= nil then
			site = "YouTube"
		elseif link:find("//web%.archive%.org/") ~= nil then
			site = "Bandcamp"
		elseif link:find("//drive%.google%.com/") ~= nil then
			site = "Drive"
		elseif link:find("//sgfr%.highquality%.rip/") ~= nil then
			site = "SGFR"
		else
			site = "Bandcamp"
		end
		
        if (index > 1) then -- if this isn't the first album listed
            result = result .. ", "
        end
        

        if url_only == "1" then
        	result = result .. string.format("%s", link)
        elseif link == "" then
        	result = result .. string.format("''[[%s]]''", link_label(value))
        else
        	result = result .. string.format("''[[%s]]'' ({{Icon|%s|size=x20|2=%s}})",link_label(value),site,link)
        end
    end
    return result
end

local function format_into_list(str)
    assert(str, 'str must exist')
    local result = ""
    if (str == "") then
        return str
    end
    t = mw.text.split(str, ";")
    for index,value in ipairs(t) do
        if (index > 1) then -- if this isn't the first item listed
            result = result .. ", "
        end
        result = result .. string.format("[[%s]]", link_label(value))
    end
    return result
end
 
-- implements automatic categorization
local function categorize(str)
    assert (str, "str must exist")
    t = mw.text.split(str, ";")
    local result = ""
    if (str == "") then
        return str
    end
    for index, value in ipairs(t) do
       result = result .. string.format("[[Category:%s]]",value)
    end
    return result
end
 
-- puts categories on the bottom of the page. assumes delimiter is ";".
function p.categorize(frame)
    local str = frame.args[1]
        --if there's any link syntax, then we override the transform function
    if hasLinkSyntax(str) then
        return ""
    elseif pcall(function () result = categorize(str) end) then 
        return frame:preprocess(result)
    else
        return frame:preprocess(str .. "[[Category:Pages with script errors]]")
    end
end
 
-- calls transform; can be called from an invoke
-- {{#invoke:AlbumParam|transform}}
function p.transform(frame)
    local str = frame.args[1]
 
    --if there's any link syntax, then we override the transform function
    if hasLinkSyntax(str) then
        return str
    elseif pcall(function () result = transform(str) end) then 
        return frame:preprocess(result)
    else
        return frame:preprocess(str .. "[[Category:Pages with script errors]]")
    end
end

-- makes a comma-separated list out of a string with a ";" as its delimiter
function p.list(frame)
    local str = frame.args[1]
    
    --if there's any link syntax, then we override the function
    if hasLinkSyntax(str) then
        return str
    elseif pcall(function () result = format_into_list(str) end) then 
        return frame:preprocess(result)
    else
        return frame:preprocess(str .. "[[Category:Pages with script errors]]")
    end
end

-- fully transforms album.
-- {{#invoke:AlbumParam|main|{{{album}}}}}
function p.main(frame)
    local str = frame.args[1]
    local url_only = frame.args["url_only"] or ""
    --if there's any link syntax, then we override the main function
    if hasLinkSyntax(str) then
        return str
    elseif pcall(function () result = format_param(str, url_only) end) then 
        return frame:preprocess(result)
    else
        return frame:preprocess(str .. "[[Category:Pages with script errors]]")
    end
end
return p

Debug data: