From f4eb1c285d570aaf42766df037ed517750ba1cd7 Mon Sep 17 00:00:00 2001
From: tholimet <tholimet@localhost>
Date: Wed, 6 Mar 2024 14:28:07 +0100
Subject: [PATCH] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'ScdL?=
 =?UTF-8?q?iv'?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ScdLiv/main.py | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/ScdLiv/main.py b/ScdLiv/main.py
index d43152b..5b7929d 100644
--- a/ScdLiv/main.py
+++ b/ScdLiv/main.py
@@ -1,8 +1,7 @@
 from tkinter import *
 from tkinter import messagebox
 import mysql.connector
-from obswsrc import OBSWS
-from obswebsocket import obsws, requests
+from obswebsocket import requests, obsws
 from twitch.helix.api import TwitchHelix
 from twitchAPI.helper import first
 import asyncio
@@ -126,11 +125,14 @@ class NouvelleFenetre:
             cnx.close()
 
     # On configure OBS pour Twitch
-    def configure_obs_for_twitch(self, twitch_stream_key):
+    # def configure_obs_for_twitch(self, twitch_stream_key):
         # Utilisez la clé Twitch pour configurer OBS
-        self.ws.call(requests.StartStreaming(stream=twitch_stream_key))
+        # self.ws.call(requests.StartStreaming(stream=twitch_stream_key))
 
     def boutondediffusiontwitch_callback(self):
+        # Initialisez la connexion OBS WebSocket
+        self.ws = obsws("localhost", 4455, "MPcZLZfViZihHqmg")
+        self.ws.connect()
         # Avec la variable is_twitch_streaming passé à False au commencement, on vérifie son état pour diffuser ou stoper le streaming
         if self.is_twitch_streaming:
             self.ws.call(requests.StopStreaming())
@@ -199,10 +201,6 @@ class NouvelleFenetre:
         self.root.grid_columnconfigure(2, weight=0)
         self.root.grid_columnconfigure(3, weight=0)
 
-        # Créer un bouton pour lancer le processus d'authentification Twitch
-        bouton_auth_twitch = Button(self.root, text="Autoriser l'accès à Twitch", command=self.lancer_auth_twitch)
-        bouton_auth_twitch.grid(row=15, column=0)
-
         self.twitch_client = TwitchHelix(client_id = self.client_id, oauth_token = self.oauth_token)
 
         # On récupère la clé Twitch depuis la base de données
@@ -214,8 +212,8 @@ class NouvelleFenetre:
         self.ws.connect()
 
         # Configurez les paramètres de diffusion pour Twitch (remplacez 'stream_key' par le nom correct de votre champ)
-        twitch_stream_key = self.get_twitch_key_from_database(username)  # Variable qui récupére la key
-        self.configure_obs_for_twitch(twitch_stream_key)
+        # twitch_stream_key = self.get_twitch_key_from_database(username)  # Variable qui récupére la key
+        # self.configure_obs_for_twitch(twitch_stream_key)
 
         # On affiche bienvenue à la personne s'étant identifiée, en récupérant la variable lastname
         label = Label(self.root, text=f"Bienvenue, {username}!")