chore: fix log import

This commit is contained in:
Paul Bienkowski 2023-05-12 18:00:16 +02:00
parent 7e44f6d31d
commit 1c53230b4d

View file

@ -1,10 +1,13 @@
from datetime import datetime
import logging
import queue import queue
import tarfile import tarfile
from datetime import datetime
import dateutil.parser import dateutil.parser
from sanic.exceptions import InvalidUsage from sanic.exceptions import InvalidUsage
from obs.api.routes.tracks import log log = logging.getLogger(__name__)
RAISE = object() RAISE = object()
@ -83,8 +86,10 @@ class chunk:
async def tar_of_tracks(req, files): async def tar_of_tracks(req, files):
response = await req.respond(
response = await req.respond(content_type="application/x-gtar", headers={'Content-Disposition': 'attachment; filename="tracks.tar.bz2"'}) content_type="application/x-gtar",
headers={"Content-Disposition": 'attachment; filename="tracks.tar.bz2"'},
)
helper = StreamerHelper(response) helper = StreamerHelper(response)
@ -92,7 +97,7 @@ async def tar_of_tracks(req, files):
for fname in files: for fname in files:
log.info("Write file to tar: %s", fname) log.info("Write file to tar: %s", fname)
with open(fname, "rb") as fobj: with open(fname, "rb") as fobj:
tar.addfile(tar.gettarinfo(fname),fobj) tar.addfile(tar.gettarinfo(fname), fobj)
await helper.send_all() await helper.send_all()
tar.close() tar.close()
await helper.send_all() await helper.send_all()