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.
|
|
|
|
"""
|
|
|
|
|
2019-03-06 09:06:06 -05:00
|
|
|
import os
|
2020-06-07 14:08:54 -04:00
|
|
|
from pydoc import locate
|
2020-02-03 11:33:08 -05:00
|
|
|
|
2021-03-25 09:39:03 -04:00
|
|
|
from ffplayout.utils import playout, stdin_args, validate_ffmpeg_libs
|
2018-01-07 07:58:45 -05:00
|
|
|
|
2019-10-31 17:23:43 -04:00
|
|
|
try:
|
2019-11-01 10:54:24 -04:00
|
|
|
if os.name != 'posix':
|
|
|
|
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
|
|
|
|
2021-03-25 09:39:03 -04:00
|
|
|
if stdin_args.mode:
|
|
|
|
output = locate(f'ffplayout.output.{stdin_args.mode}.output')
|
2020-07-18 17:34:55 -04:00
|
|
|
output()
|
|
|
|
|
|
|
|
else:
|
2020-07-31 08:03:28 -04:00
|
|
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
output_dir = os.path.join(script_dir, 'ffplayout', 'output')
|
|
|
|
|
|
|
|
for output in os.listdir(output_dir):
|
|
|
|
if os.path.isfile(os.path.join(output_dir, output)) \
|
2020-07-18 17:34:55 -04:00
|
|
|
and output != '__init__.py':
|
|
|
|
mode = os.path.splitext(output)[0]
|
|
|
|
|
2021-03-25 09:39:03 -04:00
|
|
|
if mode == playout.mode:
|
2021-02-03 16:27:11 -05:00
|
|
|
output = locate(f'ffplayout.output.{mode}.output')
|
2020-07-18 17:34:55 -04:00
|
|
|
output()
|
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()
|