Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

❓[Question] bash脚本路径 = 可以是bat或者python吗? windows环境这里具体要什么格式? #771

Closed
1 task done
9ihbd2DZSMjtsf7vecXjz opened this issue Nov 13, 2024 · 13 comments
Labels
question Further information is requested

Comments

@9ihbd2DZSMjtsf7vecXjz
Copy link

9ihbd2DZSMjtsf7vecXjz commented Nov 13, 2024

⚠️ 搜索是否存在类似问题

  • 我已经搜索过issues,没有找到相似的问题

🔧 运行方式

直接运行的exe文件

🐍 如果是使用源代码运行,请选择你的Python环境版本

None

💻 请选择你的系统环境

Windows 10

🤔 问题详情

bash脚本路径 =
windows环境如何在直播录制后执行bat或者python? 看配置文件只支持linux下执行任务后的bash, 请问win如何在录制后执行脚本? 谢谢

感谢

@9ihbd2DZSMjtsf7vecXjz 9ihbd2DZSMjtsf7vecXjz added the question Further information is requested label Nov 13, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: ❓[Question] Can the bash script path = be bat or python? windows windows What specific format is required for the environment?

⚠️ Search for similar problems

  • I have searched for issues and found no similar issues.

🔧 How to run

exe file to run directly

🐍 If you are running from source code, please select your Python environment version

None

💻 Please select your system environment

Windows 10

🤔 Question details

bash script path =
Can I directly fill in the bat path or python path here? What format is required to trigger the script after recording under windows? Thanks

@gyc0123
Copy link
Contributor

gyc0123 commented Nov 13, 2024

这个代码是执行bash的,现在只在linux下执行,你要是用python直接执行源码的话就可以在这填想执行的东西
main.py

        if bash_file_path:
            if os_type != 'nt':
                print(f'准备执行自定义Bash脚本,请确认脚本是否有执行权限! 路径:{bash_file_path}')
                bash_command = [bash_file_path, record_name.split(' ', maxsplit=1)[-1], save_file_path, save_type,
                                split_video_by_time, ts_to_mp4]
                run_bash(bash_command)
            else:
                print('只支持在Linux环境下执行Bash脚本')

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


This code is for executing bash. It is only executed under linux now. If you use python to execute the source code directly, you can fill in the things to be executed here.
main.py

        if bash_file_path:
            if os_type != 'nt':
                print(f' Prepare to execute a custom Bash script, please confirm whether the script has execution permission! Path: {bash_file_path}')
                bash_command = [bash_file_path, record_name.split(' ', maxsplit=1)[-1], save_file_path, save_type,
                                split_video_by_time, ts_to_mp4]
                run_bash(bash_command)
            else:
                print('Only supports executing Bash scripts in Linux environment')

@9ihbd2DZSMjtsf7vecXjz
Copy link
Author

这个代码是执行bash的,现在只在linux下执行,你要是用python直接执行源码的话就可以在这填想执行的东西 main.py

        if bash_file_path:
            if os_type != 'nt':
                print(f'准备执行自定义Bash脚本,请确认脚本是否有执行权限! 路径:{bash_file_path}')
                bash_command = [bash_file_path, record_name.split(' ', maxsplit=1)[-1], save_file_path, save_type,
                                split_video_by_time, ts_to_mp4]
                run_bash(bash_command)
            else:
                print('只支持在Linux环境下执行Bash脚本')

感谢解答, 请问有什么办法能支持win环境下录制完成后执行bat或者python吗,感谢

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


This code is for executing bash. It is only executed under linux now. If you use python to execute the source code directly, you can fill in the things to be executed here main.py

if bash_file_path:
if os_type != 'nt':
print(f' Prepare to execute the custom Bash script, please confirm whether the script has execution permission! Path: {bash_file_path}')
bash_command = [bash_file_path, record_name.split(' ', maxsplit=1)[-1], save_file_path, save_type,
split_video_by_time, ts_to_mp4]
run_bash(bash_command)
else:
print('Only supports executing Bash scripts in Linux environment')

Thanks for the answer. Is there any way to support the execution of bat or python after recording is completed in the win environment? Thanks

@gyc0123
Copy link
Contributor

gyc0123 commented Nov 13, 2024

你要是会python的话在这行附近加上自己的代码不就好了,bat的话就加上一行subprocess.run('C:\你的路径.bat')

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


If you know python, just add your own code near this line. If you use bat, add a line of subprocess.run('C:\your path.bat')

@9ihbd2DZSMjtsf7vecXjz
Copy link
Author

你要是会python的话在这行附近加上自己的代码不就好了,bat的话就加上一行subprocess.run('C:\你的路径.bat')

感谢老板点播, 好人一生平安

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


If you know python, just add your own code near this line. If you use bat, add a line of subprocess.run('C:\your path.bat')

Thanks to the boss for the on-demand broadcast, good people may live a safe life

@ihmily
Copy link
Owner

ihmily commented Nov 30, 2024

已支持python脚本,bat或者bash脚本,在config.ini中进行配置
以下是三种脚本的配置示例:

是否录制完成后执行自定义脚本 = 是
自定义脚本执行命令 = python test.py
是否录制完成后执行自定义脚本 = 是
自定义脚本执行命令 = test.bat
是否录制完成后执行自定义脚本 = 是
自定义脚本执行命令 = bash test.sh

@ihmily ihmily closed this as completed Nov 30, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Already supported python script, bat or bash script, configure in config.ini
The following are configuration examples for the three scripts:

Whether to execute custom script after recording is completed = Yes
Custom script execution command = python test.py
Whether to execute custom script after recording is completed = Yes
Custom script execution command = test.bat
Whether to execute custom script after recording is completed = Yes
Custom script execution command = bash test.sh

@Etherrrr
Copy link

@ihmily 希望可以把脚本配置示例加入Readme🙇‍♂️

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


@ihmily hopes to add script configuration examples to Readme🙇‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants