Changeset 35903


Ignore:
Timestamp:
2022-01-07T20:24:04+13:00 (2 years ago)
Author:
davidb
Message:

Ignore the older excel file up to 2019

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
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/voting-excel/xlsx-tocountry-jsonmetadata.py

    r35099 r35903  
    476476
    477477
    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>")
     478def 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)
    485485
    486486    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)
    490490    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)
    494494    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)
    498498    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)
    502502
    503503   
     
    508508    parser.add_argument('--votingtype', choices=['J','T'], help="Filter to only J=Jury or T=Tele cast votes")       
    509509    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')
    511512
    512513   
    513514    args = parser.parse_args()
    514515
    515     sheetname = getattr(args,'sheetname');
     516    sheetname   = getattr(args,'sheetname');
    516517    voting_type = getattr(args,'votingtype');
    517518
    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       
    521524    if (json_output_filename == None):
    522525        json_output_filename = os.path.splitext(excel_input_filename)[0]+'.json'
     
    563566    xlsxutil.save_greenstone_json_metadata(greenstone_metadata_json,json_output_filename)
    564567
    565     display_gs_head_metadata_tags()
    566    
    567568    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.