parent
0e1dfaa9ff
commit
4ada25a3ff
|
@ -7,7 +7,7 @@ import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
from typing import Optional
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
import click
|
import click
|
||||||
from libretime_api_client.v1 import ApiClient as LegacyClient
|
from libretime_api_client.v1 import ApiClient as LegacyClient
|
||||||
|
@ -85,14 +85,14 @@ def cli(log_level: str, log_filepath: Optional[Path], config_filepath: Optional[
|
||||||
if not LIQUIDSOAP_MIN_VERSION <= liq_version:
|
if not LIQUIDSOAP_MIN_VERSION <= liq_version:
|
||||||
raise Exception(f"Invalid liquidsoap version {liq_version}")
|
raise Exception(f"Invalid liquidsoap version {liq_version}")
|
||||||
|
|
||||||
fetch_queue = Queue()
|
fetch_queue: Queue[Dict[str, Any]] = Queue()
|
||||||
recorder_queue = Queue()
|
recorder_queue: Queue[Dict[str, Any]] = Queue()
|
||||||
push_queue = Queue()
|
push_queue: Queue[Dict[str, Any]] = Queue()
|
||||||
# This queue is shared between pypo-fetch and pypo-file, where pypo-file
|
# This queue is shared between pypo-fetch and pypo-file, where pypo-file
|
||||||
# is the consumer. Pypo-fetch will send every schedule it gets to pypo-file
|
# is the consumer. Pypo-fetch will send every schedule it gets to pypo-file
|
||||||
# and pypo will parse this schedule to determine which file has the highest
|
# and pypo will parse this schedule to determine which file has the highest
|
||||||
# priority, and retrieve it.
|
# priority, and retrieve it.
|
||||||
file_queue = Queue()
|
file_queue: Queue[Dict[str, Any]] = Queue()
|
||||||
|
|
||||||
pypo_liquidsoap = PypoLiquidsoap(liq_client)
|
pypo_liquidsoap = PypoLiquidsoap(liq_client)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import json
|
||||||
from queue import Queue as ThreadQueue
|
from queue import Queue as ThreadQueue
|
||||||
from signal import SIGTERM, signal
|
from signal import SIGTERM, signal
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
# For RabbitMQ
|
# For RabbitMQ
|
||||||
from kombu.connection import Connection
|
from kombu.connection import Connection
|
||||||
|
@ -75,8 +76,8 @@ class MessageListener:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
config: Config,
|
config: Config,
|
||||||
fetch_queue: ThreadQueue,
|
fetch_queue: ThreadQueue[Dict[str, Any]],
|
||||||
recorder_queue: ThreadQueue,
|
recorder_queue: ThreadQueue[Dict[str, Any]],
|
||||||
) -> None:
|
) -> None:
|
||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from datetime import datetime
|
||||||
from queue import Empty, Queue
|
from queue import Empty, Queue
|
||||||
from subprocess import PIPE, Popen
|
from subprocess import PIPE, Popen
|
||||||
from threading import Thread, Timer
|
from threading import Thread, Timer
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from libretime_api_client.v1 import ApiClient as LegacyClient
|
from libretime_api_client.v1 import ApiClient as LegacyClient
|
||||||
from libretime_api_client.v2 import ApiClient
|
from libretime_api_client.v2 import ApiClient
|
||||||
|
@ -27,9 +28,9 @@ class PypoFetch(Thread):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
fetch_queue: Queue,
|
fetch_queue: Queue[Dict[str, Any]],
|
||||||
push_queue: Queue,
|
push_queue: Queue[Dict[str, Any]],
|
||||||
file_queue: Queue,
|
file_queue: Queue[Dict[str, Any]],
|
||||||
liq_client: LiquidsoapClient,
|
liq_client: LiquidsoapClient,
|
||||||
pypo_liquidsoap: PypoLiquidsoap,
|
pypo_liquidsoap: PypoLiquidsoap,
|
||||||
config: Config,
|
config: Config,
|
||||||
|
|
|
@ -4,6 +4,7 @@ import stat
|
||||||
import time
|
import time
|
||||||
from queue import Empty, Queue
|
from queue import Empty, Queue
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from libretime_api_client.v2 import ApiClient
|
from libretime_api_client.v2 import ApiClient
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
@ -16,7 +17,7 @@ class PypoFile(Thread):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
file_queue: Queue,
|
file_queue: Queue[Dict[str, Any]],
|
||||||
api_client: ApiClient,
|
api_client: ApiClient,
|
||||||
):
|
):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
|
|
|
@ -3,6 +3,7 @@ import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ class PypoPush(Thread):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
push_queue: Queue,
|
push_queue: Queue[Dict[str, Any]],
|
||||||
pypo_liquidsoap: PypoLiquidsoap,
|
pypo_liquidsoap: PypoLiquidsoap,
|
||||||
config: Config,
|
config: Config,
|
||||||
):
|
):
|
||||||
|
@ -38,7 +39,7 @@ class PypoPush(Thread):
|
||||||
self.current_prebuffering_stream_id = None
|
self.current_prebuffering_stream_id = None
|
||||||
self.queue_id = 0
|
self.queue_id = 0
|
||||||
|
|
||||||
self.future_scheduled_queue = Queue()
|
self.future_scheduled_queue: Queue[Dict[str, Any]] = Queue()
|
||||||
self.pypo_liquidsoap = pypo_liquidsoap
|
self.pypo_liquidsoap = pypo_liquidsoap
|
||||||
|
|
||||||
self.plq = PypoLiqQueue(self.future_scheduled_queue, self.pypo_liquidsoap)
|
self.plq = PypoLiqQueue(self.future_scheduled_queue, self.pypo_liquidsoap)
|
||||||
|
|
|
@ -2,6 +2,7 @@ from collections import deque
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from queue import Empty, Queue
|
from queue import Empty, Queue
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ class PypoLiqQueue(Thread):
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
future_queue: Queue,
|
future_queue: Queue[Dict[str, Any]],
|
||||||
pypo_liquidsoap: PypoLiquidsoap,
|
pypo_liquidsoap: PypoLiquidsoap,
|
||||||
):
|
):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
|
|
Loading…
Reference in New Issue