本文整理汇总了Python中store.Store.remove_all方法的典型用法代码示例。如果您正苦于以下问题:Python Store.remove_all方法的具体用法?Python Store.remove_all怎么用?Python Store.remove_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类store.Store
的用法示例。
在下文中一共展示了Store.remove_all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: JukeBox
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import remove_all [as 别名]
class JukeBox(object):
''' 쥬크박스.
기능:
- 음악리스트를 관리한다.
- 랜덤플레이를 지원한다.
- 자동플레이를 지원한다.
- 현재 실행 중인 곡을 알 수 있다.
'''
music_player = None
def __init__(self):
if JukeBox.music_player == None:
JukeBox.music_player = AsyncMusicPlayer()
JukeBox.music_player.start()
self.store = Store()
songs = self.store.get_songs()
self.append_song_list(songs)
def append_song_to_db(self, song):
self.store.update_or_new(song)
def append_song_list(self, songs):
for song in songs:
self.append_song_playlist(song)
def append_song_playlist(self, song):
playlist_lock.acquire()
playlist.append(song)
playlist_lock.release()
def append_playlist_song_by_dbid(self, dbid):
song = self.store.find_by_id(dbid)
playlist_lock.acquire()
playlist.append(song)
playlist_lock.release()
def play_right_next(self, song):
playlist_lock.acquire()
playlist.insert(0, song)
playlist.append(song)
def current_song(self):
return self.music_player.current_song
def current_playlist(self):
playlist_lock.acquire()
songs = playlist[:]
playlist_lock.release()
return songs
def get_db_songs(self):
return self.store.get_songs()
def stop(self):
print("stop in juke box")
cmd = ('stop',None)
command_list.put(cmd)
def play(self):
cmd = ('play',None)
command_list.put(cmd)
def forward(self):
cmd = ('forward',None)
command_list.put(cmd)
def rewind(self):
pass
def clear(self):
playlist_lock.acquire()
playlist.clear()
playlist.append(song)
self.store.remove_all()