Skip to content

Commit

Permalink
Merge pull request #16 from vincentberry/dev
Browse files Browse the repository at this point in the history
MERGE -> NEW VERSION
  • Loading branch information
vincentberry authored Mar 6, 2024
2 parents b3b1758 + 7d056f2 commit 5d0e019
Show file tree
Hide file tree
Showing 21 changed files with 1,812 additions and 377 deletions.
2 changes: 2 additions & 0 deletions app/class/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public function __construct(){
`input` TEXT DEFAULT '0',
`duration` TEXT DEFAULT '0',
`value` TEXT DEFAULT '0',
`selectedName` TEXT DEFAULT '0',
`selectedIndex` TEXT DEFAULT '0',
`push_vmix` INTEGER NOT NULL DEFAULT 0);"
);
}
Expand Down
6 changes: 4 additions & 2 deletions app/class/db_insert.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

class db_insert{

public static function new_command($session_vmix, $command, $input, $value, $duration){
public static function new_command($session_vmix, $command, $input, $value, $duration, $selectedName, $selectedIndex){

App::getDatabase()->query('INSERT INTO command(date_time, session_vmix, command, input, value, duration) VALUES(CURRENT_TIMESTAMP, ?, ?,?,?,?)', [
App::getDatabase()->query('INSERT INTO command(date_time, session_vmix, command, input, value, duration, selectedName, selectedIndex) VALUES(CURRENT_TIMESTAMP, ?, ?,?,?,?,?,?)', [
$session_vmix,
$command,
$input,
$value,
$duration,
$selectedName,
$selectedIndex,
]
);
return App::getDatabase()->lastInsertId();
Expand Down
42 changes: 22 additions & 20 deletions app/inc/vmix_script.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
Dim RESP As Byte()
Dim conected As String = userurl & p & u
Try
RESP = W.UploadValues(con, NC)
R = System.Text.Encoding.ASCII.GetString(RESP)
RESP = W.UploadValues(con, NC)
R = System.Text.Encoding.ASCII.GetString(RESP)
Dim rawCommand As string = R
' Afficher la réponse
Expand All @@ -40,26 +40,28 @@
Dim command
' Parcourir chaque commande dans le tableau
For Each command In commands
Dim commandParts As String() = command.Split("~"c)
If commandParts.Length = 4 Then
Dim functionType As String = commandParts(0).Trim()
Dim inputParam As String = commandParts(1).Trim()
Dim valueParam As String = commandParts(2).Trim()
Dim durationParam As String = commandParts(3).Trim()
Dim commandParts As String() = command.Split("~"c)
If commandParts.Length = 6 Then
Dim functionType As String = commandParts(0).Trim()
Dim inputParam As String = commandParts(1).Trim()
Dim valueParam As String = commandParts(2).Trim()
Dim durationParam As String = commandParts(3).Trim()
Dim selectedNameParam As String = commandParts(4).Trim()
Dim selectedIndexParam As String = commandParts(5).Trim()
' Appeler la fonction VMix avec les paramètres appropriés
API.Function(functionType, Input:=inputParam, Value:=valueParam, Duration:=durationParam, selectedName:=selectedNameParam, selectedIndex:=selectedIndexParam)

' Appeler la fonction VMix avec les paramètres appropriés
API.Function(functionType, Input:=inputParam, Value:=valueParam, Duration:=durationParam)
If functionType = "session_delay" Then
session_delay = valueParam
End If

If functionType = "session_delay" Then
session_delay = valueParam
End If

'Console.WriteLine(functionType)
Elseif Not String.IsNullOrEmpty(rawCommand) Then
'Console.WriteLine(rawCommand)
Else
'Console.WriteLine("La commande VMix est mal formée.")
End If
'Console.WriteLine(functionType)
Elseif Not String.IsNullOrEmpty(rawCommand) Then
'Console.WriteLine(rawCommand)
Else
'Console.WriteLine("La commande VMix est mal formée.")
End If
Next


Expand Down
4 changes: 3 additions & 1 deletion app/public/api/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
$input = $item["input"];
$value = $item["value"];
$duration = $item["duration"];
$selectedName = $item["selectedName"];
$selectedIndex = $item["selectedIndex"];
// Accéder aux valeurs individuelles
$envoi_vmix = $envoi_vmix . "$command~ $input~ $value~ $duration!";
$envoi_vmix = $envoi_vmix . "$command~ $input~ $value~ $duration~ $selectedName~ $selectedIndex!";
db_insert::delete_vmix_command($item["id"]);

}
Expand Down
6 changes: 4 additions & 2 deletions app/public/api/send_command.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
$input = !empty($_GET["input"]) ? $_GET["input"] : 0;
$value = !empty($_GET["value"]) ? $_GET["value"] : 0;
$duration = !empty($_GET["duration"]) ? $_GET["duration"] : 0;

$req = db_insert::new_command($session_vmix, $command, $input, $value, $duration);
$selectedName = !empty($_GET["selectedName"]) ? $_GET["selectedName"] : 0;
$selectedIndex = !empty($_GET["selectedIndex"]) ? $_GET["selectedIndex"] : 0;

$req = db_insert::new_command($session_vmix, $command, $input, $value, $duration, $selectedName, $selectedIndex);
echo json_encode(array("Valid" => "Command $req bien envoyée ! Elle va bientôt être exécutée !"));
die();
}
Expand Down
Loading

0 comments on commit 5d0e019

Please sign in to comment.