当前位置: 首页>>代码示例>>Python>>正文


Python Track.playbackInfo方法代码示例

本文整理汇总了Python中track.Track.playbackInfo方法的典型用法代码示例。如果您正苦于以下问题:Python Track.playbackInfo方法的具体用法?Python Track.playbackInfo怎么用?Python Track.playbackInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在track.Track的用法示例。


在下文中一共展示了Track.playbackInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import playbackInfo [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):

#.........这里部分代码省略.........
开发者ID:Palkovsky,项目名称:AudioPi,代码行数:103,代码来源:playlist.py


注:本文中的track.Track.playbackInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。