Skip to content

Commit

Permalink
gpio stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien Bron authored and Bastien Bron committed Sep 19, 2023
1 parent 8ffaeee commit c600e19
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
8 changes: 8 additions & 0 deletions borne/gpio.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ function ledsOFF(){
// Set the value of the pin high (turn it on)
$pin->setValue(PinInterface::VALUE_LOW);
}

if(isset($_GET["leds"])){
if($_GET["leds"] == "on"){
ledsON();
}else{
ledsOFF();
}
}
2 changes: 1 addition & 1 deletion machineatubes/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def load_score_file(self):
result = self.ctrlwin.create_file_dialog(webview.OPEN_DIALOG, allow_multiple=False, file_types=file_types)

if result:
self.tubes.append(parseFile2Score(result[0]))
self.tubes.append(parseFile2Score(result[0], args.verbose))
self.log("loaded file " + result[0])
t = self.tubes[-1]

Expand Down
4 changes: 2 additions & 2 deletions machineatubes/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def parseJSON2Score(payload, verbose=False):

max_length = 0

score.style_flavor = payload.get("style").split("_")[1]
score.style_flavor = payload.get("style").split("_")[1] or "1"

score.infos = {
"name": payload.get("name"),
Expand All @@ -42,7 +42,7 @@ def parseJSON2Score(payload, verbose=False):
"intro_video_url": "intro_bug.mp4",
}

#pprint.pprint(score.infos)
pprint.pprint(score.infos)

for name, part in payload.get("song").items():
score.parts[name] = {
Expand Down
13 changes: 10 additions & 3 deletions machineatubes/tube.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def getsongvideos(subfolder = ""):
v[0]: [ str(PurePosixPath(vid.relative_to(relpath))) for vid in (videospath / subfolder / v[0]).glob('*.' + vext) ] for v in song_structure
}



def get_intro_video():
return random.choice(
[ str(PurePosixPath(vid.relative_to(relpath))) for vid in (videospath / "machine" / "intro").glob('*.' + vext) ]
Expand Down Expand Up @@ -213,14 +215,19 @@ def stop(self):
out.send_noteoff(0, 12)

def mix_videos(self):
videos = getsongvideos(Path(str(self.bpm)) / self.infos["style"] / self.style_flavor )
path = Path(str(self.bpm)) / self.infos["style"] / self.style_flavor
videos = getsongvideos(path)
for v in song_structure:
i = 0
for b in range(v[1], v[2], v[3]):
if len(videos[v[0]]) == 0:
print("no video for %s / %s" % (path, v[0]))
continue
print("add videonote %s %s" % (b, v[0]))
vid = VideoNote(file=videos[v[0]][i])
vid = VideoNote(file=videos[v[0]][i % (len(videos[v[0]]))])
self.videonote(b, vid)
i = (i + 1) % (len(videos[v[0]]) - 1)
if len(videos[v[0]]) > 0:
i = (i + 1)

def get_intro_video(self, id):
print("get video id " + id)
Expand Down

0 comments on commit c600e19

Please sign in to comment.