Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien Bron authored and Bastien Bron committed Sep 21, 2023
1 parent 1cb3f37 commit e235222
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
6 changes: 3 additions & 3 deletions borne/p1.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"beat": '.($measure * 4).',
"note": '.$stopall.',
"duration": 4
}
]
}*/
$json .=']
},';
*/

?>
9 changes: 1 addition & 8 deletions machineatubes/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,14 @@ def start(self):
time.sleep(0.2)
self.win.toggle_fullscreen()

def oldplay(self):
if len(self.tubes) > 0 and self.tubes[0].playing is False:
abort.clear()
self.tubes[0].aplay(self.win, args.verbose)
if len(self.tubes) > 1:
self.tubes.pop(0)

def __play(self):
playing.set()
if len(self.tubes) == 0 and self.last_tube:
self.last_tube.play(self.win, args.verbose)
self.last_tube.stop()

while len(self.tubes) > 0 and not abort.is_set():
if len(self.tubes) > 0 and self.tubes[0].playing is False:
if len(self.tubes) > 0 and Tube.playing is False:
playlist = "<br> Playing %s (%s)" % (self.tubes[0].name, self.tubes[0].infos["numero"])
playlist = "<br> Next Song ".join([ "%s (%s)" % (t.name, t.infos["numero"]) for t in self.tubes[1:] ])
self.ctrlwin.evaluate_js('uplist("%s")' % playlist)
Expand Down
13 changes: 7 additions & 6 deletions machineatubes/tube.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def nanosleep(s):
class Tube():

window = False
playing = False

def __init__(self, name="noname") -> None:
self.name = name
Expand All @@ -103,7 +104,6 @@ def __init__(self, name="noname") -> None:
self.start_time = 0
self.time_signature = 0
self.divisions = 16
self.playing = False
self.infos = {}
self.intro_video_url = None

Expand Down Expand Up @@ -171,7 +171,7 @@ def playintro(self):

def play(self, window=False, verbose=False):
videoend.clear()
self.playing = True
Tube.playing = True
if Tube.window:
Tube.window.evaluate_js('displayinfos("%s","%s","%s","%s","%s","%s")' %
(self.name, self.infos["numero"], self.infos["ambiance"], self.infos["style"], self.bpm, self.infos["prenom"]))
Expand Down Expand Up @@ -201,14 +201,15 @@ def play(self, window=False, verbose=False):
videoend.clear()
self.stop()
self.applause()
time.sleep(2)
time.sleep(3)
Tube.window.evaluate_js('gooutro("%s")' % get_outro_video())
print("END")
videoend.wait(60)
#attente
time.sleep(5)
self.stop()

self.playing = False
Tube.playing = False

def setbpm(self):
out.send_noteon(0, bpm2midi[self.bpm], 127)
Expand Down Expand Up @@ -256,7 +257,7 @@ def mix_videos(self):
def get_intro_video(self, id):
print("get video id " + id)
if id and len(id) > 0:
if self.playing is False:
if Tube.playing is False:
Tube.window.evaluate_js('loading()')

url = "https://api.d-id.com/talks/" + id
Expand All @@ -283,7 +284,7 @@ def get_intro_video(self, id):
if response.status_code == 200:
self.infos["intro_video_url"] = video_url

if self.playing is False:
if Tube.playing is False:
Tube.window.evaluate_js('loaded()')
break

Expand Down

0 comments on commit e235222

Please sign in to comment.