本文整理汇总了Python中mp3play.load函数的典型用法代码示例。如果您正苦于以下问题:Python load函数的具体用法?Python load怎么用?Python load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:dinghao-bd,项目名称:some_tools,代码行数:9,代码来源:mp3.py
示例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 = ["ÎâÎÀ¶«", "ÁõÎÄÎä", "Òü½¨À¤", "Ф½¨"]
开发者ID:flowsha,项目名称:zhwh,代码行数:13,代码来源:feedback.py
示例3: music
def music(self):
import mp3play
filename = u'../music/open.wav'
mp3 = mp3play.load(filename)
mp3.play()
time.sleep(3)
mp3.stop()
开发者ID:sunluchang,项目名称:xiaoyPhoto,代码行数:7,代码来源:xiaoyPhoto.py
示例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()
开发者ID:twitchat,项目名称:Kalpha,代码行数:27,代码来源:main.py
示例5: speak
def speak():
print "Speaking at you..."
mp3 = mp3play.load('morning.mp3')
mp3.play()
while mp3.isplaying():
sleep(1)
os.remove('morning.mp3')
开发者ID:gnzrealm,项目名称:NatalieDAA,代码行数:7,代码来源:Natalie.py
示例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()
开发者ID:EPAlan,项目名称:entry-music-facts,代码行数:7,代码来源:server.py
示例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播放
开发者ID:bravesnow,项目名称:xplayer,代码行数:8,代码来源:qtplayer.py
示例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()
开发者ID:hoominchu,项目名称:pi,代码行数:8,代码来源:pi.py
示例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()
开发者ID:ZenithDandelion,项目名称:Python_Learning,代码行数:8,代码来源:music.py
示例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()
开发者ID:EPAlan,项目名称:entry-music-facts,代码行数:58,代码来源:server.py
示例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()
开发者ID:liyongping,项目名称:codedepot,代码行数:10,代码来源:wordbook_youdao.py
示例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
开发者ID:codepongo,项目名称:zjdict,代码行数:10,代码来源:sound.py
示例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()
开发者ID:dinghao-bd,项目名称:some_tools,代码行数:11,代码来源:mp3.py
示例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))
开发者ID:bhoom10,项目名称:bci-media-player,代码行数:12,代码来源:gui_final.py
示例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()
开发者ID:bhoom10,项目名称:bci-media-player,代码行数:12,代码来源:gui_final.py
示例16: randomSiren
def randomSiren():
"""
@return:
"""
from random import randint
rnd = randint(0,3)
if rnd == 0:
siren = mp3play.load(Settings.soundsDir + Settings.sound['siren1'])
elif rnd == 1:
siren = mp3play.load(Settings.soundsDir + Settings.sound['siren1'])
elif rnd == 2:
siren = mp3play.load(Settings.soundsDir + Settings.sound['siren2'])
elif rnd == 3:
siren = mp3play.load(Settings.soundsDir + Settings.sound['siren3'])
else:
print "Error in random int, it retrns: " + str(rnd)
exit()
return siren
开发者ID:nlaurens,项目名称:SpaceAlert,代码行数:21,代码来源:threads.py
示例17: play
def play(self, data):
if self._mp3:
self._mp3.stop()
self._mp3.close()
self._mp3 = None
f = self._get_f()
if f is None:
return
f.write(data)
path = f.name
f.close()
self._mp3 = mp3play.load(path)
self._mp3.play()
开发者ID:f3n9,项目名称:ldoce5viewer,代码行数:13,代码来源:soundplayer.py
示例18: playFile
def playFile():
"""function role is to play the random music files collected from
HDD"""
mp3list = mp3files() # collected mp3 files list
count = len(mp3list)
for i in random.sample(mp3list, count):
print i # which file is played
clip = mp3play.load(i)
clip.play()
filelength = length(i)
# Let it play for up to 30 seconds, then stop it.
time.sleep(min(filelength, clip.seconds()))
clip.stop()
开发者ID:ShivaGuntuku,项目名称:Jarvis,代码行数:14,代码来源:music_player.py
示例19: play
def play(f):
if os.path.getsize(f) == 0:
return
if sys.platform == 'darwin':
return os.system('afplay %s' % 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
开发者ID:codepongo,项目名称:utocode,代码行数:14,代码来源:sound.py
示例20: play_song
def play_song(self):
#Make sure user is logged in
print "playing song "+str(self.logged_in())
if(self.logged_in()==1):
print "here"
#While there are more songs to be played
while(self.more_songs()):
#Load the next song from local file
mp3 = mp3play.load(self.get_song())
#Play the Song
mp3.play()
while mp3.isplaying():
pass
mp3.stop()
开发者ID:edward-leslie,项目名称:webdj,代码行数:14,代码来源:client.py
注:本文中的mp3play.load函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论