Module:GilvaSunner playlists

-- Implements links to GilvaSunner playlists in Template:Game -- Written by overcast07

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

local ids = { ["100k"]       = "PLz5gUls4mkX-TR2CWNKfJN2XruKUd1mNB", ["150k"]       = "PLz5gUls4mkX-vhFGa8NuhGApuEx2f6nmZ", ["kirbtunes"]  = "PLz5gUls4mkX_9BLkMlYaGSAl2ziWpCeCP", ["Specials / Random Stuff"] = "PLD5A603E967E1AE70", ["Mario Series for Guitar"] = "PLz5gUls4mkX-efuBX0U22LBaPD6xFoLif", ["Zelda Series for Guitar"] = "PLED86AD896A3CF401",

["Liked videos"] = "PLz5gUls4mkX9jfgp0NXAi8waDLqt4OYIt", ["Short videos"] = "UUSHraDChjPs-r9FoNsmJufZZQ", ["Animal Crossing: The Movie"] = "PL0E4AF202C5E776D5", ["The Legend of Zelda: 30th Anniversary Concert"] = "PLz5gUls4mkX_syS1_THd84hatBgK8848z", ["The Sound of Kirby Café"] = "PLz5gUls4mkX_bXinaOdB6FFFjO2xyYHQl", ["Nintendo 3DS"] = "PLC2D009EA12040591", ["Nintendo 3DS Guide: Louvre"] = "PLz5gUls4mkX_ogqBLwdjMNpNtJJcVn7_C", ["1080° Snowboarding"] = "PLz5gUls4mkX-min7z75Rw-UH8VdcV53kl", ["Banjo-Kazooie"] = "PLFA7714E316F2CB06", ["Banjo-Tooie"] = "PL9D5D10375437CCA1", ["Dance Dance Revolution Mario Mix"] = "PL4BC7F7536279B47D", ["Diddy Kong Racing"] = "PL194EA9D04B57AE7F", ["Donkey Kong"] = "PL3AB46038BFD2931E", ["Donkey Kong 3"] = "PLz5gUls4mkX-1L4b4TA8-DUmiRZBlu6yd", ["Donkey Kong 64"] = "PLF089B4078C19D358", ["Donkey Kong Country"] = "PL0631035C92A6EF84", ["Donkey Kong Country 2: Diddy's Kong Quest"] = "PL334A457011BC5467", ["Donkey Kong Country 3: Dixie Kong's Double Trouble"] = "PLEFA18FDBEF44ABA5", ["Donkey Kong Jr."] = "PL1085BF1CA7C8113A", ["Donkey Kong Jungle Beat"] = "PL9023E950E7512271", ["Donkey Kong Land"] = "PLF9A1FA6E6B550BBF", ["Donkey Kong Land 2"] = "PL0E5859EA826442F0", ["Donkey Kong Land III"] = "PLE34CD43459B7A16E", ["Donkey Konga"] = "PL925A7A04033F8FED", ["Dr. Luigi"] = "PLz5gUls4mkX-zXEWiXabSfiSxsUd99WUu", ["Duck Hunt"] = "PL8E98FE7D3B28940B", ["Excitebike"] = "PL3481B5BAE0E0AF8C", ["Face Raiders"] = "PL3EA374CCCB033FC1", ["Final Fantasy XIV"] = "PL72A6702E8C5E7136", ["Fire Emblem Awakening"] = "PL58D398750F1219D8", ["Fire Emblem Gaiden"] = "PLEBEB90247BF68D44", ["Fortune Street"] = "PL9AA066CB1256F8D6", ["Game & Wario"] = "PLz5gUls4mkX8oePBnjdR7IbDcc16MHFtT", ["GoldenEye 007"] = "PL8662AEB50E84F131", ["Gyromite (Robot Gyro)"] = "PLB6A1D98FF7BD6566", ["Hogan's Alley"] = "PL05E37476360C9335", ["Hyrule Warriors"] = "PLz5gUls4mkX_R8qZYgrT8xHSWa5kIcnbP", ["Ice Climber"] = "PL9E67536C50C79072", ["Kid Icarus"] = "PLE4F9F167D4BA4345", ["Kid Icarus: Of Myths and Monsters"] = "PLFD8A91CDAD091F69", ["Kid Icarus: Uprising"] = "PLD267B8CC48D06DF5", ["Kirby 64: The Crystal Shards"] = "PL5E5D679F262434D2", ["Kirby Air Ride"] = "PL40AA1B28939CF023", ["Kirby Mass Attack"] = "PL43377079F186ABA5", ["Kirby Planet Robobot"] = "PLz5gUls4mkX8DQsBJAcH4L3x5Mg1aOuwZ", ["Kirby Super Star"] = "PLF3A344B92BCC9F54", ["Kirby Triple Deluxe"] = "PLz5gUls4mkX-dATpBUDEED0w5ZDGbYMdx", ["Kirby's Adventure"] = "PL69F8D339668AF3E3", ["Kirby's Dream Land"] = "PLC654C8FD7FC89851", ["Kirby's Dream Land 2"] = "PLz5gUls4mkX8Q5vwXb9uBe92HBeO-M5sD", ["Kirby's Dream Land 3"] = "PL6DB5BA7C08837865", ["Kirby's Epic Yarn"] = "PL30967AD6BAD7BD7F", ["Kirby's Return to Dream Land"] = "PLF448BE4103D8D03F", ["Luigi's Mansion"] = "PLFE050B85ED3FDE42", ["Luigi's Mansion: Dark Moon"] = "PLz5gUls4mkX8K_maB6fR-YJqqaCPtx44E", ["Mach Rider"] = "PL239EC6A08CC14A2A", ["Mario & Luigi: Bowser's Inside Story"] = "PL0F1CC7E40779F15F", ["Mario & Luigi: Dream Team"] = "PLz5gUls4mkX-SXZqAqzGJPjLNn_fLKYJG", ["Mario & Luigi: Superstar Saga"] = "PLACFF23150DBE2D03", ["Mario & Sonic at the London 2012 Olympic Games"] = "PL6254E880453C8E31", ["Mario & Sonic at the Sochi 2014 Olympic Winter Games"] = "PLz5gUls4mkX_A1TnwyJKqRY2yQVKfMmYF", ["Mario Bros."] = "PLA6E774C2577CB711", ["Mario Kart 7"] = "PL718429D76E750484", ["Mario Kart 64"] = "PL1F74290E8FDB692B", ["Mario Kart Wii"] = "PL2CC2570849E29867", ["Mario Kart: Double Dash!!"] = "PL066E37CB5C6EDC8D", ["Mario Party 9"] = "PLA2B46FA9F471368F", ["Mario's Tennis"] = "PLF7D09342C46476BF", ["MOTHER / Earthbound Beginnings"] = "PLz5gUls4mkX8Fo2pdrFKPw3OlE_179Gbo", ["MOTHER 3 (1/2)"] = "PL5AFAB0251FF4912F", ["MOTHER 3 (2/2)"] = "PLz5gUls4mkX9nzI4gyuUwVHKq5XzdJggC", ["NES Remix"] = "PLz5gUls4mkX9Fco4HqsUxDKOZAeSMTBLp", ["New Super Mario Bros."] = "PL52F22C55B2BDA4A6", ["New Super Mario Bros. 2"] = "PL581C5E5239B869BD", ["New Super Mario Bros. U"] = "PLz5gUls4mkX9oDmdUAfgpiprWW7e8FsqX", ["New Super Mario Bros. Wii"] = "PLD902F5E40D382277", ["Nintendogs"] = "PLF368C2C9EA95B712", ["Paper Mario: Sticker Star"] = "PLz5gUls4mkX_AIvtxqyjr07K9IW3YWQ7B", ["Paper Mario: The Thousand-Year Door"] = "PLAE1E7981ABE768F6", ["PiCOPiCT"] = "PLFB6BF2060E0F37D5", ["Pikmin 2"] = "PL8270A5CCBAE70F4B", ["Pikmin 3"] = "PLz5gUls4mkX8JUFzdNYPyF5Rudaz3rVQk", ["Pilotwings"] = "PL1FFEF1D7B320F2EF", ["Pilotwings Resort"] = "PL6ACEFA68F4B99615", ["Pokémon Battle Revolution"] = "PL8D203B6A762CC655", ["Pokémon Colosseum"] = "PL32EAC40D5778B393", ["Pokémon Snap"] = "PL717082ACA047DCF9", ["Professor Layton vs. Phoenix Wright: Ace Attorney"] = "PLz5gUls4mkX_GyguKZnENYfhGjJSgqB9D", ["Punch-Out"] = "PLz5gUls4mkX9rlEHDFL_WtBneRKulYRSy", ["Punch-Out!!"] = "PLz5gUls4mkX_SbU1eOYCW6HXqviCmRyc-", ["Rhythm Heaven"] = "PLDE6D019045312411", ["Rhythm Heaven Fever"] = "PLE23EDEFEF6843B74", ["Stack-Up"] = "PL04FA6C030324FFF6", ["Super Mario 3D Land"] = "PL0E199CDDE92F83DE", ["Super Mario 3D World"] = "PLz5gUls4mkX-AM61S5BeBt_UaxPvXF4iZ", ["Super Mario 64"] = "PL8FA3FE759E7FEE2B", ["Super Mario All-Stars"] = "PL2C921C30758CF018", ["Super Mario Bros."] = "PL6C29099C33AFE345", ["Super Mario Bros. 2"] = "PLA78B1ECF21EBAE0E", ["Super Mario Bros. 3"] = "PL45AF721D6D42EA80", ["Super Mario Galaxy"] = "PL7CFEF478E3980B62", ["Super Mario Galaxy 2"] = "PL706D99B420CA57E6", ["Super Mario Kart"] = "PL257494FCC2985545", ["Super Mario Land"] = "PLC574FCCF19998F17", ["Super Mario Land 2: 6 Golden Coins"] = "PL5079610CCEBF8A17", ["Super Mario RPG"] = "PL2F3BF604BA5BE5CB", ["Super Mario Sunshine"] = "PL758E3A1DBCFFF017", ["Super Mario World"] = "PLE14D89ABE94E7409", ["Super Mario World 2: Yoshi's Island"] = "PL5D8399FA91008F97", ["Super Metroid"] = "PL0BCE0BA953AC33E4", ["Super Smash Bros."] = "PLD6D74CA0C865B2B5", ["Super Smash Bros. 3DS"] = "PLz5gUls4mkX-RAT5kisCujb-R_Zw4In3B", ["Super Smash Bros. Brawl (1/2)"] = "PLA2E3926DAFA8F80C", ["Super Smash Bros. Brawl (2/2)"] = "PL94F9315233CAFF11", ["Super Smash Bros. Melee"] = "PL67D312AAC7F2E719", ["Tekken Tag Tournament 2: Wii U Edition"] = "PLz5gUls4mkX-3DY1U4P-_eC29m_nI7czc", ["The Legend of Zelda"] = "PLC74949D4A02C5E5D", ["The Legend of Zelda: A Link Between Worlds"] = "PLz5gUls4mkX8Z_HPYY9xFHth0f-7qIrWn", ["The Legend of Zelda: A Link to the Past"] = "PL0D2CCAC050B0B904", ["The Legend of Zelda: Majora's Mask"] = "PLC675B851A38C9C2F", ["The Legend of Zelda: Ocarina of Time"] = "PL8D1E4637261C45EF", ["The Legend of Zelda: Skyward Sword"] = "PLC5AE6E1EEA630D30", ["The Legend of Zelda: The Wind Waker"] = "PL3E7B876342ECE5C0", ["The Legend of Zelda: Twilight Princess"] = "PLF6FC95426946F1A5", ["The Mysterious Murasame Castle"] = "PL35D7AA891D9EB377", ["Vs. Excitebike"] = "PLE26C26D96E84733D", ["Zelda II: The Adventure of Link"] = "PL265AE9A5413844AD", }

-- formats playlist IDs and titles local function format_param(titles) assert (titles, 'titles must exist') local result = "" if (titles == "") then return titles end local label_map = { ["MOTHER 3 (1/2)"] = "MOTHER 3", ["MOTHER 3 (2/2)"] = "MOTHER 3", ["Punch-Out"] = "Punch-Out!!", }	local title_map = { ["50k"] = "100k;150k;Specials / Random Stuff", ["EarthBound Beginnings/MOTHER"] = "MOTHER / Earthbound Beginnings", ["Game and Wario"] = "Game & Wario", ["Super Smash Bros. Brawl"] = "Super Smash Bros. Brawl (1/2);Super Smash Bros. Brawl (2/2)", ["Final Fantasy XIV: A Realm Reborn"] = "Final Fantasy XIV", ["Kirby: Stripes and a Smile"] = "Nintendo 3DS", ["Super Mario All-Stars + Super Mario World"] = "Super Mario All-Stars;Super Mario World", ["Super Mario All-Stars: 25th Anniversary Edition"] = "Super Mario All-Stars", ["Tekken Tag Tournament 2"] = "Tekken Tag Tournament 2: Wii U Edition", ["The Legend of Zelda: Ocarina of Time 3D"] = "The Legend of Zelda: Ocarina of Time", }	titles = mw.text.split(title_map[titles] or titles, ";") for index,value in ipairs(titles) do		if ids[value] then if (index > 1) then -- if not the first playlist result = result .. ", "			end result = result .. string.format("%s ",ids[value],(label_map[value] or value)) end end return result end

function p.main(frame) local title = frame.args[1] or "" --if there's any link syntax, then we override the main function if hasLinkSyntax(title) then return title elseif pcall(function result = format_param(title) end) then return frame:preprocess(result) else return frame:preprocess("") end end

function p.link(frame) local title = frame.args[1] or "" local id = ids[title] if id then return 'https://web.archive.org/web/0/www.youtube.com/playlist?list=' .. id	end return "" end

return p