mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-09 14:11:55 -04:00
Add explicit tag for track names #192
This commit is contained in:
parent
d88f349b6d
commit
4d8118356a
5 changed files with 30 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "streamrip"
|
||||
version = "1.6"
|
||||
version = "1.7"
|
||||
description = "A fast, all-in-one music ripper for Qobuz, Deezer, Tidal, and SoundCloud"
|
||||
authors = ["nathom <nathanthomas707@gmail.com>"]
|
||||
license = "GPL-3.0-only"
|
||||
|
|
|
@ -46,6 +46,8 @@ token_expiry = ""
|
|||
|
||||
[deezer]
|
||||
# 0, 1, or 2
|
||||
# This only applies to paid Deezer subscriptions. Those using deezloader
|
||||
# are automatically limited to quality = 1
|
||||
quality = 2
|
||||
# An authentication cookie that allows streamrip to use your Deezer account
|
||||
# See https://github.com/nathom/streamrip/wiki/Finding-Your-Deezer-ARL-Cookie
|
||||
|
@ -167,4 +169,4 @@ progress_bar = "dainty"
|
|||
|
||||
[misc]
|
||||
# Metadata to identify this config file. Do not change.
|
||||
version = "1.6"
|
||||
version = "1.7"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""streamrip: the all in one music downloader."""
|
||||
|
||||
__version__ = "1.6"
|
||||
__version__ = "1.7"
|
||||
|
||||
from . import clients, constants, converter, downloadtools, media
|
||||
|
|
|
@ -755,14 +755,15 @@ class Track(Media):
|
|||
|
||||
:rtype: str
|
||||
"""
|
||||
if hasattr(self, "meta"):
|
||||
try:
|
||||
_title = self.meta.title
|
||||
if self.meta.explicit:
|
||||
_title = f"{_title} (Explicit)"
|
||||
return _title
|
||||
else:
|
||||
except AttributeError:
|
||||
raise Exception("Track must be loaded before accessing title")
|
||||
|
||||
if self.meta.explicit:
|
||||
_title = f"{_title} (Explicit)"
|
||||
return _title
|
||||
|
||||
def get(self, *keys, default=None) -> Any:
|
||||
"""Safe get method that allows for layered access.
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ from .utils import get_cover_urls, get_quality_id, safe_get
|
|||
logger = logging.getLogger("streamrip")
|
||||
|
||||
|
||||
# TODO: remove OrderedDict bc normal dicts are ordered now
|
||||
class TrackMetadata:
|
||||
"""Contains all of the metadata needed to tag the file.
|
||||
|
||||
|
@ -50,7 +49,6 @@ class TrackMetadata:
|
|||
* disctotal
|
||||
"""
|
||||
|
||||
title: str
|
||||
albumartist: str
|
||||
composer: Optional[str] = None
|
||||
albumcomposer: Optional[str] = None
|
||||
|
@ -82,6 +80,7 @@ class TrackMetadata:
|
|||
_artist: Optional[str] = None
|
||||
_copyright: Optional[str] = None
|
||||
_genres: Optional[Iterable] = None
|
||||
_title: Optional[str]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -286,6 +285,24 @@ class TrackMetadata:
|
|||
self.bit_depth = 24 if self.get("quality") == 3 else 16
|
||||
self.sampling_rate = 44100
|
||||
|
||||
@property
|
||||
def title(self) -> Optional[str]:
|
||||
logger.debug("accessign title")
|
||||
if not hasattr(self, "_title"):
|
||||
logger.debug("no title")
|
||||
return None
|
||||
|
||||
if self.explicit:
|
||||
logger.debug("explicit title")
|
||||
return f"{self._title} (Explicit)"
|
||||
|
||||
logger.debug("non explicit title")
|
||||
return self._title
|
||||
|
||||
@title.setter
|
||||
def title(self, new_title):
|
||||
self._title = new_title
|
||||
|
||||
@property
|
||||
def album(self) -> str:
|
||||
"""Return the album of the track.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue