import os
import time
import subprocess

playlist_path = r'C:\Users\Una\Desktop\playlist'

# 获取所有音频文件路径
audio_files = []
for root, dirs, files in os.walk(playlist_path):
    for file in files:
        if file.endswith('.mp3'):
            audio_files.append(os.path.join(root, file))

# 播放音频
for file in audio_files:
    subprocess.Popen(['groove.exe', file])
    time.sleep(1)  # 等待1秒

# 等待4小时
time.sleep(4 * 60 * 60)

# 关闭播放器
subprocess.Popen(['taskkill', '/f', '/im', 'groove.exe'])
Python代码:使用Groove播放器循环播放文件夹音频并自动关闭

原文地址: https://www.cveoy.top/t/topic/orVC 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录