ffplayout/ffplayout.py

62 lines
1.9 KiB
Python
Raw Normal View History

2018-08-27 04:57:14 -04:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
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/>.
# ------------------------------------------------------------------------------
import os
2020-06-07 14:08:54 -04:00
from pydoc import locate
2020-02-03 11:33:08 -05:00
2020-07-18 17:34:55 -04:00
from ffplayout.utils import _playout, validate_ffmpeg_libs, stdin_args
2018-01-07 07:58:45 -05:00
try:
2019-11-01 10:54:24 -04:00
if os.name != 'posix':
import colorama
colorama.init()
except ImportError:
2020-02-03 14:40:13 -05:00
print('colorama import failed, no colored console output on windows...')
# ------------------------------------------------------------------------------
# main functions
# ------------------------------------------------------------------------------
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-07-18 17:34:55 -04:00
if stdin_args.desktop:
output = locate('ffplayout.output.desktop.output')
output()
else:
for output in os.listdir('ffplayout/output'):
if os.path.isfile(os.path.join('ffplayout/output', output)) \
and output != '__init__.py':
mode = os.path.splitext(output)[0]
if mode == _playout.mode:
output = locate('ffplayout.output.{}.output'.format(mode))
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()