def get_executor_instance(cls, suggested_path=None): """Return executor instance.""" os_family = detect_os() logger.debug('Detected os: %s', os_family) for exec_cls in (FFmpegCliExecutor, ): executor = exec_cls.create(os_family, suggested_path) if executor: return executor
def _configure_unrar(): from knowit.utils import detect_os import rarfile os_family = detect_os() suggested_path = os.path.join(_get_lib_location(app.LIB_FOLDER), 'native', os_family) if os_family == 'windows': unrar_path = os.path.join(suggested_path, 'UnRAR.exe') rarfile.UNRAR_TOOL = unrar_path
def _configure_knowit(): from knowit import api from knowit.utils import detect_os os_family = detect_os() suggested_path = os.path.join(_lib_location(), 'native', os_family) if os_family == 'windows': subfolder = 'x86_64' if sys.maxsize > 2 ** 32 else 'i386' suggested_path = os.path.join(suggested_path, subfolder) api.initialize({'mediainfo': suggested_path})
def _configure_knowit(): from knowit import api from knowit.utils import detect_os os_family = detect_os() suggested_path = os.path.join(_get_lib_location(app.LIB_FOLDER), 'native', os_family) if os_family == 'windows': subfolder = 'x86_64' if sys.maxsize > 2 ** 32 else 'i386' suggested_path = os.path.join(suggested_path, subfolder) api.initialize({'mediainfo': suggested_path})
def test_detect_os(os_name, sys_platform, expected): with patch('knowit.utils.os') as mock_os: mock_os.name = os_name with patch('knowit.utils.sys') as mock_sys: mock_sys.platform = sys_platform assert detect_os() == expected