|
|
|
@ -296,7 +296,7 @@ def __find_transcribers(folder: str)-> None:
|
|
|
|
def __csv_indiv_infos(indiv_type):
|
|
|
|
def __csv_indiv_infos(indiv_type):
|
|
|
|
"""extract individuals of the same type from static/csv/actors.csv
|
|
|
|
"""extract individuals of the same type from static/csv/actors.csv
|
|
|
|
and make a list with them
|
|
|
|
and make a list with them
|
|
|
|
:param indiv_type: <secret> or <prince>
|
|
|
|
:param indiv_type: individuals' type. (<secret> or <prince>)
|
|
|
|
:type indiv_type: str
|
|
|
|
:type indiv_type: str
|
|
|
|
:return: list of individuals of the choosen type
|
|
|
|
:return: list of individuals of the choosen type
|
|
|
|
:rtype: list
|
|
|
|
:rtype: list
|
|
|
|
@ -307,7 +307,16 @@ def __csv_indiv_infos(indiv_type):
|
|
|
|
lst_of_indiv = [row for row in actors_csv if row[1] == indiv_type]
|
|
|
|
lst_of_indiv = [row for row in actors_csv if row[1] == indiv_type]
|
|
|
|
return lst_of_indiv
|
|
|
|
return lst_of_indiv
|
|
|
|
|
|
|
|
|
|
|
|
def __find_indiv(folder: str, role: str)-> None:
|
|
|
|
def __find_indiv(folder: str, role: str):
|
|
|
|
|
|
|
|
"""find indiv name in //sourceDesc/listPerson/listPerson[@type='<role>']
|
|
|
|
|
|
|
|
and add it to a list. Function used in init() function.
|
|
|
|
|
|
|
|
:param folder: name of a folder containing acts' xml file
|
|
|
|
|
|
|
|
:type folder: str
|
|
|
|
|
|
|
|
:param role: individuals' role. (<secret> or <prince>)
|
|
|
|
|
|
|
|
:type role: str
|
|
|
|
|
|
|
|
:return: list
|
|
|
|
|
|
|
|
:rtype: set list
|
|
|
|
|
|
|
|
"""
|
|
|
|
indiv_lst = []
|
|
|
|
indiv_lst = []
|
|
|
|
for acte in os.listdir(folder):
|
|
|
|
for acte in os.listdir(folder):
|
|
|
|
if acte.endswith(".xml"):
|
|
|
|
if acte.endswith(".xml"):
|
|
|
|
@ -368,7 +377,7 @@ def init() -> None:
|
|
|
|
# 3/ check which names need to be add to the actors.csv
|
|
|
|
# 3/ check which names need to be add to the actors.csv
|
|
|
|
names_in_csv = [actor[0] for actor in actors]
|
|
|
|
names_in_csv = [actor[0] for actor in actors]
|
|
|
|
names_in_xml = __find_indiv(xml_folder, "signatory")
|
|
|
|
names_in_xml = __find_indiv(xml_folder, "signatory")
|
|
|
|
for name in [x for x in names_in_xml if x not in names_in_csv]:
|
|
|
|
for name in [label for label in names_in_xml if label not in names_in_csv]:
|
|
|
|
print("!! name " + name + " not found in /app/static/csv/actors.csv")
|
|
|
|
print("!! name " + name + " not found in /app/static/csv/actors.csv")
|
|
|
|
|
|
|
|
|
|
|
|
# 4/ create tables
|
|
|
|
# 4/ create tables
|
|
|
|
|