admin管理员组文章数量:1122846
I'll explain the scenario better: I set up a karaoke "system" with a frontend called Attract Mode, in Linux Mint 22, where the videos are played by VLC. The command line that plays the video looks like this: --aspect-ratio=16:9 --no-video-title-show --play-and-exit --fullscreen "[romfilename]" /home/pc/KARAOKE/NOTA/nota.mp4, where "[romfilename]" is the file to be played and the second video is the note displayed at the end of the first video playback.
The target of this script is the second video, which will vary with each execution. At first, I thought that each time this script ran the loop, it would modify the Nota.mp4 file with another one that would have a different "note" for the singers.
Despite using Linux, I don't have much knowledge of shell scripting.
I tried to create this .sh but as there are several files in the base, I didn't understand how to make it run in a loop.
I'll explain the scenario better: I set up a karaoke "system" with a frontend called Attract Mode, in Linux Mint 22, where the videos are played by VLC. The command line that plays the video looks like this: --aspect-ratio=16:9 --no-video-title-show --play-and-exit --fullscreen "[romfilename]" /home/pc/KARAOKE/NOTA/nota.mp4, where "[romfilename]" is the file to be played and the second video is the note displayed at the end of the first video playback.
The target of this script is the second video, which will vary with each execution. At first, I thought that each time this script ran the loop, it would modify the Nota.mp4 file with another one that would have a different "note" for the singers.
Despite using Linux, I don't have much knowledge of shell scripting.
I tried to create this .sh but as there are several files in the base, I didn't understand how to make it run in a loop.
Share Improve this question asked Nov 22, 2024 at 2:40 Cara do TICara do TI 1 1- Please read the How-to-ask and On-topic sections in the help center. Good luck. – shellter Commented Nov 22, 2024 at 5:31
1 Answer
Reset to default 0Put the videos you want to play in a folder, then just loop through them
#!/bin/bash
# Directory containing the karaoke videos and note videos
KARAOKE_DIR=/home/pc/KARAOKE/VIDEOS
NOTE_DIR=/home/pc/KARAOKE/NOTES
# List all the karaoke video files (you can adjust the pattern to match your files)
KARAOKE_VIDEOS=($KARAOKE_DIR/*.mp4)
# Loop through all karaoke videos
for karaoke_video in "${KARAOKE_VIDEOS[@]}"; do
vlc --aspect-ratio=16:9 --no-video-title-show --play-and-exit --fullscreen "$karaoke_video"
NOTE_VIDEO="$NOTE_DIR/nota.mp4"
vlc --aspect-ratio=16:9 --no-video-title-show --play-and-exit --fullscreen "$NOTE_VIDEO"
done
本文标签: linuxHow to create a script that copies and renames a file to a certain folderStack Overflow
版权声明:本文标题:linux - How to create a script that copies and renames a file to a certain folder? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736305996a1932791.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论