当前位置:主页 > 软件编程 > Python代码 >

python实现定时播放mp3

时间:2021-06-22 09:36:30 | 栏目:Python代码 | 点击:

程序很简单,主要是 mp3play 模块的应用

import mp3play, time
 
filename = "Should It Matter.mp3"
clip = mp3play.load(filename)
while 1:
  if time.localtime().tm_min % 30 == 0:
    clip.play()
    print "\nStart to play"
    time.sleep(clip.seconds())
    clip.stop()
    print "Stop"
  print '>',
  time.sleep(30) #暂停30秒(不是30分钟)

演示图:

 

以上所述就是本文的全部内容了,希望大家能够喜欢。

您可能感兴趣的文章:

相关文章