chore(playout): update api-client imports
This commit is contained in:
parent
8369d55eb9
commit
8cb9bd5f32
|
@ -5,7 +5,7 @@ import traceback
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from libretime_api_client.version1 import AirtimeApiClient
|
from libretime_api_client.v1 import AirtimeApiClient as ApiClient
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ def generate_entrypoint(log_filepath: Optional[Path]):
|
||||||
|
|
||||||
while not successful:
|
while not successful:
|
||||||
try:
|
try:
|
||||||
ac = AirtimeApiClient(logger)
|
ac = ApiClient(logger)
|
||||||
ss = ac.get_stream_setting()
|
ss = ac.get_stream_setting()
|
||||||
generate_liquidsoap_config(ss, log_filepath)
|
generate_liquidsoap_config(ss, log_filepath)
|
||||||
successful = True
|
successful = True
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from libretime_api_client import version1 as api_client
|
from libretime_api_client.v1 import AirtimeApiClient as ApiClient
|
||||||
|
|
||||||
api_clients = api_client.AirtimeApiClient()
|
api_client = ApiClient()
|
||||||
|
|
||||||
dj_type = sys.argv[1]
|
dj_type = sys.argv[1]
|
||||||
username = sys.argv[2]
|
username = sys.argv[2]
|
||||||
|
@ -14,7 +14,7 @@ if dj_type == "--master":
|
||||||
elif dj_type == "--dj":
|
elif dj_type == "--dj":
|
||||||
source_type = "dj"
|
source_type = "dj"
|
||||||
|
|
||||||
response = api_clients.check_live_stream_auth(username, password, source_type)
|
response = api_client.check_live_stream_auth(username, password, source_type)
|
||||||
|
|
||||||
if "msg" in response and response["msg"] == True:
|
if "msg" in response and response["msg"] == True:
|
||||||
print(response["msg"])
|
print(response["msg"])
|
||||||
|
|
|
@ -13,7 +13,7 @@ from threading import Lock
|
||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
import click
|
import click
|
||||||
from libretime_api_client.version1 import AirtimeApiClient as ApiClient
|
from libretime_api_client.v1 import AirtimeApiClient as ApiClient
|
||||||
from libretime_shared.cli import cli_config_options, cli_logging_options
|
from libretime_shared.cli import cli_config_options, cli_logging_options
|
||||||
from libretime_shared.config import DEFAULT_ENV_PREFIX
|
from libretime_shared.config import DEFAULT_ENV_PREFIX
|
||||||
from libretime_shared.logging import level_from_name, setup_logger
|
from libretime_shared.logging import level_from_name, setup_logger
|
||||||
|
|
|
@ -16,7 +16,7 @@ from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import click
|
import click
|
||||||
from libretime_api_client.version1 import AirtimeApiClient
|
from libretime_api_client.v1 import AirtimeApiClient as ApiClient
|
||||||
from libretime_shared.cli import cli_logging_options
|
from libretime_shared.cli import cli_logging_options
|
||||||
from libretime_shared.config import DEFAULT_ENV_PREFIX
|
from libretime_shared.config import DEFAULT_ENV_PREFIX
|
||||||
from libretime_shared.logging import level_from_name, setup_logger
|
from libretime_shared.logging import level_from_name, setup_logger
|
||||||
|
@ -24,7 +24,7 @@ from loguru import logger
|
||||||
|
|
||||||
|
|
||||||
def api_client():
|
def api_client():
|
||||||
return AirtimeApiClient(logger=logger)
|
return ApiClient(logger=logger)
|
||||||
|
|
||||||
|
|
||||||
@click.group(context_settings={"auto_envvar_prefix": DEFAULT_ENV_PREFIX})
|
@click.group(context_settings={"auto_envvar_prefix": DEFAULT_ENV_PREFIX})
|
||||||
|
|
|
@ -12,8 +12,8 @@ from queue import Empty
|
||||||
from subprocess import PIPE, Popen
|
from subprocess import PIPE, Popen
|
||||||
from threading import Thread, Timer
|
from threading import Thread, Timer
|
||||||
|
|
||||||
from libretime_api_client import version1 as v1_api_client
|
from libretime_api_client.v1 import AirtimeApiClient as ApiClientV1
|
||||||
from libretime_api_client import version2 as api_client
|
from libretime_api_client.v2 import AirtimeApiClient as ApiClientV2
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from ..config import CACHE_DIR, POLL_INTERVAL, Config
|
from ..config import CACHE_DIR, POLL_INTERVAL, Config
|
||||||
|
@ -44,8 +44,8 @@ class PypoFetch(Thread):
|
||||||
# Hacky...
|
# Hacky...
|
||||||
PypoFetch.ref = self
|
PypoFetch.ref = self
|
||||||
|
|
||||||
self.v1_api_client = v1_api_client.AirtimeApiClient()
|
self.v1_api_client = ApiClientV1()
|
||||||
self.api_client = api_client.AirtimeApiClient()
|
self.api_client = ApiClientV2()
|
||||||
self.fetch_queue = pypoFetch_q
|
self.fetch_queue = pypoFetch_q
|
||||||
self.push_queue = pypoPush_q
|
self.push_queue = pypoPush_q
|
||||||
self.media_prepare_queue = media_q
|
self.media_prepare_queue = media_q
|
||||||
|
|
|
@ -6,7 +6,7 @@ import traceback
|
||||||
from queue import Empty
|
from queue import Empty
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
from libretime_api_client import version2 as api_client
|
from libretime_api_client.v2 import AirtimeApiClient as ApiClient
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from requests.exceptions import ConnectionError, Timeout
|
from requests.exceptions import ConnectionError, Timeout
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ class PypoFile(Thread):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
self.media_queue = schedule_queue
|
self.media_queue = schedule_queue
|
||||||
self.media = None
|
self.media = None
|
||||||
self.api_client = api_client.AirtimeApiClient()
|
self.api_client = ApiClient()
|
||||||
|
|
||||||
def copy_file(self, media_item):
|
def copy_file(self, media_item):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -6,7 +6,7 @@ from datetime import datetime
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
from libretime_api_client import version1 as api_client
|
from libretime_api_client.v1 import AirtimeApiClient as ApiClient
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from ..config import PUSH_INTERVAL, Config
|
from ..config import PUSH_INTERVAL, Config
|
||||||
|
@ -25,7 +25,7 @@ def is_file(media_item):
|
||||||
class PypoPush(Thread):
|
class PypoPush(Thread):
|
||||||
def __init__(self, q, telnet_lock, pypo_liquidsoap, config: Config):
|
def __init__(self, q, telnet_lock, pypo_liquidsoap, config: Config):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
self.api_client = api_client.AirtimeApiClient()
|
self.api_client = ApiClient()
|
||||||
self.queue = q
|
self.queue = q
|
||||||
|
|
||||||
self.telnet_lock = telnet_lock
|
self.telnet_lock = telnet_lock
|
||||||
|
|
|
@ -2,7 +2,7 @@ from datetime import datetime, timedelta
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from dateutil.parser import isoparse
|
from dateutil.parser import isoparse
|
||||||
from libretime_api_client.version2 import AirtimeApiClient as ApiClient
|
from libretime_api_client.v2 import AirtimeApiClient as ApiClient
|
||||||
from libretime_shared.datetime import (
|
from libretime_shared.datetime import (
|
||||||
time_fromisoformat,
|
time_fromisoformat,
|
||||||
time_in_milliseconds,
|
time_in_milliseconds,
|
||||||
|
|
|
@ -12,20 +12,11 @@ from threading import Thread
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
import mutagen
|
import mutagen
|
||||||
from libretime_api_client.version1 import AirtimeApiClient as AirtimeApiClientV1
|
from libretime_api_client.v1 import AirtimeApiClient as ApiClient
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from libretime_playout.config import PUSH_INTERVAL, RECORD_DIR, Config
|
from libretime_playout.config import PUSH_INTERVAL, RECORD_DIR, Config
|
||||||
|
|
||||||
|
|
||||||
def api_client():
|
|
||||||
"""
|
|
||||||
api_client returns the correct instance of AirtimeApiClient. Although there is only one
|
|
||||||
instance to choose from at the moment.
|
|
||||||
"""
|
|
||||||
return AirtimeApiClientV1()
|
|
||||||
|
|
||||||
|
|
||||||
# TODO : add docstrings everywhere in this module
|
# TODO : add docstrings everywhere in this module
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +46,7 @@ class ShowRecorder(Thread):
|
||||||
config: Config,
|
config: Config,
|
||||||
):
|
):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
self.api_client = api_client()
|
self.api_client = ApiClient()
|
||||||
self.config = config
|
self.config = config
|
||||||
self.filelength = filelength
|
self.filelength = filelength
|
||||||
self.start_time = start_time
|
self.start_time = start_time
|
||||||
|
@ -179,7 +170,7 @@ class ShowRecorder(Thread):
|
||||||
class Recorder(Thread):
|
class Recorder(Thread):
|
||||||
def __init__(self, q, config: Config):
|
def __init__(self, q, config: Config):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
self.api_client = api_client()
|
self.api_client = ApiClient()
|
||||||
self.config = config
|
self.config = config
|
||||||
self.sr = None
|
self.sr = None
|
||||||
self.shows_to_record = {}
|
self.shows_to_record = {}
|
||||||
|
|
|
@ -7,7 +7,7 @@ from datetime import datetime
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
import defusedxml.minidom
|
import defusedxml.minidom
|
||||||
from libretime_api_client import version1 as api_client
|
from libretime_api_client.v1 import AirtimeApiClient as ApiClient
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
@ -20,7 +20,7 @@ class ListenerStat(Thread):
|
||||||
def __init__(self, config: Config):
|
def __init__(self, config: Config):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
self.config = config
|
self.config = config
|
||||||
self.api_client = api_client.AirtimeApiClient()
|
self.api_client = ApiClient()
|
||||||
|
|
||||||
def get_node_text(self, nodelist):
|
def get_node_text(self, nodelist):
|
||||||
rc = []
|
rc = []
|
||||||
|
|
Loading…
Reference in New Issue