chore(shared): explicit function name time_fromisoformat (#1917)
This commit is contained in:
parent
1faf5a724b
commit
6ef941b3f2
|
@ -4,7 +4,7 @@ from typing import Dict
|
||||||
from dateutil.parser import isoparse
|
from dateutil.parser import isoparse
|
||||||
from libretime_api_client.version2 import AirtimeApiClient as ApiClient
|
from libretime_api_client.version2 import AirtimeApiClient as ApiClient
|
||||||
from libretime_shared.datetime import (
|
from libretime_shared.datetime import (
|
||||||
fromisoformat,
|
time_fromisoformat,
|
||||||
time_in_milliseconds,
|
time_in_milliseconds,
|
||||||
time_in_seconds,
|
time_in_seconds,
|
||||||
)
|
)
|
||||||
|
@ -74,10 +74,10 @@ def generate_file_events(
|
||||||
# Show data
|
# Show data
|
||||||
"show_name": show["name"],
|
"show_name": show["name"],
|
||||||
# Extra data
|
# Extra data
|
||||||
"fade_in": time_in_milliseconds(fromisoformat(schedule["fade_in"])),
|
"fade_in": time_in_milliseconds(time_fromisoformat(schedule["fade_in"])),
|
||||||
"fade_out": time_in_milliseconds(fromisoformat(schedule["fade_out"])),
|
"fade_out": time_in_milliseconds(time_fromisoformat(schedule["fade_out"])),
|
||||||
"cue_in": time_in_seconds(fromisoformat(schedule["cue_in"])),
|
"cue_in": time_in_seconds(time_fromisoformat(schedule["cue_in"])),
|
||||||
"cue_out": time_in_seconds(fromisoformat(schedule["cue_out"])),
|
"cue_out": time_in_seconds(time_fromisoformat(schedule["cue_out"])),
|
||||||
"metadata": file,
|
"metadata": file,
|
||||||
"replay_gain": file["replay_gain"],
|
"replay_gain": file["replay_gain"],
|
||||||
"filesize": file["filesize"],
|
"filesize": file["filesize"],
|
||||||
|
|
|
@ -14,7 +14,7 @@ def time_in_milliseconds(value: time) -> float:
|
||||||
return time_in_seconds(value) * 1000
|
return time_in_seconds(value) * 1000
|
||||||
|
|
||||||
|
|
||||||
def fromisoformat(value: str) -> time:
|
def time_fromisoformat(value: str) -> time:
|
||||||
"""
|
"""
|
||||||
This is required for Python 3.6 support. datetime.time.fromisoformat was
|
This is required for Python 3.6 support. datetime.time.fromisoformat was
|
||||||
only added in Python 3.7. Until LibreTime drops Python 3.6 support, this
|
only added in Python 3.7. Until LibreTime drops Python 3.6 support, this
|
||||||
|
|
|
@ -3,7 +3,7 @@ from datetime import time
|
||||||
from pytest import approx, mark
|
from pytest import approx, mark
|
||||||
|
|
||||||
from libretime_shared.datetime import (
|
from libretime_shared.datetime import (
|
||||||
fromisoformat,
|
time_fromisoformat,
|
||||||
time_in_milliseconds,
|
time_in_milliseconds,
|
||||||
time_in_seconds,
|
time_in_seconds,
|
||||||
)
|
)
|
||||||
|
@ -27,5 +27,5 @@ def test_time_in_milliseconds():
|
||||||
("00:04:30", time(minute=4, second=30)),
|
("00:04:30", time(minute=4, second=30)),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_fromisoformat(payload, expected):
|
def test_time_fromisoformat(payload, expected):
|
||||||
assert fromisoformat(payload) == expected
|
assert time_fromisoformat(payload) == expected
|
||||||
|
|
Loading…
Reference in New Issue