mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-13 06:34:45 -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
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
@ -37,6 +36,7 @@ class TrackMetadata:
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_qobuz(cls, album: AlbumMetadata, resp: dict) -> TrackMetadata | None:
|
def from_qobuz(cls, album: AlbumMetadata, resp: dict) -> TrackMetadata | None:
|
||||||
title = typed(resp["title"].strip(), str)
|
title = typed(resp["title"].strip(), str)
|
||||||
|
isrc = typed(resp["isrc"], str)
|
||||||
streamable = typed(resp.get("streamable", False), bool)
|
streamable = typed(resp.get("streamable", False), bool)
|
||||||
|
|
||||||
if not streamable:
|
if not streamable:
|
||||||
|
@ -82,15 +82,13 @@ class TrackMetadata:
|
||||||
tracknumber=tracknumber,
|
tracknumber=tracknumber,
|
||||||
discnumber=discnumber,
|
discnumber=discnumber,
|
||||||
composer=composer,
|
composer=composer,
|
||||||
|
isrc=isrc,
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_deezer(cls, album: AlbumMetadata, resp) -> TrackMetadata | None:
|
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"])
|
track_id = str(resp["id"])
|
||||||
|
isrc = typed(resp["isrc"], str)
|
||||||
bit_depth = 16
|
bit_depth = 16
|
||||||
sampling_rate = 44.1
|
sampling_rate = 44.1
|
||||||
explicit = typed(resp["explicit_lyrics"], bool)
|
explicit = typed(resp["explicit_lyrics"], bool)
|
||||||
|
@ -116,6 +114,7 @@ class TrackMetadata:
|
||||||
tracknumber=tracknumber,
|
tracknumber=tracknumber,
|
||||||
discnumber=discnumber,
|
discnumber=discnumber,
|
||||||
composer=composer,
|
composer=composer,
|
||||||
|
isrc=isrc,
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -152,14 +151,11 @@ class TrackMetadata:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_tidal(cls, album: AlbumMetadata, track) -> TrackMetadata:
|
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()
|
title = typed(track["title"], str).strip()
|
||||||
item_id = str(track["id"])
|
item_id = str(track["id"])
|
||||||
|
isrc = typed(track["isrc"], str)
|
||||||
version = track.get("version")
|
version = track.get("version")
|
||||||
explicit = track.get("explicit", False)
|
explicit = track.get("explicit", False)
|
||||||
isrc = track.get("isrc")
|
|
||||||
if version:
|
if version:
|
||||||
title = f"{title} ({version})"
|
title = f"{title} ({version})"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue