misc
This commit is contained in:
@ -2,7 +2,6 @@ import logging
|
||||
import traceback
|
||||
import time
|
||||
import random
|
||||
from multiprocessing.pool import ThreadPool as Pool
|
||||
from .constructors import (
|
||||
ValidRadioNextRequest,
|
||||
ValidRadioReshuffleRequest,
|
||||
@ -129,14 +128,12 @@ class Radio(FastAPI):
|
||||
start: int = int(data.start)
|
||||
end: int = start + 20
|
||||
search: Optional[str] = data.search
|
||||
logging.info("queue request with start pos: %s & end pos: %s", start, end)
|
||||
|
||||
if not search:
|
||||
queue_full: list = self.radio_util.active_playlist
|
||||
else:
|
||||
queue_full: list = self.radio_util.datatables_search(data.search)
|
||||
queue: list = queue_full[start:end]
|
||||
logging.info("queue length: %s", len(queue))
|
||||
queue_out: list[dict] = []
|
||||
for x, item in enumerate(queue):
|
||||
queue_out.append(
|
||||
@ -313,9 +310,7 @@ class Radio(FastAPI):
|
||||
if len(self.radio_util.active_playlist) > 1:
|
||||
self.radio_util.active_playlist.append(next) # Push to end of playlist
|
||||
else:
|
||||
with Pool() as pool:
|
||||
pool.apply_async(self.radio_util.load_playlist())
|
||||
pool.close()
|
||||
self.loop.run_in_executor(None, self.radio_util.load_playlist)
|
||||
|
||||
self.radio_util.now_playing = next
|
||||
next["start"] = time_started
|
||||
@ -374,7 +369,7 @@ class Radio(FastAPI):
|
||||
await self.radio_util._ls_skip()
|
||||
return JSONResponse(content={"result": search})
|
||||
|
||||
async def radio_typeahead(
|
||||
def radio_typeahead(
|
||||
self, data: ValidRadioTypeaheadRequest, request: Request
|
||||
) -> JSONResponse:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user