ffplayout/tests/run_playlist.py
2021-03-24 15:11:04 +01:00

38 lines
828 B
Python
Executable File

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import os
import sys
from time import sleep
from zoneinfo import ZoneInfo
import time_machine
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# set time zone
_TZ = ZoneInfo("Europe/Berlin")
# fake date and time
SOURCE_TIME = [2021, 2, 27, 23, 55, 0]
@time_machine.travel(datetime.datetime(*SOURCE_TIME, tzinfo=_TZ))
def main():
get_source = GetSourceFromPlaylist()
for node in get_source.next():
messenger.info(f'Play: {node["source"]}')
# print(node)
sleep(node['out'] - node['seek'])
if __name__ == '__main__':
from ffplayout.playlist import GetSourceFromPlaylist
from ffplayout.utils import messenger
try:
main()
except KeyboardInterrupt:
print('\n', end='')