fixup! Actually look at input directory

This commit is contained in:
boyska 2023-03-31 02:21:14 +02:00
parent 5117bd7782
commit 03e201e6a2

View file

@ -1,4 +1,5 @@
import asyncio
from aiofiles.os import os as async_os
import logging
import tempfile
import os
@ -13,26 +14,6 @@ from techrec.http_retriever import download
logger = logging.getLogger("forge")
Validator = Callable[[datetime, datetime, str], bool]
async def get_timefile_exact(time) -> str:
"""
time is of type `datetime`; it is not "rounded" to match the real file;
that work is done in get_timefile(time)
"""
repo = get_config()["AUDIO_INPUT"]
path = os.path.join(
repo, time.strftime(get_config()["AUDIO_INPUT_FORMAT"])
)
if path.startswith("http://") or path.startswith("https://"):
logger.info(f"downloading: {path}")
local = await download(
path,
basic_auth=get_config()['AUDIO_INPUT_BASICAUTH'],
)
return local
return path
def round_timefile(exact: datetime) -> datetime:
"""
This will round the datetime, so to match the file organization structure
@ -134,10 +115,6 @@ class DirBackend(InputBackend):
class HttpBackend(InputBackend):
async def get_file(uri: str) -> str:
"""
time is not "rounded" to match the real file;
that work is done in get_timefile(time)
"""
self.log.info(f"downloading: {uri}")
local = await download(
uri,