Remove duplicates from credits
This commit is contained in:
@@ -621,6 +621,8 @@
|
|||||||
(for line (.split .content (Stream.fromString creditsTSV) "\n") (line.split "\t"))
|
(for line (.split .content (Stream.fromString creditsTSV) "\n") (line.split "\t"))
|
||||||
headings
|
headings
|
||||||
[]
|
[]
|
||||||
|
edgeCaseCredits
|
||||||
|
(new Map<String,String>)
|
||||||
headingIndices
|
headingIndices
|
||||||
(new Map<String,Int>)
|
(new Map<String,Int>)
|
||||||
headingData
|
headingData
|
||||||
@@ -643,15 +645,26 @@
|
|||||||
(case data
|
(case data
|
||||||
([heading credit _sourceOrUrl]
|
([heading credit _sourceOrUrl]
|
||||||
(ifLet [idx (dictGet headingIndices heading)]
|
(ifLet [idx (dictGet headingIndices heading)]
|
||||||
(let [hd (dictGet headingData heading)
|
(let [edgeCaseCredit (dictGet edgeCaseCredits heading)
|
||||||
|
hd (dictGet headingData heading)
|
||||||
|
// Push unless given a duplicate:
|
||||||
|
hdPush ->:Void data
|
||||||
|
(let [dataStr (data.toString)]
|
||||||
|
(when (= credit edgeCaseCredit)
|
||||||
|
(return))
|
||||||
|
(doFor d hd
|
||||||
|
(when (= (d.toString) dataStr)
|
||||||
|
(return)))
|
||||||
|
(hd.push data))
|
||||||
headingLineData (nth creditsData idx)]
|
headingLineData (nth creditsData idx)]
|
||||||
(case headingLineData
|
(case headingLineData
|
||||||
([heading ""]
|
([heading ""]
|
||||||
|
(dictSet edgeCaseCredits heading credit)
|
||||||
(setNth headingLineData 1 credit))
|
(setNth headingLineData 1 credit))
|
||||||
(["" heading]
|
(["" heading]
|
||||||
(hd.push ["" " ${credit}"]))
|
(hdPush ["" " ${credit}"]))
|
||||||
((or [heading] [heading _])
|
((or [heading] [heading _])
|
||||||
(hd.push ["" credit]))
|
(hdPush ["" credit]))
|
||||||
(never otherwise)))
|
(never otherwise)))
|
||||||
|
|
||||||
(throw "no heading $heading to place credit $data")))
|
(throw "no heading $heading to place credit $data")))
|
||||||
|
Reference in New Issue
Block a user