Home > Backend Development > Python Tutorial > python实现定时播放mp3

python实现定时播放mp3

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 11:23:07
Original
2077 people have browsed it

程序很简单,主要是 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分钟)

Copy after login

演示图:

 

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template