@@ -630,41 +630,45 @@ def open_library(self, path: str) -> int:
630
630
if 'id' in tag .keys ():
631
631
id = tag ['id' ]
632
632
633
- if int (id ) >= self ._next_tag_id :
634
- self ._next_tag_id = int (id ) + 1
635
-
636
- name = ''
637
- if 'name' in tag .keys ():
638
- name = tag ['name' ]
639
- shorthand = ''
640
- if 'shorthand' in tag .keys ():
641
- shorthand = tag ['shorthand' ]
642
- aliases = []
643
- if 'aliases' in tag .keys ():
644
- aliases = tag ['aliases' ]
645
- subtag_ids = []
646
- if 'subtag_ids' in tag .keys ():
647
- subtag_ids = tag ['subtag_ids' ]
648
- color = ''
649
- if 'color' in tag .keys ():
650
- color = tag ['color' ]
651
-
652
- t = Tag (
653
- id = int (id ),
654
- name = name ,
655
- shorthand = shorthand ,
656
- aliases = aliases ,
657
- subtags_ids = subtag_ids ,
658
- color = color
659
- )
660
-
661
- # NOTE: This does NOT use the add_tag_to_library() method!
662
- # That method is only used for Tags added at runtime.
663
- # This process uses the same inner methods, but waits until all of the
664
- # Tags are registered in the Tags list before creating the Tag clusters.
665
- self .tags .append (t )
666
- self ._map_tag_id_to_index (t , - 1 )
667
- self ._map_tag_strings_to_tag_id (t )
633
+ # Don't load tags with duplicate IDs
634
+ if id not in [t .id for t in self .tags ]:
635
+ if int (id ) >= self ._next_tag_id :
636
+ self ._next_tag_id = int (id ) + 1
637
+
638
+ name = ''
639
+ if 'name' in tag .keys ():
640
+ name = tag ['name' ]
641
+ shorthand = ''
642
+ if 'shorthand' in tag .keys ():
643
+ shorthand = tag ['shorthand' ]
644
+ aliases = []
645
+ if 'aliases' in tag .keys ():
646
+ aliases = tag ['aliases' ]
647
+ subtag_ids = []
648
+ if 'subtag_ids' in tag .keys ():
649
+ subtag_ids = tag ['subtag_ids' ]
650
+ color = ''
651
+ if 'color' in tag .keys ():
652
+ color = tag ['color' ]
653
+
654
+ t = Tag (
655
+ id = int (id ),
656
+ name = name ,
657
+ shorthand = shorthand ,
658
+ aliases = aliases ,
659
+ subtags_ids = subtag_ids ,
660
+ color = color
661
+ )
662
+
663
+ # NOTE: This does NOT use the add_tag_to_library() method!
664
+ # That method is only used for Tags added at runtime.
665
+ # This process uses the same inner methods, but waits until all of the
666
+ # Tags are registered in the Tags list before creating the Tag clusters.
667
+ self .tags .append (t )
668
+ self ._map_tag_id_to_index (t , - 1 )
669
+ self ._map_tag_strings_to_tag_id (t )
670
+ else :
671
+ logging .info (f'[LIBRARY]Skipping Tag with duplicate ID: { tag } ' )
668
672
669
673
# Step 3: Map each Tag's subtags together now that all Tag objects in it.
670
674
for t in self .tags :
0 commit comments