ffplayout/tests/run_playlist.py

38 lines
828 B
Python
Raw Normal View History

2021-02-16 15:37:47 -05:00
#!/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
2021-03-01 06:42:42 -05:00
SOURCE_TIME = [2021, 2, 27, 23, 55, 0]
2021-02-16 15:37:47 -05:00
@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__':
2021-03-01 06:42:42 -05:00
from ffplayout.playlist import GetSourceFromPlaylist
2021-02-16 15:37:47 -05:00
from ffplayout.utils import messenger
try:
main()
except KeyboardInterrupt:
print('\n', end='')