本文整理汇总了Python中track.Track.unpause方法的典型用法代码示例。如果您正苦于以下问题:Python Track.unpause方法的具体用法?Python Track.unpause怎么用?Python Track.unpause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类track.Track
的用法示例。
在下文中一共展示了Track.unpause方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import unpause [as 别名]
class Playlist:
def __init__(self, tracks, volume = 1):
self.position = -1
self.threadCount = len(tracks)
self.volume = volume
self.currentTrack = None
self.tracks = tracks
def loadTracks(self, tracks):
self.tracks = tracks
self.threadCount = len(tracks)
def play(self, position = 0, onError = None):
if len(self.tracks) > 0 and len(self.tracks) > position:
self.position = position
if onError == None:
self.currentTrack = Track(self.tracks[self.position])
else:
self.currentTrack = Track(self.tracks[self.position], onError)
self.currentTrack.setVolume(self.volume)
self.currentTrack.play()
else:
raise IndexError('Wrong track position')
def nextTrack(self, onError = None):
if onError != None:
self.play(self.position + 1, onError)
else:
self.play(self.position + 1)
def previousTrack(self, onError = None):
if onError != None:
self.play(self.position - 1, onError)
else:
self.play(self.position - 1)
def nextTrackAvilable(self):
if len(self.tracks) > self.position + 1:
return True
return False
def prevTrackAvilable(self):
if len(self.tracks) > 0 and self.position - 1 >= 0:
return True
return False
def setVolume(self, volume):
if(volume > 1):
volume = 1
elif(volume < 0):
volume = 0
self.volume = volume
self.currentTrack.setVolume(volume)
def pause(self):
self.currentTrack.pause()
def unpause(self):
self.currentTrack.unpause()
def stop(self):
self.currentTrack.stop()
def isPaused(self):
return self.currentTrack.isPaused()
def isMuted(self):
if self.currentTrack != None:
return self.currentTrack.isMuted()
return False
def getVolume(self):
return self.volume
def isPlaying(self):
if self.currentTrack != None:
return self.currentTrack.isPlaying()
return None
def isPaused(self):
if self.currentTrack != None:
return self.currentTrack.isPaused()
return None
def getPosition(self):
return self.position;
def dispose(self):
self.currentTrack.dispose()
def onTrackEnd(self, callback):
callback(self.position)
def getTracks(self):
return self.tracks
def playbackInfo(self, code):
#.........这里部分代码省略.........