1 Star 0 Fork 14

Joe/ant-learn-python-100P

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
p049_python_phone_control_music.py 444 Bytes
一键复制 编辑 原始数据 按行查看 历史
cztps2 提交于 2021-08-22 21:38 +08:00 . xx
import os
from flask import Flask
import random
app = Flask(__name__)
music_dir = "/Users/peishuaishuai/Downloads/儿歌歌曲"
@app.route('/music')
def music():
music_files = [file for file in os.listdir(music_dir)
if file.endswith(".mp3")]
music_file = random.choice(music_files)
os.system(f'open "{music_dir}/{music_file}"')
return "<br/>"*10 + f"""<h1>当前播放<br/>{music_file}</h1>"""
app.run(host="0.0.0.0", port=8888)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/stayhungry2022/ant-learn-python-100P.git
git@gitee.com:stayhungry2022/ant-learn-python-100P.git
stayhungry2022
ant-learn-python-100P
ant-learn-python-100P
master

搜索帮助