2018-08-27 04:57:14 -04:00
|
|
|
#!/usr/bin/env python3
|
2018-01-07 07:58:45 -05:00
|
|
|
|
|
|
|
# This file is part of ffplayout.
|
|
|
|
#
|
|
|
|
# ffplayout is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# ffplayout is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with ffplayout. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2021-03-26 09:43:21 -04:00
|
|
|
"""
|
|
|
|
This module is the starting program for running ffplayout engine.
|
|
|
|
"""
|
|
|
|
|
2021-06-01 04:13:47 -04:00
|
|
|
from importlib import import_module
|
|
|
|
from pathlib import Path
|
|
|
|
from platform import system
|
2020-02-03 11:33:08 -05:00
|
|
|
|
2022-01-27 16:24:32 -05:00
|
|
|
from ffplayout.utils import messenger, playout, validate_ffmpeg_libs
|
2018-01-07 07:58:45 -05:00
|
|
|
|
2019-10-31 17:23:43 -04:00
|
|
|
try:
|
2021-06-01 04:13:47 -04:00
|
|
|
if system() == 'Windows':
|
2019-11-01 10:54:24 -04:00
|
|
|
import colorama
|
|
|
|
colorama.init()
|
2019-10-31 17:23:43 -04:00
|
|
|
except ImportError:
|
2020-02-03 14:40:13 -05:00
|
|
|
print('colorama import failed, no colored console output on windows...')
|
2019-11-06 11:56:19 -05:00
|
|
|
|
|
|
|
|
2019-03-08 08:51:37 -05:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# main functions
|
|
|
|
# ------------------------------------------------------------------------------
|
2018-03-20 16:33:21 -04:00
|
|
|
|
2018-01-07 07:58:45 -05:00
|
|
|
def main():
|
2019-09-09 10:13:18 -04:00
|
|
|
"""
|
2020-07-18 17:34:55 -04:00
|
|
|
play out depending on output mode
|
2019-09-09 10:13:18 -04:00
|
|
|
"""
|
2020-08-31 09:58:15 -04:00
|
|
|
|
2022-01-26 05:48:18 -05:00
|
|
|
script_dir = Path(__file__).parent.absolute()
|
|
|
|
output_dir = script_dir.joinpath('ffplayout', 'output')
|
2022-02-03 15:57:45 -05:00
|
|
|
mode_exists = False
|
2020-07-18 17:34:55 -04:00
|
|
|
|
2022-01-26 05:48:18 -05:00
|
|
|
for output in output_dir.glob('*.py'):
|
|
|
|
if output != '__init__.py':
|
|
|
|
mode = Path(output).stem
|
2020-07-31 08:03:28 -04:00
|
|
|
|
2022-01-26 05:48:18 -05:00
|
|
|
if mode == playout.mode:
|
2022-02-03 15:57:45 -05:00
|
|
|
mode_exists = True
|
2022-01-26 05:48:18 -05:00
|
|
|
output = import_module(f'ffplayout.output.{mode}').output
|
|
|
|
output()
|
2022-02-03 15:57:45 -05:00
|
|
|
|
|
|
|
if not mode_exists:
|
2022-01-27 16:22:59 -05:00
|
|
|
messenger.error('Output mode not exist!')
|
2018-01-07 07:58:45 -05:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2020-04-24 13:33:04 -04:00
|
|
|
# check if ffmpeg contains all codecs and filters
|
|
|
|
validate_ffmpeg_libs()
|
2018-01-07 07:58:45 -05:00
|
|
|
main()
|