auto-schedule-pro-v2: add support for reading comments from schedule-v2 file format

This commit is contained in:
dymik739 2024-04-06 17:38:28 +03:00
parent f6859cd748
commit c0e72a5ca0
4 changed files with 15 additions and 0 deletions

View File

@ -184,6 +184,10 @@ def generate_lesson_description(lesson, start_datetime, end_datetime, current_da
total_result = total_result.replace("%TYPE%", get_name_of_lesson_type(lesson['type'])) total_result = total_result.replace("%TYPE%", get_name_of_lesson_type(lesson['type']))
total_result = total_result.replace("%NAME_PREFIX%", custom_name_prefix) total_result = total_result.replace("%NAME_PREFIX%", custom_name_prefix)
if 'comment' in lesson:
total_result += load_template(template, "comment")
total_result = total_result.replace("%COMMENT%", lesson["comment"])
return total_result + "\n" return total_result + "\n"
else: else:
@ -200,6 +204,10 @@ def generate_lesson_description(lesson, start_datetime, end_datetime, current_da
active_template = active_template.replace("%TYPE%", get_name_of_lesson_type(lesson['type'])) active_template = active_template.replace("%TYPE%", get_name_of_lesson_type(lesson['type']))
active_template = active_template.replace("%NAME_PREFIX%", custom_name_prefix) active_template = active_template.replace("%NAME_PREFIX%", custom_name_prefix)
if 'comment' in lesson:
active_template += load_template(template, "comment")
active_template = active_template.replace("%COMMENT%", lesson["comment"])
return active_template return active_template
elif lesson.__class__ == list: elif lesson.__class__ == list:
@ -218,6 +226,10 @@ def generate_lesson_description(lesson, start_datetime, end_datetime, current_da
active_template = active_template.replace("%TYPE%", get_name_of_lesson_type(l['type'])) active_template = active_template.replace("%TYPE%", get_name_of_lesson_type(l['type']))
active_template = active_template.replace("%NAME_PREFIX%", custom_name_prefix) active_template = active_template.replace("%NAME_PREFIX%", custom_name_prefix)
if 'comment' in lesson:
total_result += load_template(template, "comment")
total_result = total_result.replace("%COMMENT%", lesson["comment"])
total_result += active_template + "\n" total_result += active_template + "\n"
return total_result return total_result

View File

@ -0,0 +1 @@
<b>Коментар</b>: %COMMENT%

View File

@ -0,0 +1 @@
Коментар: %COMMENT%

View File

@ -0,0 +1 @@
<i>Коментар</i>: %COMMENT%