This commit is contained in:
2024-04-09 12:42:59 +02:00
parent d5684a4336
commit dcfffd9602
2 changed files with 6 additions and 7 deletions
+3 -5
View File
@@ -44,10 +44,8 @@ import yt_dlp
from spotify_dl import spotify from spotify_dl import spotify
from spotify_dl import youtube as youtube_download from spotify_dl import youtube as youtube_download
import communication_subroutine from communication_subroutine import comm_subroutine, IN_COMM_Q, OUT_COMM_Q
OUT_COMM_Q = Queue()
IN_COMM_Q = Queue()
Music_Config = TypedDict( Music_Config = TypedDict(
"Music_Config", "Music_Config",
@@ -685,7 +683,7 @@ async def check_data_q():
channel = client.get_channel(1062047367337095268) channel = client.get_channel(1062047367337095268)
try: try:
data = IN_COMM_Q.get(block=False) data = IN_COMM_Q.get(block=False)
await channel.send("O. A tak będzie wyglądało coś ciekawego w przyszłości: {data}") await channel.send(f"O. A tak będzie wyglądało coś ciekawego w przyszłości: {data}")
except Empty: except Empty:
pass pass
@@ -2229,7 +2227,7 @@ if __name__ == "__main__":
logger.info("Starting discord bot") logger.info("Starting discord bot")
threads = [] threads = []
threads.append(threading.Thread(target=client.run, args=(TOKEN,))) threads.append(threading.Thread(target=client.run, args=(TOKEN,)))
#threads.append(threading.Thread(target=communication_subroutine.comm_subroutine, args=(OUT_COMM_Q,IN_COMM_Q))) #threads.append(threading.Thread(target=comm_subroutine, args=(OUT_COMM_Q,IN_COMM_Q)))
for worker in threads: for worker in threads:
worker.start() worker.start()
for worker in threads: for worker in threads:
+3 -2
View File
@@ -1,13 +1,14 @@
import logging import logging
import threading import threading
import json import json
from queue import Queue
from flask import Flask, jsonify, request from flask import Flask, jsonify, request
from waitress import serve from waitress import serve
from bot import IN_COMM_Q, OUT_COMM_Q
HOST_ADDRESS = "192.168.1.191" HOST_ADDRESS = "192.168.1.191"
PORT_ADDRESS = 5000 PORT_ADDRESS = 5000
OUT_COMM_Q = Queue()
IN_COMM_Q = Queue()
app = Flask(__name__) app = Flask(__name__)