Added logging e outputs

This commit is contained in:
Fabio Scotto di Santolo
2024-10-25 10:19:51 +02:00
parent de6138870d
commit dd01ddb5cf
3 changed files with 12 additions and 0 deletions

View File

@@ -1,9 +1,13 @@
import itertools
import json
import logging
from typing import Any
from api import shazam
from models.track import TrackInfo, Album
logger = logging.getLogger(__name__)
async def __extract_data(data: dict[str, Any]) -> dict[str, Any]:
def album_field(x: str, lst: list) -> str | int:
@@ -18,6 +22,7 @@ async def __extract_data(data: dict[str, Any]) -> dict[str, Any]:
return t["attributes"]
return {}
logger.debug(json.dumps(data, indent=2))
track_data = data["track"]
track_attrs = list(itertools.chain(*[x["metadata"] for x in track_data["sections"] if "metadata" in x]))
album_attrs = seek_track(