Changeset 35903 for main/trunk
- Timestamp:
- 2022-01-07T20:24:04+13:00 (2 years ago)
- Location:
- main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/voting-excel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/voting-excel
-
Property svn:ignore
set to
eurovision_song_contest_1975_2019.xlsx
-
Property svn:ignore
set to
-
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/voting-excel/xlsx-tocountry-jsonmetadata.py
r35099 r35903 476 476 477 477 478 def display_gs_head_metadata_tags( ):479 480 print( )481 print() 482 print(" For, e.g., '<display><format>' section of collectionConfig.xml:")483 print( )484 print(" < gsf:headMetaTags>")478 def display_gs_head_metadata_tags(ofile=sys.stdout): 479 480 print(" To be placed verbatim inside of '<display><format>' section of collectionConfig.xml:") 481 482 print("", file=ofile) 483 print(" <!-- <gsf:headMetaTags> -->", file=ofile) 484 print(" <!-- Needed so voting metadata for doc page retreives for all the 'from-country' votes -->", file=ofile) 485 485 486 486 for from_country in sorted(jury_from_countries.keys()): 487 print(" <gsf:metadata name=\""+from_country+"-J\" />" )488 489 print( )487 print(" <gsf:metadata name=\""+from_country+"-J\" />", file=ofile) 488 489 print("",file=ofile) 490 490 for from_country in sorted(tele_from_countries.keys()): 491 print(" <gsf:metadata name=\""+from_country+"-T\" />" )492 493 print( )491 print(" <gsf:metadata name=\""+from_country+"-T\" />", file=ofile) 492 493 print("", file=ofile) 494 494 for from_country in sorted(comb_from_countries.keys()): 495 print(" <gsf:metadata name=\""+from_country+"-C\" />" )496 497 print( )495 print(" <gsf:metadata name=\""+from_country+"-C\" />", file=ofile) 496 497 print("", file=ofile) 498 498 for from_country in sorted(sing_from_countries.keys()): 499 print(" <gsf:metadata name=\""+from_country+"-S\" />" )500 501 print(" < /gsf:headMetaTags>")499 print(" <gsf:metadata name=\""+from_country+"-S\" />", file=ofile) 500 501 print(" <!-- </gsf:headMetaTags> -->", file=ofile) 502 502 503 503 … … 508 508 parser.add_argument('--votingtype', choices=['J','T'], help="Filter to only J=Jury or T=Tele cast votes") 509 509 parser.add_argument('input-file.xlsx') 510 parser.add_argument('output-file.json', nargs='?') 510 parser.add_argument('output-file.json') 511 parser.add_argument('gsf-headMetaTags.xml') 511 512 512 513 513 514 args = parser.parse_args() 514 515 515 sheetname = getattr(args,'sheetname');516 sheetname = getattr(args,'sheetname'); 516 517 voting_type = getattr(args,'votingtype'); 517 518 518 excel_input_filename = getattr(args,'input-file.xlsx'); 519 json_output_filename = getattr(args,'output-file.json'); 520 519 excel_input_filename = getattr(args,'input-file.xlsx'); 520 json_output_filename = getattr(args,'output-file.json'); 521 gsf_hmt_output_filename = getattr(args,'gsf-headMetaTags.xml'); 522 523 521 524 if (json_output_filename == None): 522 525 json_output_filename = os.path.splitext(excel_input_filename)[0]+'.json' … … 563 566 xlsxutil.save_greenstone_json_metadata(greenstone_metadata_json,json_output_filename) 564 567 565 display_gs_head_metadata_tags()566 567 568 print() 568 569 print("Saving <gsf:headMetaTags /> block as: " + gsf_hmt_output_filename) 570 571 gsf_hmt_ofile = open(gsf_hmt_output_filename,"w") 572 display_gs_head_metadata_tags(gsf_hmt_ofile) 573 gsf_hmt_ofile.close() 574 575 print() 576
Note:
See TracChangeset
for help on using the changeset viewer.