Module:Release

local p = {}

D = {} T = {} N = {} A = {}

function ReleaseInsert(Date, Type, Name, Artist) table.insert(D, Date) table.insert(T, Type) table.insert(N, Name) table.insert(A, Artist) end

--These should go in chronological order. --Please note that if an artist name includes a single quote, --it needs to be written as \' so the quote is not interpreted as the end of the name. --ReleaseInsert('yyyy-mm-dd', 'Number+Type', 'Release Name', 'Artist')

ReleaseInsert('2021-10-11', '1st Music Card', 'Waratte', 'RABBIT HUTCH') ReleaseInsert('2021-10-11', '2nd Music Card', 'Kakusei ♡ Shoujo Kyonshii', 'MERUCHU') ReleaseInsert('2021-10-20', '4th Single', 'Kaika Sengen!', 'Nanaland') ReleaseInsert('2021-10-22', '3rd Single', 'Club Moon / Cupid', 'femme fatale') ReleaseInsert('2021-10-25', '14th Digital Single', 'Tsubame (YOASOBI)|Tsubame', 'YOASOBI') ReleaseInsert('2021-10-26', '1st Single', 'Pirikarira', 'HO6LA') ReleaseInsert('2021-10-27', '4th Single', 'Tomedonai Shiosai ni Bokutachi wa Nani wo Utau Darou ka', 'ARCANA PROJECT') ReleaseInsert('2021-11-03', '9th Single', 'Sensitive', 'AMEFURASSHI') ReleaseInsert('2021-11-09', '9th Single', 'SING・LA・BANG・SHOW!', 'Iketeru Hearts') ReleaseInsert('2021-11-09', '3rd Mini Album', 'URBAN WAFARE', 'Pimm\'s') ReleaseInsert('2021-11-09', '1st Album', 'Shitennou', 'MAPA') ReleaseInsert('2021-11-10', '2nd Single', 'Mahoroba Asterisk', '≠ME') ReleaseInsert('2021-11-10', '2nd Single', 'Shingetsu no Da Capo', 'Aizawa Risa') ReleaseInsert('2021-11-10', '6th Single', 'Canary Yellow', 'Uchida Aya') ReleaseInsert('2021-11-10', '12th Single', 'EVOLUTiON:', 'Nanjo Yoshino') ReleaseInsert('2021-11-10', '3rd EP', 'Narrow', 'Kusunoki Tomori') ReleaseInsert('2021-11-23', '2nd Mini Album', 'Winter Cocktail', 'Suwa Nanaka') ReleaseInsert('2021-11-24', '8th Single', 'Kakusei', '22/7') ReleaseInsert('2021-11-24', '14th Single', 'Shin Kiteretsu Monogatari', 'FES☆TIVE') ReleaseInsert('2021-11-24', '1st Album', 'U (NiziU)|U', 'NiziU') ReleaseInsert('2021-12-01', '2nd Single', 'Azuma Kara Nishi e', 'Furihata Ai') ReleaseInsert('2021-12-01', '2nd EP', 'THE BOOK 2', 'YOASOBI') ReleaseInsert('2021-12-07', '3rd Mini Album', 'Renatus', 'HöLDERLINS') ReleaseInsert('2021-12-08', '11th Single', 'Break a leg!', 'Last Idol') ReleaseInsert('2021-12-15', '3rd Single', 'More Fantastic', 'B.O.L.T')

function Ordinal(anumber) if anumber % 10 == 1 then return anumber .. "st" elseif anumber % 10 == 2 then if anumber%100==12 then return anumber .. "th" else return anumber .. "nd" end elseif anumber % 10 == 3 then if anumber%100==13 then return anumber .. "th" else return anumber .. "rd" end else return anumber .. "th" end end

function WhereDateXStarts(yyyymmdd) i = 0 repeat i=i+1 until D[i] >= yyyymmdd or i == table.getn(D) if D[i] < yyyymmdd then i = 1 end return i end

function WhereDateXEnds(yyyymmdd) i = 0 repeat i=i+1 until D[i] > yyyymmdd or i == table.getn(D) if D[i] > yyyymmdd then i = i-1 end return i end

function p.upcoming(frame) num_days = tonumber(frame.args.days or 7) num_min = tonumber(frame.args.min or 2) num_max = tonumber(frame.args.max or 999999) starting = frame.args.starting or os.date("%Y-%m-%d",os.time+32400) ending = os.date("%Y-%m-%d", os.time{year=string.sub(starting,1,4), month=string.sub(starting,6,7), day=string.sub(starting,9,10)}+86400*(num_days-1)) --output = "num_days: " .. num_days .. "num_min: " .. num_min .. "starting: " .. starting .. "ending: " ..ending --if 1>0 then return output end STARTBEGINS = WhereDateXStarts(starting) ENDENDS = WhereDateXEnds(ending) if (STARTBEGINS+num_max-1)0 then return output end LISTEND = table.getn(D)

--output = "starting: " .. starting .. " ending: " .. ending .. " STARTBEGINS: " .. STARTBEGINS .. " ENDENDS: " .. ENDENDS .. " LISTEND: " .. LISTEND lastday = 0 output = "" --First read group i = STARTBEGINS while i<= ENDENDS do       thisday = string.sub( D[i], 6, 10 ) if thisday ~= lastday then --It's a new day, something should be written. output = output .. ";" .. os.date("%B %e", os.time{year=2001, month=string.sub(D[i],6,7), day=string.sub(D[i],9,10)}) if thisday==starting then output = output .. ", Release Day!" else output = output .. "" end output = output .. "\n" end output = output .. ": '''" .. T[i] .. "''' " .. N[i] .. " by " .. A[i] .. "\n" lastday = thisday i=i+1 end return output -- .. " " .. os.clock end

function p.between(frame) startdate=frame.args[1] enddate=frame.args[2] typesearch = frame.args.typesearch if startdate > enddate then --You trying to screw things up? Well, we'll just flip 'em. temp = startdate startdate = enddate enddate = temp end output = "" STARTBEGINS = WhereDateXStarts(startdate) ENDENDS = WhereDateXEnds(enddate) --output = "ENDENDS: " .. ENDENDS --if 1>0 then return output end LISTEND = table.getn(D)

--output = "starting: " .. starting .. " ending: " .. ending .. " STARTBEGINS: " .. STARTBEGINS .. " ENDENDS: " .. ENDENDS .. " LISTEND: " .. LISTEND output = "" --First read group i = STARTBEGINS while i<= ENDENDS do       if string.find(string.lower(T[i]), string.lower(typesearch)) then output = output .. ":" .. D[i] .. " '''" .. T[i] .. "''' " .. N[i] .. " by " .. A[i] .. "\n" end i=i+1 end return output end

function p.random math.randomseed( os.time ) return "" .. N[math.random(" end

return p --