File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121
2222
2323PRONOM_FILENAME : Final [str ] = "jsonid_pronom.xml"
24+ JSON_PUID : Final [str ] = "fmt/817"
2425
2526
2627class PRONOMException (Exception ):
@@ -77,7 +78,7 @@ def export_pronom() -> None:
7778 increment_id += 1
7879 fmt = pronom .Format (
7980 id = increment_id ,
80- name = f"JSON (Baseline - fmt/817 ) ({ encoding } )" ,
81+ name = f"JSON (Baseline - { JSON_PUID } ) ({ encoding } )" ,
8182 version = "" ,
8283 puid = "jsonid:0000" ,
8384 mime = "application/json" ,
Original file line number Diff line number Diff line change 1212from typing import Any , Final
1313
1414try :
15+ import export
1516 import export_helpers
1617 import helpers
1718 import registry_matchers
1819except ModuleNotFoundError :
1920 try :
20- from src .jsonid import export_helpers , helpers , registry_matchers
21+ from src .jsonid import export , export_helpers , helpers , registry_matchers
2122 except ModuleNotFoundError :
22- from jsonid import export_helpers , helpers , registry_matchers
23+ from jsonid import export , export_helpers , helpers , registry_matchers
2324
2425
2526logger = logging .getLogger (__name__ )
@@ -234,9 +235,19 @@ def create_file_format_collection(fmt: list[Format]):
234235 for sig in fmt .external_signatures
235236 if sig .type .lower () == EXT
236237 ]
238+
239+ priority_ids = []
240+ for id_ in fmt .priorities :
241+ if id_ == str (fmt .id ):
242+ continue
243+ if export .JSON_PUID in fmt .name :
244+ # This is brittle. Understand how to make more robust.
245+ continue
246+ priority_ids .append (id_ )
247+
237248 priorities = [
238249 f"<HasPriorityOverFileFormatID>{ priority } </HasPriorityOverFileFormatID>"
239- for priority in fmt . priorities
250+ for priority in priority_ids
240251 ]
241252 ff = f"""
242253<FileFormat ID=\" { fmt .id } \" Name=\" { fmt .name } \" PUID=\" { fmt .puid } \" Version="{ fmt .version } " MIMEType=\" { fmt .mime } \" FormatType=\" { fmt .classification } \" >
You can’t perform that action at this time.
0 commit comments