mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-09 14:11:55 -04:00
Add isrc to trackmetadata
This commit is contained in:
parent
58529d659b
commit
87987f72d1
1 changed files with 5 additions and 9 deletions
|
@ -1,6 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
@ -37,6 +36,7 @@ class TrackMetadata:
|
|||
@classmethod
|
||||
def from_qobuz(cls, album: AlbumMetadata, resp: dict) -> TrackMetadata | None:
|
||||
title = typed(resp["title"].strip(), str)
|
||||
isrc = typed(resp["isrc"], str)
|
||||
streamable = typed(resp.get("streamable", False), bool)
|
||||
|
||||
if not streamable:
|
||||
|
@ -82,15 +82,13 @@ class TrackMetadata:
|
|||
tracknumber=tracknumber,
|
||||
discnumber=discnumber,
|
||||
composer=composer,
|
||||
isrc=isrc,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_deezer(cls, album: AlbumMetadata, resp) -> TrackMetadata | None:
|
||||
with open("resp.json", "w") as f:
|
||||
json.dump(resp, f)
|
||||
|
||||
logger.debug(resp.keys())
|
||||
track_id = str(resp["id"])
|
||||
isrc = typed(resp["isrc"], str)
|
||||
bit_depth = 16
|
||||
sampling_rate = 44.1
|
||||
explicit = typed(resp["explicit_lyrics"], bool)
|
||||
|
@ -116,6 +114,7 @@ class TrackMetadata:
|
|||
tracknumber=tracknumber,
|
||||
discnumber=discnumber,
|
||||
composer=composer,
|
||||
isrc=isrc,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
@ -152,14 +151,11 @@ class TrackMetadata:
|
|||
|
||||
@classmethod
|
||||
def from_tidal(cls, album: AlbumMetadata, track) -> TrackMetadata:
|
||||
with open("tidal_track.json", "w") as f:
|
||||
json.dump(track, f)
|
||||
|
||||
title = typed(track["title"], str).strip()
|
||||
item_id = str(track["id"])
|
||||
isrc = typed(track["isrc"], str)
|
||||
version = track.get("version")
|
||||
explicit = track.get("explicit", False)
|
||||
isrc = track.get("isrc")
|
||||
if version:
|
||||
title = f"{title} ({version})"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue