@@ -600,16 +600,19 @@ def parse_separated_strings(items: list[str]) -> dict:
600
600
parsed_strings_dict [key ] = value
601
601
return parsed_strings_dict
602
602
603
- def create_album_name (asset_path_chunks : list [str ], album_separator : str , album_name_post_regex : list = [str ]) -> str :
603
+ # pylint: disable=R0912
604
+ def create_album_name (asset_path_chunks : list [str ], album_separator : str , album_name_postprocess_regex : list ) -> str :
604
605
"""
605
606
Create album names from provided path_chunks string array.
606
607
607
608
The method uses global variables album_levels_range_arr or album_levels to
608
609
generate album names either by level range or absolute album levels. If multiple
609
610
album path chunks are used for album names they are separated by album_separator.
610
611
611
- album_name_post_regex is list of pairs of regex and replace, this is optional
612
+ album_name_postprocess_regex is list of pairs of regex and replace, this is optional
612
613
"""
614
+ if album_name_postprocess_regex is None :
615
+ album_name_postprocess_regex = [str ]
613
616
614
617
album_name_chunks = ()
615
618
logging .debug ("path chunks = %s" , list (asset_path_chunks ))
@@ -654,15 +657,15 @@ def create_album_name(asset_path_chunks: list[str], album_separator: str, album_
654
657
655
658
# final album name before regex
656
659
album_name = album_separator .join (album_name_chunks )
657
- logging .debug (f "Album Name { album_name } " )
660
+ logging .debug ("Album Name %s" , album_name )
658
661
659
662
# apply regex if any
660
- if album_name_post_regex :
661
- for pattern , * repl in album_name_post_regex :
663
+ if album_name_postprocess_regex :
664
+ for pattern , * repl in album_name_postprocess_regex :
662
665
# If no replacement string provided, default to empty string
663
666
replace = repl [0 ] if repl else ''
664
- album_name = re .sub (pattern , replace , album_name )
665
- logging .debug (f "Album Post Regex s/{ pattern } / { replace } /g --> { album_name } " )
667
+ album_name = re .sub (pattern , replace , album_name )
668
+ logging .debug ("Album Post Regex s/%s/%s /g --> %s" , pattern , replace , album_name )
666
669
667
670
return album_name .strip ()
668
671
0 commit comments