Module:SongCollectionMulti:修订间差异

来自Arcaea中文维基
 
无编辑摘要
 
(未显示同一用户的4个中间版本)
第1行: 第1行:
local mad = require 'Module:AnotherData'
local mad = require 'Module:AnotherData'
local cLink = require 'Module:ConvertLink'
local cal = mw.loadJsonData 'Template:ComplexArtistsList.json'
local trans = mw.loadJsonData 'Template:Transition.json'
local SL = mw.loadJsonData 'Template:Song Length.json'
-- local VT = mw.loadJsonData 'Template:VersionTime.json'
local lang = mw.language.getContentLanguage()
local lang = mw.language.getContentLanguage()
local frame = mw.getCurrentFrame()
local frame = mw.getCurrentFrame()
local p = {}
local p = {}


local dates, versionNames = {}, {}
-- 分离双平台页的曲包
-- 同曲目在双平台使用不同songid:
local discrete_pack = {Arcaea='', ['Memory Archive']=''}
local different_id = {['edenwacca']='eden'}
-- 分离双平台页的曲包 ,value为后缀附加内容: '曲包'->' (xx版曲包)' ; ''->' (xx版)'
local discrete_pack = {['Arcaea']=' 曲包', ['Memory Archive']=''}


local function verQuery(sec)
local bydAppend = {last='lasteternity'}
local date = tonumber(lang:formatDate('ymd', '@' .. sec)) - 1
if date > dates[#dates] then return '@' end
local l, r = 1, #dates
while l < r do
local m = math.floor((l + r) / 2)
if dates[m] < date then
l = m + 1
else
r = m
end
end
return versionNames[l]
end


local function otherTitles(song)
local function otherTitles(song)
第30行: 第20行:
if titleJa then table.insert(res, ('<span lang="ja">-{%s}-</span>'):format(titleJa)) end
if titleJa then table.insert(res, ('<span lang="ja">-{%s}-</span>'):format(titleJa)) end
table.insert(res, song.title_localized['zh-Hans'])
table.insert(res, song.title_localized['zh-Hans'])
for _, diff in ipairs(song.difficulties) do
-- for _, diff in ipairs(song.difficulties) do
if diff.title_localized then
-- if diff.title_localized then
table.insert(res, diff.title_localized.en .. ' ' .. mad.color {
-- table.insert(res, '--<br>'..diff.title_localized.en .. ' ' .. mad.color {
rc = diff.ratingClass + 1, -- 为什么没有设置成对应关系!?(恼)
-- rc = diff.ratingClass + 1, -- 为什么没有设置成对应关系!?(恼)
txt = ('[%s]'):format(({[3] = 'Beyond'})[diff.ratingClass]),
-- txt = ('[%s]'):format(({[3] = 'Beyond'})[diff.ratingClass]),
inline = true
-- inline = true
})
-- })
end
-- end
end
-- end
return res
return res
end
end


local cal = mw.loadJsonData 'Template:ComplexArtistsList.json'
local function BYDtag()
local trans = mw.loadJsonData 'Template:Transition.json'
return mad.color{rc = 4,txt = '[Beyond]',inline = true}
end


local function link(l, d)
local function link(l, d)
第64行: 第55行:
local ctrlTouch = '[[文件:Icon Touch2.png|16px|top|触摸|link=]]'
local ctrlTouch = '[[文件:Icon Touch2.png|16px|top|触摸|link=]]'
local ctrlJC = '[[文件:Icon Joy-Con2.png|16px|top|Joy-Con|link=]]'
local ctrlJC = '[[文件:Icon Joy-Con2.png|16px|top|Joy-Con|link=]]'
local mobileIcon = '[[文件:Icon Smartphone.png|16px|link=曲目列表 (移动版)]]'
local nsIcon = '[[文件:Icon Nintendo switch.png|16px|link=曲目列表 (Nintendo Switch版)]]'


local sectionCode = {unknown = 0, free = 1, archive = 2, mainstory = 3, sidestory = 4, collab = 5, single = 6}
local sectionCode = {unknown = 0, free = 1, archive = 2, mainstory2 = 3,mainstory = 4, sidestory = 5, collab = 6, single = 7}
local function main(args, durArgs)
local function main(args, durArgs)
local view = {}
local view = {}
第77行: 第70行:
local ns_id={}
local ns_id={}
for _, song in ipairs(mad.listOf('songs', 'mobile')) do
for _, song in ipairs(mad.listOf('songs', 'mobile')) do
mobile_id[song.id] = 1
if not song.deleted then
multi_id[song.id] = 1
mobile_id[song.id] = 1
multi_song[song.id] = song
multi_id[song.id] = 1
multi_song[song.id] = song
end
end
end
for _, song in ipairs(mad.listOf('songs', 'ns')) do
for _, song in ipairs(mad.listOf('songs', 'ns')) do
第89行: 第84行:
end
end
end
end
for _,v in pairs(different_id) do
local ns2mo = trans.multiId
local mo2ns = {}
for ns,mo in pairs(ns2mo) do mo2ns[mo]=ns end
for v in pairs(ns2mo) do
multi_song[v] = nil
multi_song[v] = nil
end
end
-- local AB = {}
-- for i,j in pairs(bydAppend) do AB[j] = i end
for _, song in pairs(multi_song) do
for _, song in pairs(multi_song) do
local row2 = 'rowspan="2"|'
local id = song.id
local id = song.id
local packItem = mad.packQueryWrap(song.set, 'mobile')
local packItem = mad.packQueryWrap(song.set, 'mobile')
local data = setmetatable({}, {__index = table})
local data = setmetatable({}, {__index = table})
local function input(...) return args[table.concat({id, ...}, '.')] end
local function input(...) return args[table.concat({id, ...}, '.')] end
if id ~= 'lasteternity' then
table.insert(view, {
local BydSong, BydRep, BydData, BydTitle, BydSong2, BydData2
data = data,
if song.difficulties[4] and song.difficulties[4].title_localized and song.difficulties[4].title_localized.en then
sort = {sectionCode[packItem['section']], packItem['numero'], song.date}
BydTitle = song.difficulties[4].title_localized.en
})
if id == 'last' then
BydTitle = 'Last &#124; Moment'
end
BydRep = -1
BydSong = song.difficulties[4]
BydData = setmetatable({}, {__index = table})
if bydAppend[id] then
-- BydId2 = bydAppend[id]
-- BydSong2 = multi_song[BydId2]
-- BydData2 = setmetatable({}, {__index = table})
row2 = 'rowspan="3"|'
end
end
end
-- 平台
-- 平台
local display_plat = ''
local display_plat = ''
local NSid = id
local NSid = id
if mobile_id[id] then
if mobile_id[id] then
   display_plat = display_plat .. '[[文件:Icon Smartphone.png|16px|link=曲目列表 (移动版)]]'
   display_plat = display_plat .. mobileIcon
end
end
if ns_id[id] then
if ns_id[id] then
   display_plat = display_plat .. '[[文件:Icon Nintendo switch.png|16px|link=曲目列表 (Nintendo Switch版)]]'
   display_plat = display_plat .. nsIcon
elseif different_id[id] then
elseif mo2ns[id] then
   display_plat = display_plat .. '[[文件:Icon Nintendo switch.png|16px|link=曲目列表 (Nintendo Switch版)]]'
   display_plat = display_plat .. nsIcon
   NSid = different_id[id]
   NSid = mo2ns[id]
end
end
if display_plat == '' then
if display_plat == '' then
   display_plat = '无'
   display_plat = '无'
end
if BydSong then
if ns_song[id] and ns_song[id].difficulties[4] then
display_plat = row2 .. display_plat
else
BydData:insert(mobileIcon)
BydRep = BydRep + 1
end
end
end
data:insert(display_plat)
data:insert(display_plat)
-- 图片
-- 图片
data:insert(id)
local pic = ('[[文件:Songs %s.jpg|75px]]'):format(id)
if BydSong then
local BydPic = ('[[文件:Songs %s_byd.jpg|75px]]'):format(id)
-- pic = pic ..'<br>'.. BydPic
BydData:insert(BydPic)
BydRep = BydRep + 2
if BydSong2 then
BydData2:insert(('[[文件:Songs %s.jpg|75px]]'):format(BydId2))
end
end
data:insert(pic)
-- 标题与副标题 otherTitles
-- 标题与副标题 otherTitles
data:insert(input '标题' or table.concat({'[[' .. mad.linkTitle(song) .. ']]', unpack(otherTitles(song))}, '<br>'))
data:insert(input '标题' or table.concat({'[[' .. mad.linkTitle(song) .. ']]', unpack(otherTitles(song))}, '<br>'))
if BydSong then
BydData:insert('[[' ..mad.linkTitle(song)..'|'..BydTitle.. ']]')
end
-- 曲师
-- 曲师
local artist = ''
local artist = cLink.artistLink(song.artist)
local artist_list = cal[string.gsub(song.artist, ' ' , '')]
local BydArtist
if artist_list then
if BydSong then
   for _, data in ipairs(artist_list) do
BydArtist = cLink.artistLink(BydSong.artist or nil)
   local display_ja = formatJapaneseText(data.display)
if BydArtist == artist then
   if data.link then
BydArtist = nil
     artist = artist .. link('曲师列表#' .. data.link, display_ja)
end
     else
if BydArtist then
     artist = artist .. display_ja
BydData:insert(BydArtist)
   end
BydRep = BydRep + 1
   end
else
else
artist = row2 .. artist
   artist = formatJapaneseText(song.artist)
end
   artist = link('曲师列表#' .. song.artist, artist)
end
end
-- local allArtist = artist .. (BydArtist and '<br>--<br>' .. BydArtist .. BYDtag() or '')
data:insert(input '音乐家' or artist)
data:insert(input '音乐家' or artist)
--曲包
-- 曲包
local cc = 'Collaboration %- Collaboration'
local pack_main = trans.packName[song.set] or packItem['name']
local ccl = 'Collaboration#Collaboration'
local pack_ml = cLink.packLink(pack_main,1)
local ccd = 'Collaboration'
local pack_main = string.gsub(trans.packName[song.set] or packItem['name'], cc, ccl)
local pack_md = string.gsub(pack_main, ccl, ccd)
if mobile_id[id] and ns_id[NSid] then
if mobile_id[id] and ns_id[NSid] then
local song_ns = ns_song[NSid]
local song_ns = ns_song[NSid]
packItem_ns = mad.packQueryWrap(song_ns.set, 'ns')
local packItem_ns = mad.packQueryWrap(song_ns.set, 'ns')
local pack_ns = string.gsub(trans.packName[ns_song[NSid].set] or packItem_ns['name'], cc, ccl)
local pack_ns = trans.packName[ns_song[NSid].set] or packItem_ns['name']
local pack_nd = string.gsub(pack_ns, ccl, ccd)
local pack_nl = cLink.packLink(pack_ns,1,1)
if pack_ns == pack_main then
if pack_ns == pack_main then
if discrete_pack[pack_main] then
if discrete_pack[pack_main] then
local pack_ml = pack_main .. (' (移动版%s)'):format(discrete_pack[pack_main])
pack = pack_ml .. onlyMobile .. '<br \>--<br \>' ..pack_nl .. onlyNS
local pack_nl = pack_ns .. (' (NS版%s)'):format(discrete_pack[pack_main])
-- pack_md = pack_md .. '<br /><small>(移动版)</small>'
-- pack_nd = '<small>(NS版)</small>'
-- pack = link(pack_ml, pack_md) .. onlyMobile .. '<br \>' ..link(pack_nl, pack_nd) .. onlyNS
pack = link(pack_ml, pack_md) .. onlyMobile .. '<br \>--<br \>' ..link(pack_nl, pack_nd) .. onlyNS
else
else
pack = link(pack_main, pack_md)
pack = pack_ml
end
end
else
else
pack = link(pack_main, pack_md) .. onlyMobile .. '<br \>--<br \>' ..link(pack_ns, pack_nd) .. onlyNS
pack = pack_ml .. onlyMobile .. '<br \>--<br \>' .. pack_nl .. onlyNS
end
end
elseif mobile_id[id] then
elseif mobile_id[id] then
pack = link(pack_main, pack_md) .. onlyMobile
pack = pack_ml .. onlyMobile
else 
else 
pack = link(pack_main, pack_md) .. onlyNS
pack = pack_ml .. onlyNS
end
if BydSong then
pack = row2 .. pack
end
end
data:insert(input '所属曲包' or pack)
data:insert(input '所属曲包' or pack)
--其他信息
-- 其他信息
local bpm = tonumber(input 'BPM') or song.bpm_base
local bpm = tonumber(input 'BPM') or song.bpm
data:insert((tonumber(song.bpm) ~= bpm and ('data-sort-value=%s|'):format(bpm) or '') .. song.bpm)
local length = (durArgs[id] or SL.normal[id] or ' @ ') .. (bydLength or '')
data:insert(durArgs[id] or ' @ ')
local ver = cLink.fullVersionNum(song.version, song.date)
data:insert(song.version .. '.' .. (input '收录版本' or verQuery(song.date)))
local bydBpm, bydVer, bydLength
if BydSong then
if BydSong.bpm then
BydData:insert(BydSong.bpm)
BydRep = BydRep + 1
else
bpm = row2 .. bpm
end
if SL.beyond[id] and SL.beyond[id]~=length then
-- bydLength = '<br>--<br>'..SL.beyond[id] ..'<br>'.. BYDtag() or ''
BydData:insert(SL.beyond[id])
BydRep = BydRep + 1
else
length = row2 .. length
end
if BydSong.version and BydSong.date then
-- bydVer='<br>--<br>'..versionDate(BydSong.version, BydSong.date)..'<br>'..BYDtag() or ''
bydVer=cLink.fullVersionNum(BydSong.version, BydSong.date)
BydData:insert(bydVer)
BydRep = BydRep + 1
else
ver = row2 .. ver
end
end
data:insert(bpm)
data:insert(length)
data:insert(input '收录版本' and song.version .. '.' .. input '收录版本' or ver)
第229行: 第290行:
for i=1, #lv_order do
for i=1, #lv_order do
local j = lv_order[i]
local j = lv_order[i]
data:insert(input('等级', j) or lv_table[j])
Lv = input('等级', j) or lv_table[j]
if BydSong then
if j==3 then
data:insert('/')
BydData:insert(Lv == '0' and '/' or Lv)
if BydSong2 then BydData2:insert('/') end
else
data:insert(Lv == '0' and '/' or Lv)
BydData:insert('/')
if BydSong2 then BydData2:insert('/') end
end
BydRep = BydRep + 1
else
data:insert(Lv == '0' and '/' or Lv)
end
end
end
-- for i in {0, 1, 2, 4, 3} do
if id == 'lasteternity' then
-- data:insert(input(' 等级', i) or lv or '/')
bydAppend.last = {}
-- end
bydAppend.last.BydData2 = {data[2],data[3],data[9],data[10],data[11],data[12],data[13]}
bydAppend.last.BydRep2 = 6
else
table.insert(view, {
id = id,
BydData = BydData,
BydRep = BydRep,
data = data,
sort = {sectionCode[packItem['section']], packItem['numero'], song.date}
})
end
end
end
table.sort(view, 
table.sort(view, 
第247行: 第332行:


local res = {}
local res = {}
local template = '|-\n|%s' .. '||[[文件:Songs %s.jpg|75px]]' .. ('||%s'):rep(11)
local template = '|-\n|%s' .. ('||%s'):rep(12)
for idx, value in ipairs(view) do
for idx, value in ipairs(view) do
res[idx] = template:format(unpack(value.data))
res[idx] = template:format(unpack(value.data))
if value.BydData then
res[idx] =res[idx] .. ('\n|-\n|%s' .. ('||%s'):rep(value.BydRep)):format(unpack(value.BydData))
if bydAppend[value.id] then
res[idx] =res[idx] .. ('\n|-\n|%s' .. ('||%s'):rep(bydAppend[value.id].BydRep2)):format(unpack(bydAppend[value.id].BydData2))
end
end
end
end
return table.concat(res, '\n')
return table.concat(res, '\n')
第255行: 第346行:


function p.multi(frame)
function p.multi(frame)
for record in mw.text.gsplit(frame.args._ver_, '%s') do
local date, name = record:match '(%d+):(.*)'
table.insert(dates, tonumber(date))
table.insert(versionNames, name)
end
return main(frame:getParent().args, frame.args)
return main(frame:getParent().args, frame.args)
end
end


return p
return p

2024年11月21日 (四) 12:07的最新版本

可在Module:SongCollectionMulti/doc创建此模块的帮助文档

local mad = require 'Module:AnotherData'
local cLink = require 'Module:ConvertLink'
local cal = mw.loadJsonData 'Template:ComplexArtistsList.json'
local trans = mw.loadJsonData 'Template:Transition.json'
local SL = mw.loadJsonData 'Template:Song Length.json'
-- local VT = mw.loadJsonData 'Template:VersionTime.json'

local lang = mw.language.getContentLanguage()
local frame = mw.getCurrentFrame()
local p = {}

-- 分离双平台页的曲包:
local discrete_pack = {Arcaea='', ['Memory Archive']=''}

local bydAppend = {last='lasteternity'}

local function otherTitles(song)
	local res = {}
	local titleJa = song.title_localized.ja
	if titleJa then table.insert(res, ('<span lang="ja">-{%s}-</span>'):format(titleJa)) end
	table.insert(res, song.title_localized['zh-Hans'])
	-- for _, diff in ipairs(song.difficulties) do
	-- 	if diff.title_localized then
	-- 		table.insert(res, '--<br>'..diff.title_localized.en .. ' ' .. mad.color {
	-- 			rc = diff.ratingClass + 1, -- 为什么没有设置成对应关系!?(恼)
	-- 			txt = ('[%s]'):format(({[3] = 'Beyond'})[diff.ratingClass]),
	-- 			inline = true
	-- 		})
	-- 	end
	-- end
	return res
end

local function BYDtag()
	return mad.color{rc = 4,txt = '[Beyond]',inline = true}
end

local function link(l, d)
    if d then
        return '[[' .. l .. '|' .. d .. ']]'
    else
        return '[[' .. l .. ']]'
    end
end

local function formatJapaneseText(text)
    return mw.ustring.gsub(
        text, '[一-龠ぁ-ゔァ-ヴー々〆〤ヶ]+',
        function(v) return ('<span lang="ja">-{%s}-</span>'):format(v) end
    )
end

local onlyMobile = frame:expandTemplate{title = '仅', args = {'移动版', '', '图片角标'}}
local onlyNS = frame:expandTemplate{title = '仅', args = {'NS版', '', '图片角标'}}
local ctrlTouch = '[[文件:Icon Touch2.png|16px|top|触摸|link=]]'
local ctrlJC = '[[文件:Icon Joy-Con2.png|16px|top|Joy-Con|link=]]'
local mobileIcon = '[[文件:Icon Smartphone.png|16px|link=曲目列表 (移动版)]]'
local nsIcon = '[[文件:Icon Nintendo switch.png|16px|link=曲目列表 (Nintendo Switch版)]]'

local sectionCode = {unknown = 0, free = 1, archive = 2, mainstory2 = 3,mainstory = 4, sidestory = 5, collab = 6, single = 7}
local function main(args, durArgs)
	local view = {}
	-- local plat = 'mobile'
	-- 不对song下述提及的字段存在性做检验
	
	local multi_song={}
	local ns_song={}
	local multi_id={}
	local mobile_id={}
	local ns_id={}
	for _, song in ipairs(mad.listOf('songs', 'mobile')) do
		if not song.deleted then
			mobile_id[song.id] = 1
			multi_id[song.id] = 1
			multi_song[song.id] = song
		end
	end
	for _, song in ipairs(mad.listOf('songs', 'ns')) do
		ns_id[song.id] = 1
		ns_song[song.id] = song
		if not multi_id[song.id] then
			multi_id[song.id] = 1
			multi_song[song.id] = song
		end
	end
	
	local ns2mo = trans.multiId
	local mo2ns = {}
	for ns,mo in pairs(ns2mo) do mo2ns[mo]=ns end
	
	for v in pairs(ns2mo) do
		multi_song[v] = nil
	end
	
	-- local AB = {}
	-- for i,j in pairs(bydAppend) do AB[j] = i end 
	
	for _, song in pairs(multi_song) do
		local row2 = 'rowspan="2"|'
		local id = song.id
		local packItem = mad.packQueryWrap(song.set, 'mobile')
		local data = setmetatable({}, {__index = table})
		local function input(...) return args[table.concat({id, ...}, '.')] end
		
		local BydSong, BydRep, BydData, BydTitle, BydSong2, BydData2
		if song.difficulties[4] and song.difficulties[4].title_localized and song.difficulties[4].title_localized.en then
			BydTitle = song.difficulties[4].title_localized.en
			if id == 'last' then
				BydTitle = 'Last &#124; Moment'
			end
			BydRep = -1
			BydSong = song.difficulties[4]
			BydData = setmetatable({}, {__index = table})
			
			if bydAppend[id] then
				-- BydId2 = bydAppend[id]
				-- BydSong2 = multi_song[BydId2]
				-- BydData2 = setmetatable({}, {__index = table})
				row2 = 'rowspan="3"|'
			end
		end
		
		
		-- 平台
		
		local display_plat = ''
		local NSid = id
		if mobile_id[id] then
		    display_plat = display_plat .. mobileIcon
		end
		if ns_id[id] then
		    display_plat = display_plat .. nsIcon
		elseif mo2ns[id] then
		    display_plat = display_plat .. nsIcon
		    NSid = mo2ns[id]
		end
		if display_plat == '' then
		    display_plat = '无'
		end
		
		if BydSong then
			if ns_song[id] and ns_song[id].difficulties[4] then
				display_plat = row2 .. display_plat
			else
				BydData:insert(mobileIcon)
				BydRep = BydRep + 1
			end
		end
		data:insert(display_plat)
		
		-- 图片
		local pic = ('[[文件:Songs %s.jpg|75px]]'):format(id)
		if BydSong then
			local BydPic = ('[[文件:Songs %s_byd.jpg|75px]]'):format(id)
			-- pic = pic ..'<br>'.. BydPic
			BydData:insert(BydPic)
			BydRep = BydRep + 2
			if BydSong2 then
				BydData2:insert(('[[文件:Songs %s.jpg|75px]]'):format(BydId2))
			end
		end
		data:insert(pic)
		
		-- 标题与副标题 otherTitles
		data:insert(input '标题' or table.concat({'[[' .. mad.linkTitle(song) .. ']]', unpack(otherTitles(song))}, '<br>'))
		if BydSong then
			BydData:insert('[[' ..mad.linkTitle(song)..'|'..BydTitle.. ']]')
		end
		-- 曲师
		local artist = cLink.artistLink(song.artist)
		local BydArtist
		if BydSong then
			BydArtist = cLink.artistLink(BydSong.artist or nil)
			if BydArtist == artist then
				BydArtist = nil
			end
			if BydArtist then
				BydData:insert(BydArtist)
				BydRep = BydRep + 1
			else
				artist = row2 .. artist
			end
		end
		-- local allArtist = artist .. (BydArtist and '<br>--<br>' .. BydArtist .. BYDtag() or '')
		data:insert(input '音乐家' or artist)
		
		-- 曲包
		local pack_main = trans.packName[song.set] or packItem['name']
		local pack_ml = cLink.packLink(pack_main,1)
		if mobile_id[id] and ns_id[NSid] then
			local song_ns = ns_song[NSid]
			local packItem_ns = mad.packQueryWrap(song_ns.set, 'ns')
			local pack_ns = trans.packName[ns_song[NSid].set] or packItem_ns['name']
			local pack_nl = cLink.packLink(pack_ns,1,1)
			if pack_ns == pack_main then
				if discrete_pack[pack_main] then
					pack = pack_ml .. onlyMobile .. '<br \>--<br \>' ..pack_nl .. onlyNS
				else
					pack = pack_ml
				end
			else
				pack = pack_ml .. onlyMobile .. '<br \>--<br \>' .. pack_nl .. onlyNS
			end
		elseif mobile_id[id] then
			pack = pack_ml .. onlyMobile
		else 
			pack = pack_ml .. onlyNS
		end
		if BydSong then
			pack = row2 .. pack
		end
		data:insert(input '所属曲包' or pack)
		
		-- 其他信息
		local bpm = tonumber(input 'BPM') or song.bpm
		local length = (durArgs[id] or SL.normal[id] or ' @ ') .. (bydLength or '')
		local ver = cLink.fullVersionNum(song.version, song.date)
		local bydBpm, bydVer, bydLength
		if BydSong then
			if BydSong.bpm then
				BydData:insert(BydSong.bpm)
				BydRep = BydRep + 1
			else
				bpm = row2 .. bpm
			end
			if SL.beyond[id] and SL.beyond[id]~=length then 
				-- bydLength = '<br>--<br>'..SL.beyond[id] ..'<br>'.. BYDtag() or ''
				BydData:insert(SL.beyond[id])
				BydRep = BydRep + 1
			else
				length = row2 .. length
			end
			if BydSong.version and BydSong.date then
				-- bydVer='<br>--<br>'..versionDate(BydSong.version, BydSong.date)..'<br>'..BYDtag() or ''
				bydVer=cLink.fullVersionNum(BydSong.version, BydSong.date)
				BydData:insert(bydVer)
				BydRep = BydRep + 1
			else
				ver = row2 .. ver
			end
		end
		data:insert(bpm)
		data:insert(length)
		
		data:insert(input '收录版本' and song.version .. '.' .. input '收录版本' or ver)
		
		
		-- 难度等级
		local main_lv = {}
		local lv_table ={}
		for _,diff in pairs(song.difficulties) do
			main_lv[diff.ratingClass] = diff.rating .. (diff.ratingPlus and '+' or '')
		end
		if mobile_id[id] and ns_id[NSid] then
			local song_ns = ns_song[NSid]
			local ns_lv = {}
			local c_chart = {}
			for _,diff in pairs(song_ns.difficulties) do
				ns_lv[diff.ratingClass] = diff.rating .. (diff.ratingPlus and '+' or '')
				if diff.has_controller_alt_chart then
					c_chart[diff.ratingClass] = 1
				end
			end
			for i = 0, 4 do
				local lv
				if main_lv[i] and ns_lv[i] then
				    if main_lv[i] == ns_lv[i] then
				        lv = main_lv[i] .. (c_chart[i] and ('<br />' .. ctrlTouch .. ctrlJC) or '')
				    else
				        -- lv = main_lv[i] .. onlyMobile .. '<br />' .. ns_lv[i] .. (c_chart[i] and (ctrlTouch ..onlyNS .. '<br />' .. ns_lv[i] .. ctrlJC .. onlyNS) or onlyNS)
				    	lv = main_lv[i] .. onlyMobile .. '<br \>' .. ns_lv[i] .. onlyNS .. (c_chart[i] and ('<br />' .. ctrlTouch ..ctrlJC) or '')
				    end
				elseif main_lv[i] then
					lv = main_lv[i] .. onlyMobile
				elseif ns_lv[i] then
					lv = ns_lv[i] .. onlyNS
				else
					lv = '/'
				end
				lv_table[i] = lv
			end
		else
			for i = 0, 4 do
				local lv = main_lv[i] or '/'
				lv_table[i] = lv
			end
		end
		-- 顺序:PST PRS FTR ETR BYD
		local lv_order = {0, 1, 2, 4, 3}
		for i=1, #lv_order do
			local j = lv_order[i]
			Lv = input('等级', j) or lv_table[j]
			if BydSong then
				if j==3 then
					data:insert('/')
					BydData:insert(Lv == '0' and '/' or Lv)
					if BydSong2 then BydData2:insert('/') end
				else
					data:insert(Lv == '0' and '/' or Lv)
					BydData:insert('/')
					if BydSong2 then BydData2:insert('/') end
				end
				BydRep = BydRep + 1
			else
				data:insert(Lv == '0' and '/' or Lv)
			end
		end
		
		if id == 'lasteternity' then
			bydAppend.last = {}
			bydAppend.last.BydData2 = {data[2],data[3],data[9],data[10],data[11],data[12],data[13]}
			bydAppend.last.BydRep2 = 6
		else
			table.insert(view, {
				id = id,
				BydData = BydData,
				BydRep = BydRep,
				data = data,
				sort = {sectionCode[packItem['section']], packItem['numero'], song.date}
			})
		end
	end
	table.sort(view, 
		function(a, b)
			a, b = a.sort, b.sort
			for i = 1, 3 do
				local d = a[i] - b[i]
				if d ~= 0 then return d < 0 end
			end
			return false
		end)

	local res = {}
	local template = '|-\n|%s' .. ('||%s'):rep(12)
	for idx, value in ipairs(view) do
		res[idx] = template:format(unpack(value.data))
		if value.BydData then
			res[idx] =res[idx] .. ('\n|-\n|%s' .. ('||%s'):rep(value.BydRep)):format(unpack(value.BydData))
			if bydAppend[value.id] then
				res[idx] =res[idx] .. ('\n|-\n|%s' .. ('||%s'):rep(bydAppend[value.id].BydRep2)):format(unpack(bydAppend[value.id].BydData2))
			end
		end
	end
	return table.concat(res, '\n')
end

function p.multi(frame)
	return main(frame:getParent().args, frame.args)
end

return p