Modul:Kinostarts

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen

Die Dokumentation für dieses Modul kann unter Modul:Kinostarts/Doku erstellt werden

local p = {}
local l = {}

local lucky, Wikidata2Lemma = pcall( require, "Module:Wikidata2Lemma" )
if type( Wikidata2Lemma ) == "table" then
    Wikidata2Lemma = Wikidata2Lemma.Wikidata2Lemma()
else
    -- Fehlerfall; Wikidata2Lemma enthält Fehlermeldung
    return "<span class=\"error\">" .. Wikidata2Lemma .. "</span>"
end

local function formatString(text, typ)
	local text_neu
	if text then
	--text_neu = string.gsub(text, "- ", "– ")	
	text_neu = string.gsub(text, " – ", "&nbsp;– ")
	text_neu = string.gsub(text_neu, " (%d)", "&nbsp;%1")
	if typ == 'en' then
		text_neu = string.gsub(text_neu, "'", "’")	
	end
	return text_neu
	end
end

local function getLink(id, linkNameEn, titel, lemma)
	local linkTarget = mw.wikibase.sitelink(id) or lemma or Wikidata2Lemma.doIt(id)
	local linkName = mw.wikibase.label(id)
	if linkTarget then
		if linkName and (linkName ~= linkTarget) then 
			return "[[" .. linkTarget .. "|" .. formatString(linkName) .. "]]"
		else
			return "[[" .. formatString(linkTarget) .. "]]"
		end
	else
	--	local entity = mw.wikibase.getEntity(id)
		if linkName then 
			return formatString(linkName)
		elseif linkNameEn then
			return formatString(linkNameEn, 'en')
		else 
			l[#l + 1] = "{{Wikidata|" .. id .. "}}"
			if titel then
				return "[[d:" .. id .. "|" .. id .. "]]: Bitte Label eintragen!"
			end
		end
	end
end

local function getOriginaltitel(entity, id, linkNameEn)
	local output_ot = {
		ot = nil,
		ln = nil,
		tr = nil
	}
	if entity and entity.claims then
		local claim = entity.claims['P1476']
		if claim and claim[1].mainsnak.snaktype == 'value' then
			local originaltitel = claim[1].mainsnak.datavalue.value["text"]
			local originaltitel_lang = claim[1].mainsnak.datavalue.value["language"]
			local linkName = mw.wikibase.label(id)
			output_ot.ot = originaltitel
			output_ot.ln = originaltitel_lang
				
			if claim[1].qualifiers then
				local transcription1 = claim[1].qualifiers['P2440']
				local transcription2 = claim[1].qualifiers['P2183']
				local transcription = ""
				if transcription1 then
					transcription = transcription1[1].datavalue.value
				elseif transcription2 then
					transcription = transcription2[1].datavalue.value
				end
				
				if transcription ~= "" and transcription ~= linkName then
					output_ot.tr = transcription
				end
			end
		end
	end
	return output_ot
end

function p.getBechdelRef(frame)
	local rueck = frame.args[1]
	local entity = mw.wikibase.getEntity()
	local result = {}
	local check1, check2 = false
	
	if entity and entity.claims then
		local claims = entity.claims['P1552']
		if claims then
			
			for idx in pairs(claims) do
				local claim = claims[idx]
					
				local references = claim.references
				
				if references then
					for idy, value2 in pairs(references) do
						local reference = value2["snaks"]
						for idz, value3 in pairs(reference) do
							
							result[idz] = value3
							if idz == "P813" then
								check1 = true
							end
							if idz == "P4632" then
								check2 = true
							end
						end
					end
				end
				
			end
		end
	end
	
	if check1 and check2 then
	
		for id, value in pairs(result) do
			
			if id == "P813" and rueck == "zugriff" then
				return string.sub(value[1].datavalue.value.time, 2, 11)
			end
			
			if id == "P4632" and rueck == "url" then
				return "https://bechdeltest.com/view/" .. value[1].datavalue.value
			end
			
		end
		
		return true
	
	end
	
end

local function hasReference(claim)
	
	local references = claim.references
	
	if references then
		for idy, value2 in pairs(references) do
			local reference = value2["snaks"]
			for idz in pairs(reference) do
				
				if idz == "P854" then
					return true
				end
				
			end
		end
	end

end

local function listClaims(id, entity, property, arg2, label)
	if entity and entity.claims then
		local claims = entity.claims[property]
		local value, role
		if claims then
			
			result = {}
			
			local counter = 0
			
			for idx in pairs(claims) do
				counter = counter + 1
				local claim = claims[idx]
				if claim.mainsnak.datavalue then
					value = claim.mainsnak.datavalue.value["numeric-id"]
					local hasReference = hasReference(claim)
					if ((hasReference or property == "P136") and (arg2 and arg2 == "Ref")) or
						(not hasReference and (arg2 and arg2 == "noRef")) or
						(arg2 and (arg2 == "" or arg2 == "noLabels"))
					then
						local result_temp = getLink("Q" .. value)
						
						if claim.qualifiers and result_temp then
							if claim.qualifiers['P453'] then
								role = claim.qualifiers['P453'][1].datavalue.value["numeric-id"]
								local role_label = mw.wikibase.label("Q" .. role)
								if role_label then
									result_temp = result_temp .. "&nbsp;(" .. role_label .. ")"
								end
							elseif claim.qualifiers['P4633']  then
								result_temp = result_temp .. "&nbsp;(" .. claim.qualifiers['P4633'][1].datavalue.value .. ")"
							end
						end
						
						result[#result + 1] = result_temp
						
					end
				end
				if counter == 10 then
					break
				end
			
			end
			
			result = table.concat(result, ', ')
			
			if result ~= "" then
				if label then
					result = "<u>" .. label .. ":</u> " .. result
				end
			else
				return nil
			end
			
			return result
			
		end
	end
end

function p.getMovieData(frame)
	local id = frame.args[1]
	local arg2 = frame.args[2]
	local lemma = frame.args["lemma"]
	if lemma == "" then lemma = nil end
	local entity = mw.wikibase.getEntity(id)
	
	local linkNameEn
	if entity and entity.labels and entity.labels['en'] then
		linkNameEn = entity.labels['en']['value']
	end
	
	local originaltitel
	local originaltitel_array = getOriginaltitel(entity, id, linkNameEn)
	if originaltitel_array.ot and formatString(originaltitel_array.ot, 'en') ~= formatString(mw.wikibase.label(id), 'en') and getLink(id, linkNameEn) ~= formatString(originaltitel_array.ot, 'en') then
		originaltitel = "<br /><small>''(" .. formatString(originaltitel_array.ot, 'en')
		if originaltitel_array.tr then 
			originaltitel = originaltitel .. "&nbsp;/ " .. formatString(originaltitel_array.tr, 'en')
		end
		originaltitel = originaltitel .. ")''</small>"
	else 
		originaltitel = "" 
	end
	
	local gl1 = ""
	local gl2 = ""
	if lemma then
		gl1 = "<div style=\"float:left; width:20px;\">[[Datei:Zeichen 123 - Baustelle, StVO 1992.svg|20px|link=" .. lemma .. "]]</div><div style=\"margin-left:25px;\">"
		gl2 = "</div>"
	end
	
	local produktionsland = listClaims(id, entity, 'P495', arg2)
	if not produktionsland then produktionsland = "" end
	
	local cast_crew = {}
	cast_crew[#cast_crew + 1] = listClaims(id, entity, 'P57', arg2, 'Regie')
	cast_crew[#cast_crew + 1] = listClaims(id, entity, 'P58', arg2, 'Dreh&shy;buch')
	cast_crew[#cast_crew + 1] = listClaims(id, entity, 'P161', arg2, 'Besetzung')
	cast_crew[#cast_crew + 1] = listClaims(id, entity, 'P11108', arg2, 'Aufgenommene Personen')
	cast_crew[#cast_crew + 1] = listClaims(id, entity, 'P725', arg2, 'Sprecher')
	
	local genre = listClaims(id, entity, 'P136', arg2)
	if not genre then genre = "" end
	
	if arg2 and arg2 == "noLabels" then
		local result_noLabels = table.concat(l, ', ')
		if result_noLabels ~= "" then
			return result_noLabels .. ", "
		end
	else
		local wikidata_link = "<br /><small>→ [[d:" .. id .. "|bearbeiten]]</small>"
		return
				gl1 ..
				getLink(id, linkNameEn, "titel", lemma) ..
				originaltitel ..
				wikidata_link ..
				gl2 ..
		" || " .. produktionsland ..
		" || " .. table.concat(cast_crew, '; ') ..
		" || " .. genre
	end

end

-- Kats für Produktionsland (P495) auslesen
function p.getPlKats(frame)
	
	local pl_kats = {
		[889]	=	8875823,	 -- Afghanischer Film
		[79]	=	8408814,	 -- Ägyptischer Film
		[262]	=	8234996,	 -- Algerischer Film
		[916]	=	8252967,	 -- Angolanischer Film
		[414]	=	6152871,	 -- Argentinischer Film
		[399]	=	8881925,	 -- Armenischer Film
		[227]	=	8281974,	 -- Aserbaidschanischer Film
		[115]	=	8425338,	 -- Äthiopischer Film
		[408]	=	7237428,	 -- Australischer Film
		[778]	=	6339467,	 -- Bahamaischer Film
		[31]	=	7454401,	 -- Belgischer Film
		[225]	=	6544101,	 -- Bosnisch-herzegowinischer Film
		[155]	=	7141680,	 -- Brasilianischer Film
		[145]	=	6504756,	 -- Britischer Film
		[219]	=	7672785,	 -- Bulgarischer Film
		[965]	=	8915911,	 -- Burkinischer Film
		[298]	=	7523869,	 -- Chilenischer Film
		[148]	=	5311748,	 -- Chinesischer Film
		[35]	=	6127808,	 -- Dänischer Film
		[183]	=	7141777,	 -- Deutscher Film
		[786]	=	8387445,	 -- Dominikanischer Film
		[736]	=	13519846,	 -- Ecuadorianischer Film
		[191]	=	8424490,	 -- Estnischer Film
		[33]	=	6838433,	 -- Finnischer Film
		[142]	=	7141714,	 -- Französischer Film
		[230]	=	8966847,	 -- Georgischer Film
		[41]	=	7454543,	 -- Griechischer Film
		[790]	=	7520061,	 -- Haitianischer Film
		[668]	=	5668044,	 -- Indischer Film
		[252]	=	6832868,	 -- Indonesischer Film
		[796]	=	6838021,	 -- Irakischer Film
		[794]	=	6832921,	 -- Iranischer Film
		[27]	=	8554385,	 -- Irischer Film
		[189]	=	7317303,	 -- Isländischer Film
		[801]	=	6832721,	 -- Israelischer Film
		[38]	=	6605085,	 -- Italienischer Film
		[766]	=	8561183,	 -- Jamaikanischer Film
		[17]	=	7237135,	 -- Japanischer Film
		[805]   =   6841488,     -- Jemenitischer Film
		[810]	=	20192498,	 -- Jordanischer Film
		[36704]	=	7507211,	 -- Jugoslawischer Film
		[424]	=	7140129,	 -- Kambodschanischer Film
		[16]	=	7237435,	 -- Kanadischer Film
		[1011]	=	17205262,	 -- Kapverdischer Film
		[232]	=	8980169,	 -- Kasachischer Film
		[846]	=	20192600,	 -- Katarischer Film
		[114]	=	7508239,	 -- Kenianischer Film
		[739]	=	7509175,	 -- Kolumbianischer Film
		[224]	=	7509269,	 -- Kroatischer Film
		[241]	=	7454475,	 -- Kubanischer Film
		[211]	=	6418551,	 -- Lettischer Film
		[822]	=	6838967,	 -- Libanesischer Film
		[347]	=	6414754,	 -- Liechtensteinischer Film
		[37]	=	8599188,	 -- Litauischer Film
		[32]	=	6539955,	 -- Luxemburgischer Film
		[912]	=	6839087,	 -- Malischer Film
		[233]	=	7521317,	 -- Maltesischer Film
		[1028]	=	6840076,	 -- Marokkanischer Film
		[1025]	=	9015310,	 -- Mauretanischer Film
		[221]	=	7520818,	 -- Mazedonischer Film
		[96]	=	4943,	 	 -- Mexikanischer Film
		[217]	=	9978432,	 -- Moldawischer Film
		[711]	=	7520841,	 -- Mongolischer Film
		[1029]	=	7520693,	 -- Mosambikanischer Film
		[664]	=	7141681,	 -- Neuseeländischer Film
		[55]	=	7141773,	 -- Niederländischer Film
		[1033]	=	17272428,	 -- Nigerianischer Film
		[423]	=	8933375,	 -- Nordkoreanischer Film
		[20]	=	6115533,	 -- Norwegischer Film
		[40]	=	7454361,	 -- Österreichischer Film
		[574]	=	16666798,	 -- Osttimoresischer Film
		[843]	=	7511142,	 -- Pakistanischer Film
		[733]	=	6447517,	 -- Paraguayischer Film
		[419]	=	6398418,	 -- Peruanischer Film
		[928]	=	6306864,	 -- Philippinischer Film
		[36]	=	55318,	 	 -- Polnischer Film
		[45]	=	7455994,	 -- Portugiesischer Film
		[218]	=	7411776,	 -- Rumänischer Film
		[159]	=	8691475,	 -- Russischer Film
		[851]	=	6837746,	 -- Saudi-arabischer Film
		[34]	=	6136773,	 -- Schwedischer Film
		[39]	=	7456263,	 -- Schweizer Film
		[1041]	=	7524346,	 -- Senegalesischer Film
		[403]	=	7211042,	 -- Serbischer Film
		[334]	=	6453387,	 -- Singapurischer Film
		[214]	=	6294055,	 -- Slowakischer Film
		[215]	=	6544166,	 -- Slowenischer Film
		[15180]	=	7203140,	 -- Sowjetischer Film
		[29]	=	7237426,	 -- Spanischer Film
		[854]	=	7524410,	 -- Sri-lankischer Film
		[258]	=	7142029,	 -- Südafrikanischer Film
		[884]	=	7141751,	 -- Südkoreanischer Film
		[858]	=	7524223,	 -- Syrischer Film
		[865]	=	7142194,	 -- Taiwanischer Film
		[869]	=	6617606,	 -- Thailändischer Film
		[213]	=	8445935,	 -- Tschechischer Film
		[33946]	=	8445935,	 -- Tschechoslowakischer Film
		[948]	=	8397453,	 -- Tunesischer Film
		[43]	=	7456367,	 -- Türkischer Film
		[1036]	=	9148729,	 -- Ugandischer Film
		[212]	=	8856010,	 -- Ukrainischer Film
		[28]	=	4055844,	 -- Ungarischer Film
		[77]	=	9155565,	 -- Uruguayischer Film
		[30]	=	3919868,	 -- US-amerikanischer Film
		[265]	=	8241595,	 -- Usbekischer Film
		[717]	=	7511552,	 -- Venezolanischer Film
		[878]   =   8412571,     -- Vereinigte Arabische Emirate
		[881]	=	7511465,	 -- Vietnamesischer Film
		[184]	=	8295556,	 -- Weißrussischer Film
		[229]	=	8438797 	 -- Zyprischer Film
	}	
	
	local id = frame.args[1]
	local entity = mw.wikibase.getEntity(id)
	local result_string = ""
	local result = {}
	
	if entity and entity.claims then
		local claims = entity.claims['P495']
		local value
		if claims then
			
			for idx in pairs(claims) do
				local claim = claims[idx]
				value = claim.mainsnak.datavalue.value["numeric-id"]
				
				for i, k in pairs(pl_kats) do
					if i == value then
						result[#result + 1] = k
						break
					end
				end
				
			end
			
			for idy, kat in pairs(result) do
				result_string = result_string .. "[[:" .. mw.wikibase.sitelink("Q" .. kat) .. "]]\n"
			end
		
		end
	end

	return result_string 

end

-- Kats für Filmgenre (P136) auslesen
function p.getGenKats(frame)
	local id = frame.args[1]
	local entity = mw.wikibase.getEntity(id)
	local result_string = ""
	
	if entity and entity.claims then
		local claims = entity.claims['P136']
		local value
	
		if claims then
			
			for idx in pairs(claims) do
				local claim = claims[idx]
				value = claim.mainsnak.datavalue.value["numeric-id"]
				
				local entity2 = mw.wikibase.getEntity("Q" .. value)
				if entity2 and entity2.claims then
					local claims2 = entity2.claims['P910']
					local value2
				
					if claims2 then
						
						for idy in pairs(claims2) do
							local claim2 = claims2[idy]
							value2 = claim2.mainsnak.datavalue.value["numeric-id"]
							local linkTarget = mw.wikibase.sitelink("Q" .. value2)
							if linkTarget then
								result_string = result_string .. "[[:" .. linkTarget .. "]]\n"
							end
							break
						end
					
					end
				end
			end
			
		end
	end

	return result_string 
	
end

-- Originaltitel auslesen
function p.getOT(frame)
	local id = frame.args[1]
	local arg2 = frame.args[2]
	local entity = mw.wikibase.getEntity(id)
	
	local output_string = ""
	local originaltitel_array = getOriginaltitel(entity, id, nil)

	if arg2 and arg2 == "text" then
		if originaltitel_array.tr then
			if originaltitel_array.ln and not originaltitel_array.ln ~= "de" then
				output_string = output_string .. "({{" .. originaltitel_array.ln .. "S|" .. originaltitel_array.ot .. "}}"
				if originaltitel_array.tr then
					output_string = output_string .. ", ''".. originaltitel_array.tr .. "''"
				end
				output_string = output_string .. ") "
			end
		elseif originaltitel_array.ot and originaltitel_array.ot ~= mw.wikibase.label(id) then
			output_string = output_string .. "(Originaltitel: ''" .. originaltitel_array.ot .. "'') "
		end
	else	
		if originaltitel_array.ot then
			output_string = output_string .. originaltitel_array.ot
			if originaltitel_array.tr then 
				output_string = output_string .. "&nbsp;/<br />" .. originaltitel_array.tr
			end
		end
	end

	return output_string
	
end

-- Deutschen Titel auslesen
function p.getDT(frame)
	local id = frame.args[1]
	local entity = mw.wikibase.getEntity(id)
	local deutscher_titel = mw.wikibase.label(id)
	local originaltitel_array = getOriginaltitel(entity, id, nil)
	
	if deutscher_titel and originaltitel_array.ot and deutscher_titel == originaltitel_array.ot then
		
		local claims = entity.claims['P495']
		local value
		
		if claims then
			for idx in pairs(claims) do
				local claim = claims[idx]
				value = claim.mainsnak.datavalue.value["numeric-id"]
				if not (value == 183 or value == 39 or value == 40 or value == 16957) then
					return deutscher_titel
					
				end
			end
		end
		
		return ""
		
	end
	
	return deutscher_titel
end

function p.hasDT(frame)
	local id = frame.args[1]
	local entity = mw.wikibase.getEntity(id)
	
	if entity and entity.labels and entity.labels['de']['language'] == "de" then
		return 1
	else
		return nil
	end
	
end

function p.getEnSitelink(frame)
	local id = frame.args[1]
	local entity = mw.wikibase.getEntity(id)
	
	if entity and entity.sitelinks and entity.sitelinks['enwiki'] then
		return entity.sitelinks['enwiki']['title']
	end
end

function p.getSitelinks(frame)
	local id = frame.args[1]
	local entity = mw.wikibase.getEntity(id)
	
	if entity and entity.sitelinks then
		local output_string = ""
		local sitelinks = entity.sitelinks
		
		for idx in pairs(sitelinks) do
			if string.find(idx, "wiki", -4) then
			local sitelink_pair = sitelinks[idx]
			local site = string.sub(sitelink_pair["site"], 0, 2)
			local title = sitelink_pair["title"]
			
			output_string = output_string .. "[[" .. site .. ":" .. title .. "]]\n"
			end
		end
	
	return output_string
end
end

-- Besetzung/Synchronisation mit Rolle auslesen
function p.getBesetzung(frame)

	
	local claims = entity.claims[property]
	
	if claims then
		
		local output_string = ""
		
		for idx in pairs(claims) do
			local claim = claims[idx]
			local value = claim.mainsnak.datavalue.value["numeric-id"]
			local name = getLink("Q" .. value)
			
			output_string = output_string .. name
				
			
		end
	end

	return output_string
	
end

function p.getKinostart(frame)
	
	local id = frame.args[1]
	local entity = mw.wikibase.getEntity(id)
	
	if entity and entity.claims then
		local claims = entity.claims['P577']
		if claims then
			
			for idx in pairs(claims) do
				local claim = claims[idx]
				if claim.mainsnak.datavalue then
					
					if claim.qualifiers then
						if claim.qualifiers['P291'] then
							
							local qualifiers = claim.qualifiers['P291']
							
							for idy in pairs(qualifiers) do
								
								local qualifier = qualifiers[idy]
								if qualifier.datavalue.value["numeric-id"] == 183 then
									return claim.mainsnak.datavalue.value["time"]
								end
							end
							
						end
					end
					
				end
			end
			
		end
	end
end

function p.listBesetzung(frame)
	
	local id = frame.args[1]
	local property = frame.args[2]
	local entity = mw.wikibase.getEntity(id)
	
	if entity and entity.claims then
		local claims = entity.claims[property]
		local value, role
		if claims then
			
			result = {}
			
			for idx in pairs(claims) do
				local claim = claims[idx]
				if claim.mainsnak.datavalue then
					value = claim.mainsnak.datavalue.value["numeric-id"]
				
					local result_temp = "* " .. getLink("Q" .. value)
					
					if claim.qualifiers and result_temp then
						if claim.qualifiers['P453']  then
							role = claim.qualifiers['P453'][1].datavalue.value["numeric-id"]
							local role_label = mw.wikibase.label("Q" .. role)
							if role_label then
								result_temp = result_temp .. ": " .. role_label
							end
						elseif claim.qualifiers['P4633']  then
							result_temp = result_temp .. ": " .. claim.qualifiers['P4633'][1].datavalue.value
						end
				end
					
				result[#result + 1] = result_temp
					
				end
			end
			
			result = table.concat(result, '\n')
			
			
			return result
			
		end
	end
end

-- ISO 3166-1 alpha-3 für Produktionsländer auslesen
function p.getISO3166forPL(frame)
	local id = frame.args[1]
	local entity = mw.wikibase.getEntity(id)

	if entity and entity.claims then
		local claims = entity.claims['P495']
		local value
		
		local isocodes = {
			[889]	=	"AFG",
			[79]	=	"EGY",
			[262]	=	"DZA",
			[916]	=	"AGO",
			[414]	=	"ARG",
			[399]	=	"ARM",
			[227]	=	"AZE",
			[115]	=	"ETH",
			[408]	=	"AUS",
			[778]	=	"BHS",
			[31]	=	"BEL",
			[225]	=	"BIH",
			[155]	=	"BRA",
			[145]	=	"GBR",
			[219]	=	"BGR",
			[965]	=	"BFA",
			[298]	=	"CHL",
			[148]	=	"CHN",
			[35]	=	"DNK",
			[183]	=	"DEU",
			[786]	=	"DOM",
			[736]	=	"ECU",
			[191]	=	"EST",
			[33]	=	"FIN",
			[142]	=	"FRA",
			[230]	=	"GEO",
			[41]	=	"GRC",
			[790]	=	"HTI",
			[668]	=	"IND",
			[252]	=	"IDN",
			[796]	=	"IRQ",
			[794]	=	"IRN",
			[27]	=	"IRL",
			[189]	=	"ISL",
			[801]	=	"ISR",
			[38]	=	"ITA",
			[766]	=	"JAM",
			[17]	=	"JPN",
			[805]	=	"YEM",
			[810]	=	"JOR",
			[36704]	=	"YUG",
			[424]	=	"KHM",
			[16]	=	"CAN",
			[1011]	=	"CPV",
			[232]	=	"KAZ",
			[846]	=	"QAT",
			[114]	=	"KEN",
			[739]	=	"COL",
			[224]	=	"HRV",
			[241]	=	"CUB",
			[211]	=	"LVA",
			[822]	=	"LBN",
			[347]	=	"LIE",
			[37]	=	"LTU",
			[32]	=	"LUX",
			[912]	=	"MLI",
			[233]	=	"MLT",
			[1028]	=	"MAR",
			[1025]	=	"MRT",
			[221]	=	"MKD",
			[96]	=	"MEX",
			[217]	=	"MDA",
			[711]	=	"MNG",
			[1029]	=	"MOZ",
			[664]	=	"NZL",
			[55]	=	"NLD",
			[1033]	=	"NGA",
			[423]	=	"PRK",
			[20]	=	"NOR",
			[40]	=	"AUT",
			[574]	=	"TLS",
			[843]	=	"PAK",
			[733]	=	"PRY",
			[419]	=	"PER",
			[928]	=	"PHL",
			[36]	=	"POL",
			[45]	=	"PRT",
			[218]	=	"ROU",
			[159]	=	"RUS",
			[851]	=	"SAU",
			[34]	=	"SWE",
			[39]	=	"CHE",
			[1041]	=	"SEN",
			[403]	=	"SRB",
			[334]	=	"SGP",
			[214]	=	"SVK",
			[215]	=	"SVN",
			[15180]	=	"SUN",
			[29]	=	"ESP",
			[854]	=	"LKA",
			[258]	=	"ZAF",
			[884]	=	"KOR",
			[858]	=	"SYR",
			[865]	=	"TWN",
			[869]	=	"THA",
			[213]	=	"CZE",
			[33946]	=	"CSK",
			[948]	=	"TUN",
			[43]	=	"TUR",
			[1036]	=	"UGA",
			[212]	=	"UKR",
			[28]	=	"HUN",
			[77]	=	"URY",
			[30]	=	"USA",
			[265]	=	"UZB",
			[717]	=	"VEN",
			[878]	=	"ARE",
			[881]	=	"VNM",
			[184]	=	"BLR",
			[229]	=	"CYP"
		}
	
		if claims then
			
			result = {}
			
			for idx in pairs(claims) do
				local claim = claims[idx]
				value = claim.mainsnak.datavalue.value["numeric-id"]
				
				local labelPL = mw.wikibase.label("Q" .. value)
				
				if isocodes[value] then
					result[#result + 1] = '<abbr title="' .. labelPL .. '">' .. isocodes[value] .. '</abbr>'
				end
				
			end
									
			result = table.concat(result, '&nbsp;/ ')
			
			return result
			
		end
	end
end

function p.getCast(frame)
	local id = frame.args[1]
	local arg2 = frame.args[2]
	local entity = mw.wikibase.getEntity(id)
	
	return listClaims(id, entity, 'P161', arg2)
end

return p