forked from actlaboratory/LAMP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
file_manager.py
36 lines (34 loc) · 1.58 KB
/
file_manager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import globalVars
import player
import event_processor
def previousFile():
# プレイリスト再生中であれば
get = globalVars.playlist.getFile()
if get[1] == globalVars.eventProcess.playingDataNo:
# プレイリストの1曲前を再生
get = globalVars.playlist.getPrevious()
if get[0] != None:
globalVars.eventProcess.play(globalVars.playlist, get)
elif globalVars.eventProcess.repeatLoopFlag == 2: #ループ指定の時は末尾へ
get = globalVars.playlist.getFile(-1)
globalVars.eventProcess.play(globalVars.playlist, get)
elif get[0] != None:
# キューなどからの復帰
globalVars.eventProcess.play(globalVars.playlist, get)
def nextFile():
# キューを確認
get = globalVars.queue.getNext()
if get[0] == None:
# キューが空の時はプレイリストを確認
get = globalVars.playlist.getNext()
if get[0] != None:
globalVars.eventProcess.play(globalVars.playlist, get)
elif globalVars.eventProcess.repeatLoopFlag == 2: #ループであれば先頭へ
get = globalVars.playlist.getFile(0)
globalVars.eventProcess.play(globalVars.playlist, get)
else: #再生終了後に次がなければ停止し、全消費スリープタイマーに通知
if globalVars.play.getChannelState() == player.state.STOPED:
globalVars.eventProcess.stop()
globalVars.sleepTimer.call(True)
else: #キューを再生
globalVars.eventProcess.play(globalVars.queue, get)