2021-02-09 13:39:14 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2021-02-11 09:44:58 +01:00
|
|
|
"""
|
|
|
|
Test script, for simulating different date and time.
|
|
|
|
This is useful for testing the transition from one playlist to another,
|
|
|
|
specially when the day_start time is in the night.
|
|
|
|
"""
|
|
|
|
|
2021-02-09 13:39:14 +01:00
|
|
|
import datetime
|
|
|
|
import os
|
|
|
|
import sys
|
2021-07-04 13:36:51 +02:00
|
|
|
from importlib import import_module
|
2021-02-09 13:39:14 +01:00
|
|
|
|
|
|
|
import time_machine
|
|
|
|
|
2021-03-01 12:50:44 +01:00
|
|
|
try:
|
|
|
|
from zoneinfo import ZoneInfo
|
|
|
|
except ImportError:
|
|
|
|
from backports.zoneinfo import ZoneInfo
|
|
|
|
|
2021-02-09 13:39:14 +01:00
|
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
|
2021-02-11 09:28:15 +01:00
|
|
|
# set time zone
|
|
|
|
_TZ = ZoneInfo("Europe/Berlin")
|
|
|
|
# fake date and time
|
2021-07-04 13:36:51 +02:00
|
|
|
SOURCE_TIME = [2021, 6, 24, 23, 57, 30]
|
2021-02-09 13:39:14 +01:00
|
|
|
|
|
|
|
|
2021-02-11 09:28:15 +01:00
|
|
|
@time_machine.travel(datetime.datetime(*SOURCE_TIME, tzinfo=_TZ))
|
2021-02-09 13:39:14 +01:00
|
|
|
def run_in_time_machine():
|
2021-07-04 13:36:51 +02:00
|
|
|
if stdin_args.mode:
|
|
|
|
output = import_module(f'ffplayout.output.{stdin_args.mode}').output
|
|
|
|
output()
|
|
|
|
else:
|
|
|
|
desktop.output()
|
2021-02-09 13:39:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2021-02-09 16:29:58 +01:00
|
|
|
from ffplayout.output import desktop
|
2021-07-04 13:36:51 +02:00
|
|
|
from ffplayout.utils import stdin_args
|
2021-02-09 13:39:14 +01:00
|
|
|
run_in_time_machine()
|