ready?
This commit is contained in:
parent
cc5daea41b
commit
376a5b9137
4 changed files with 7 additions and 61 deletions
|
|
@ -9,8 +9,6 @@ from typing import Optional
|
|||
from typing import Set
|
||||
from typing import Union
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
class FileMetadata:
|
||||
"""
|
||||
|
|
@ -66,21 +64,21 @@ class FileMetadata:
|
|||
value_dict = json.loads(json.dumps(value_dict, sort_keys=True, ensure_ascii=False))
|
||||
|
||||
def _indent_lines(value: str, indent: int) -> str:
|
||||
if '\n' not in value:
|
||||
if "\n" not in value:
|
||||
return value
|
||||
|
||||
output_str = ''
|
||||
output_str = ""
|
||||
_indent = " " * indent
|
||||
for line in value.split('\n'):
|
||||
for line in value.split("\n"):
|
||||
output_str += f"{_indent}{line}\n"
|
||||
return output_str
|
||||
return f"{output_str.rstrip()}\n"
|
||||
|
||||
def _single_value(value: Any) -> Optional[str]:
|
||||
if isinstance(value, list) and len(value) == 1:
|
||||
return _single_value(value=value[0])
|
||||
if isinstance(value, (dict, list)):
|
||||
return None
|
||||
if isinstance(value, str) and '\n' in value:
|
||||
if isinstance(value, str) and "\n" in value:
|
||||
return None
|
||||
return value
|
||||
|
||||
|
|
@ -108,7 +106,7 @@ class FileMetadata:
|
|||
elif isinstance(value, str): # multi-line string
|
||||
output_str += _indent_lines(value, indent=indent + 2)
|
||||
else:
|
||||
assert False, 'should never reach here'
|
||||
assert False, "should never reach here"
|
||||
return output_str
|
||||
|
||||
out = _recursive_lines(value_dict).rstrip().split("\n")
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ def assert_transaction_log_matches(
|
|||
output_directory: str,
|
||||
transaction_log: FileHandlerTransactionLog,
|
||||
transaction_log_summary_file_name: str,
|
||||
regenerate_transaction_log: bool = True,
|
||||
regenerate_transaction_log: bool = False,
|
||||
):
|
||||
"""
|
||||
Parameters
|
||||
|
|
|
|||
|
|
@ -11,46 +11,32 @@ Rick Beato - Can you hear the difference? 🎸🔥 #shorts.nfo
|
|||
kodi_safe_multi_title 🎸:
|
||||
- value 1 🎸
|
||||
- value 2 🎸
|
||||
|
||||
kodi_safe_multi_title_with_attrs:
|
||||
-
|
||||
attributes:
|
||||
🎸?:
|
||||
value
|
||||
newlines 🎸
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag 1 🎸🎸
|
||||
|
||||
|
||||
-
|
||||
attributes:
|
||||
🎸?:
|
||||
value
|
||||
newlines 🎸
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag 2 🎸🎸
|
||||
|
||||
|
||||
|
||||
kodi_safe_title 🎸: kodi_safe_value 🎸
|
||||
kodi_safe_title_with_attrs:
|
||||
attributes:
|
||||
🎸?:
|
||||
value
|
||||
newlines 🎸
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag 🎸🎸
|
||||
|
||||
|
||||
title: Can you hear the difference? 🎸🔥 #shorts
|
||||
year: 2022
|
||||
test.nfo
|
||||
|
|
@ -59,41 +45,29 @@ test.nfo
|
|||
kodi_safe_multi_title 🎸:
|
||||
- value 1 🎸
|
||||
- value 2 🎸
|
||||
|
||||
kodi_safe_multi_title_with_attrs:
|
||||
-
|
||||
attributes:
|
||||
🎸?:
|
||||
value
|
||||
newlines 🎸
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag 1 🎸🎸
|
||||
|
||||
|
||||
-
|
||||
attributes:
|
||||
🎸?:
|
||||
value
|
||||
newlines 🎸
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag 2 🎸🎸
|
||||
|
||||
|
||||
|
||||
kodi_safe_title 🎸: kodi_safe_value 🎸
|
||||
kodi_safe_title_with_attrs:
|
||||
attributes:
|
||||
🎸?:
|
||||
value
|
||||
newlines 🎸
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag 🎸🎸
|
||||
|
|
@ -11,46 +11,32 @@ Rick Beato - Can you hear the difference? 🎸🔥 #shorts.nfo
|
|||
kodi_safe_multi_title □:
|
||||
- value 1 □
|
||||
- value 2 □
|
||||
|
||||
kodi_safe_multi_title_with_attrs:
|
||||
-
|
||||
attributes:
|
||||
□?:
|
||||
value
|
||||
newlines □
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag 1 □□
|
||||
|
||||
|
||||
-
|
||||
attributes:
|
||||
□?:
|
||||
value
|
||||
newlines □
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag 2 □□
|
||||
|
||||
|
||||
|
||||
kodi_safe_title □: kodi_safe_value □
|
||||
kodi_safe_title_with_attrs:
|
||||
attributes:
|
||||
□?:
|
||||
value
|
||||
newlines □
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag □□
|
||||
|
||||
|
||||
title: Can you hear the difference? □□ #shorts
|
||||
year: 2022
|
||||
test.nfo
|
||||
|
|
@ -59,41 +45,29 @@ test.nfo
|
|||
kodi_safe_multi_title □:
|
||||
- value 1 □
|
||||
- value 2 □
|
||||
|
||||
kodi_safe_multi_title_with_attrs:
|
||||
-
|
||||
attributes:
|
||||
□?:
|
||||
value
|
||||
newlines □
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag 1 □□
|
||||
|
||||
|
||||
-
|
||||
attributes:
|
||||
□?:
|
||||
value
|
||||
newlines □
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag 2 □□
|
||||
|
||||
|
||||
|
||||
kodi_safe_title □: kodi_safe_value □
|
||||
kodi_safe_title_with_attrs:
|
||||
attributes:
|
||||
□?:
|
||||
value
|
||||
newlines □
|
||||
|
||||
|
||||
tag:
|
||||
the
|
||||
tag □□
|
||||
Loading…
Reference in a new issue