本文整理汇总了Python中playlist.Playlist.autoplay方法的典型用法代码示例。如果您正苦于以下问题:Python Playlist.autoplay方法的具体用法?Python Playlist.autoplay怎么用?Python Playlist.autoplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类playlist.Playlist
的用法示例。
在下文中一共展示了Playlist.autoplay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cwd
# 需要导入模块: from playlist import Playlist [as 别名]
# 或者: from playlist.Playlist import autoplay [as 别名]
def cwd(self, arg=None, menuw=None):
"""
make a menu item for each file in the directory
"""
logger.log( 9, 'cwd(arg=%r, menuw=%r)', arg, menuw)
play_items = []
number = len(self.info['tracks'])
if hasattr(self.info, 'mixed'):
number -= 1
for i in range(0, number):
title=self.info['tracks'][i]['title']
item = AudioItem('cdda://%d' % (i+1), self, title, scan=False)
# XXX FIXME: set also all the other info here if AudioInfo
# XXX will be based on mmpython
#item.set_info('', self.name, title, i+1, self.disc_id[1], '')
item.info = self.info['tracks'][i]
item.length = item.info['length']
if config.MPLAYER_ARGS.has_key('cd'):
item.mplayer_options += (' ' + config.MPLAYER_ARGS['cd'])
if self.devicename:
item.mplayer_options += ' -cdrom-device %s' % self.devicename
play_items.append(item)
# add all playable items to the playlist of the directory
# to play one files after the other
self.playlist = play_items
# all items together
items = []
# random playlist (only active for audio)
if 'audio' in config.DIRECTORY_ADD_RANDOM_PLAYLIST and len(play_items) > 1:
pl = Playlist(_('Random Playlist'), play_items, self, random=True)
pl.autoplay = True
items += [ pl ]
items += play_items
if hasattr(self.info, 'mixed'):
d = DirItem(self.media.mountdir, self)
d.name = _('Data files on disc')
items.append(d)
self.play_items = play_items
title = self.name
if title[0] == '[' and title[-1] == ']':
title = self.name[1:-1]
item_menu = menu.Menu(title, items, item_types = self.display_type)
if menuw:
menuw.pushmenu(item_menu)
return items