本文整理汇总了Python中mp3play.load函数的典型用法代码示例。如果您正苦于以下问题:Python load函数的具体用法?Python load怎么用?Python load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, file_path):
self.file_path = file_path
self.fd = open(file_path)
if self.is_id3():
self.parser_mp3()
self.seconds = mp3play.load(self.file_path).seconds()
else:
self.seconds = mp3play.load(self.file_path).seconds()
示例2: __init__
def __init__(self):
self.uid = ""
self.passwd = ""
self.host = "134.176.102.11"
self.interval = 60
self.relogin = 0
self.hour = [22, 23, 0, 1, 2, 3, 4, 5]
self.minute = range(51, 56)
self.alarm_network = mp3play.load("alarm_network.wma")
self.alarm_bill = mp3play.load("alarm_bill.wma")
self.alarm_get = mp3play.load("alarm_get.wma")
self.keys = ["Çë¸÷±¾µØÍø·Ö¹«Ë¾", "Öµ°à¶½¼ì", "»ú·¿¶½¼ì", "¶½¼ì", "Öµ°à", "Ô¤¾¯ÕÏ°"]
self.members = ["ÎâÎÀ¶«", "ÁõÎÄÎä", "Òü½¨À¤", "Ф½¨"]
示例3: music
def music(self):
import mp3play
filename = u'../music/open.wav'
mp3 = mp3play.load(filename)
mp3.play()
time.sleep(3)
mp3.stop()
示例4: googletalk
def googletalk(lan, msg):
if lan == "tw":
try:
tts = gTTS(text=msg, lang="zh-tw")
tts.save("message.mp3")
except:
return 0
if lan == "en":
try:
tts = gTTS(text=msg, lang="en")
tts.save("message.mp3")
except:
print "en error"
return 0
if lan == "jp":
try:
tts = gTTS(text=msg, lang="ja")
tts.save("message.mp3")
except:
print "en error"
return 0
filename = "message.mp3"
clip = mp3play.load(filename)
clip.play()
time.sleep(min(15, clip.seconds()))
clip.stop()
示例5: speak
def speak():
print "Speaking at you..."
mp3 = mp3play.load('morning.mp3')
mp3.play()
while mp3.isplaying():
sleep(1)
os.remove('morning.mp3')
示例6: playSong
def playSong(filename):
print 'Playing song %s' % (filename)
clip = mp3play.load(path.join('songs', filename))
clip.play()
time.sleep(clip.seconds())
clip.stop()
示例7: onplay
def onplay(self):
cur=self.list.currentItem()#取得列表框当前项
if not cur:
QtGui.QMessageBox.information(self,"Info",u"请选择一个文件名!")
else:
self.mp3file=cur.text()#列表框项转成字符串文本
self.mp3=mp3play.load(self.mp3file)#载入mp3文件
self.mp3.play()#mp3播放
示例8: playBeep
def playBeep():
#print('playBeep\n')
audiofilename = r'C:\Users\hoominchu\Desktop\pi\beep.mp3'
clip = mp3play.load(audiofilename)
clip.play()
time.sleep(1)
clip.stop()
示例9: play
def play(event):
sy = listbox.curselection()[0]
url = data[sy]['audio']
urllib.urlretrieve(url,'music.mp3')
mp3 = mp3play.load('music.mp3')
mp3.play()
mp3.seconds(time.sleep(mp3.seconds()))
mp3.stop()
示例10: playSongForName
def playSongForName(name):
songsByName = {
'alex': ['baba-yetu-short.mp3'],
'ara': ['rocky-short.mp3'],
'angela': ['conga-short.mp3'],
'arsineh': ['black-betty-short.mp3'],
'bobby': ['black-keyes-short.mp3'],
'colette': ['coco-de-rasta-short.mp3'],
'cole': ['super-mario-bros-short.mp3', 'super-mario-bros-short.mp3', 'super-mario-bros-short.mp3', 'super-mario-bros-short.mp3', 'raidersmarch-short.mp3'],
'erik': ['im-not-that-girl-short.mp3'],
'joey': ['talking-head-short.mp3'],
'justin': ['austin-powers-short.mp3'],
'kate': ['the-man-in-me-short.mp3'],
'kumar': ['give-up-the-funk-short.mp3'],
'loren': ['circle-of-life-short.mp3', 'good-morning-short.mp3', 'smooth-criminal-short.mp3', 'hard-victory-short.mp3', 'here-comes-the-sun-short.mp3'],
'moritz': ['peponi-short.mp3'],
'mt': ['boogie-on-reggae-woman-short.mp3'],
'neil': ['chariots-of-fire-short.mp3'],
'rohan': ['cotton-eye-joe-short.mp3'],
'ryan': ['sexy-and-i-know-it-short.mp3'],
'soonlen': ['another-world-short.mp3'],
'stan': ['baby-short.mp3'],
'stephanie':['island-in-the-sun-short.mp3'],
'sydni': ['danger-zone-short.mp3'],
'todd': ['night-moves-short.mp3'],
'tracy': ['super-bass-short.mp3', 'gangnam-style-short.mp3'],
'guest': ['the-final-countdown-short.mp3']
}
goodbye_songs = [
'so-long-farewell-short.mp3',
'so-long-short.mp3',
'heighho-short.mp3',
'time-to-say-goodbye-short.mp3',
'see-you-later-alligator-short.mp3',
'i-hope-tomorrow-is-like-today-short.mp3',
'home-short.mp3',
'gone-short.mp3',
'already-gone-short.mp3',
'on-my-way-home-short.mp3',
'na-na-hey-hey-short.mp3',
'super-mario-bros-stage-clear.mp3'
]
if time.localtime().tm_hour >= 16:
filename = random.choice(goodbye_songs)
else:
if not songsByName.has_key(name):
name = 'guest'
songs = songsByName[name]
filename = songs[time.localtime().tm_wday % len(songs)]
print 'Playing song %s for %s' % (filename, name)
clip = mp3play.load(path.join('songs', filename))
clip.play()
time.sleep(clip.seconds())
clip.stop()
示例11: play_mp3
def play_mp3(filename, max_seconds=5):
'''
Play one mp3 file
'''
clip = mp3play.load(filename)
clip.play()
# Let it play for up to 5 seconds, then stop it.
time.sleep(min(max_seconds, clip.seconds()))
clip.stop()
示例12: play
def play(f):
try:
clip = mp3play.load(f)
clip.play()
# Let it play for up to 30 seconds, then stop it.
import time
time.sleep(clip.seconds())
clip.stop()
except:
pass
示例13: play
def play(self):
"""
播放音频文件
:return:
"""
mp3 = mp3play.load(self.file_path)
mp3.play()
sleep_time = min(1800, mp3.seconds())
time.sleep(sleep_time + 3)
mp3.stop()
self.close()
示例14: tune_changed
def tune_changed(event):
global trackLocations
global music
global idx
global name
idx = event.widget.curselection()[0]
# print "idx",idx
pieces=trackLocations[int(idx)].split("\\")
name.set(pieces[-1])
music = mp3play.load(trackLocations[int(idx)])
music.play()
print ("Now playing %s" % event.widget.get(idx))
示例15: musicnext
def musicnext():
global idx
global music
global trackLocations
global name
idx+=1
# print "idx",idx
music.stop()
pieces=trackLocations[int(idx)].split("/")
name.set(pieces[-1])
music = mp3play.load(trackLocations[int(idx)])
music.play()