mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-24 20:14:42 -04:00
Make file names shorter in metadata module (#519)
* Rename files in metadata module * Fix tests
This commit is contained in:
parent
d1b5bd2958
commit
7b59e623ff
12 changed files with 43 additions and 22 deletions
|
@ -1 +1,4 @@
|
|||
from . import converter, db, exceptions, media, metadata
|
||||
from .config import Config
|
||||
|
||||
__all__ = ["Config", "media", "metadata", "converter", "db", "exceptions"]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""Manages the information that will be embeded in the audio file."""
|
||||
from . import util
|
||||
from .album_metadata import AlbumMetadata
|
||||
from .artist_metadata import ArtistMetadata
|
||||
from .album import AlbumInfo, AlbumMetadata
|
||||
from .artist import ArtistMetadata
|
||||
from .covers import Covers
|
||||
from .label_metadata import LabelMetadata
|
||||
from .playlist_metadata import PlaylistMetadata
|
||||
from .label import LabelMetadata
|
||||
from .playlist import PlaylistMetadata
|
||||
from .search_results import (
|
||||
AlbumSummary,
|
||||
ArtistSummary,
|
||||
|
@ -15,11 +15,13 @@ from .search_results import (
|
|||
TrackSummary,
|
||||
)
|
||||
from .tagger import tag_file
|
||||
from .track_metadata import TrackMetadata
|
||||
from .track import TrackInfo, TrackMetadata
|
||||
|
||||
__all__ = [
|
||||
"AlbumMetadata",
|
||||
"ArtistMetadata",
|
||||
"AlbumInfo",
|
||||
"TrackInfo",
|
||||
"LabelMetadata",
|
||||
"TrackMetadata",
|
||||
"PlaylistMetadata",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import logging
|
||||
from dataclasses import dataclass
|
||||
|
||||
from .album_metadata import AlbumMetadata
|
||||
from .track_metadata import TrackMetadata
|
||||
from .album import AlbumMetadata
|
||||
from .track import TrackMetadata
|
||||
from .util import typed
|
||||
|
||||
NON_STREAMABLE = "_non_streamable"
|
|
@ -12,7 +12,7 @@ from mutagen.id3 import (
|
|||
)
|
||||
from mutagen.mp4 import MP4, MP4Cover
|
||||
|
||||
from .track_metadata import TrackMetadata
|
||||
from .track import TrackMetadata
|
||||
|
||||
logger = logging.getLogger("streamrip")
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
from .album_metadata import AlbumMetadata
|
||||
from .album import AlbumMetadata
|
||||
from .util import safe_get, typed
|
||||
|
||||
logger = logging.getLogger("streamrip")
|
Binary file not shown.
|
@ -1,14 +1,13 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
import pytest
|
||||
from util import afor, arun
|
||||
from util import arun
|
||||
|
||||
from streamrip.config import Config
|
||||
from streamrip.client.downloadable import BasicDownloadable
|
||||
from streamrip.exceptions import MissingCredentialsError
|
||||
from streamrip.client.qobuz import QobuzClient
|
||||
from fixtures.clients import qobuz_client
|
||||
|
||||
from streamrip.config import Config
|
||||
from streamrip.exceptions import MissingCredentialsError
|
||||
|
||||
logger = logging.getLogger("streamrip")
|
||||
|
||||
|
@ -24,6 +23,9 @@ def test_client_raises_missing_credentials():
|
|||
arun(QobuzClient(c).login())
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
"QOBUZ_EMAIL" not in os.environ, reason="Qobuz credentials not found in env."
|
||||
)
|
||||
def test_client_get_metadata(client):
|
||||
meta = arun(client.get_metadata("s9nzkwg2rh1nc", "album"))
|
||||
assert meta["title"] == "I Killed Your Dog"
|
||||
|
@ -31,6 +33,9 @@ def test_client_get_metadata(client):
|
|||
assert meta["maximum_bit_depth"] == 24
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
"QOBUZ_EMAIL" not in os.environ, reason="Qobuz credentials not found in env."
|
||||
)
|
||||
def test_client_get_downloadable(client):
|
||||
d = arun(client.get_downloadable("19512574", 3))
|
||||
assert isinstance(d, BasicDownloadable)
|
||||
|
@ -39,6 +44,9 @@ def test_client_get_downloadable(client):
|
|||
assert "https://" in d.url
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
"QOBUZ_EMAIL" not in os.environ, reason="Qobuz credentials not found in env."
|
||||
)
|
||||
def test_client_search_limit(client):
|
||||
res = client.search("album", "rumours", limit=5)
|
||||
total = 0
|
||||
|
@ -47,6 +55,9 @@ def test_client_search_limit(client):
|
|||
assert total == 5
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
"QOBUZ_EMAIL" not in os.environ, reason="Qobuz credentials not found in env."
|
||||
)
|
||||
def test_client_search_no_limit(client):
|
||||
# Setting no limit has become impossible because `limit: int` now
|
||||
res = client.search("album", "rumours", limit=10000)
|
||||
|
|
|
@ -3,9 +3,6 @@ from mutagen.flac import FLAC
|
|||
from util import arun
|
||||
|
||||
from streamrip.metadata import *
|
||||
from streamrip.metadata.tagger import tag_file
|
||||
from streamrip.metadata.track_metadata import TrackInfo
|
||||
from streamrip.metadata.album_metadata import AlbumInfo
|
||||
|
||||
test_flac = "tests/silence.flac"
|
||||
test_cover = "tests/1x1_pixel.jpg"
|
||||
|
|
|
@ -1,24 +1,32 @@
|
|||
import os
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
from util import arun
|
||||
|
||||
import streamrip.db as db
|
||||
from streamrip.client.downloadable import Downloadable
|
||||
from streamrip.client.qobuz import QobuzClient
|
||||
from streamrip.media.track import PendingSingle, Track
|
||||
import streamrip.db as db
|
||||
from fixtures.clients import qobuz_client
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
"QOBUZ_EMAIL" not in os.environ, reason="Qobuz credentials not found in env."
|
||||
)
|
||||
def test_pending_resolve(qobuz_client: QobuzClient):
|
||||
qobuz_client.config.session.downloads.folder = "./tests"
|
||||
p = PendingSingle("19512574", qobuz_client, qobuz_client.config, db.Database(db.Dummy(), db.Dummy()))
|
||||
p = PendingSingle(
|
||||
"19512574",
|
||||
qobuz_client,
|
||||
qobuz_client.config,
|
||||
db.Database(db.Dummy(), db.Dummy()),
|
||||
)
|
||||
t = arun(p.resolve())
|
||||
dir = "tests/tests/Fleetwood Mac - Rumours (1977) [FLAC] [24B-96kHz]"
|
||||
assert os.path.isdir(dir)
|
||||
assert os.path.isfile(os.path.join(dir, "cover.jpg"))
|
||||
#embedded_cover_path aka t.cover_path is
|
||||
#./tests/./tests/Fleetwood Mac - Rumours (1977) [FLAC] [24B-96kHz]/
|
||||
# embedded_cover_path aka t.cover_path is
|
||||
# ./tests/./tests/Fleetwood Mac - Rumours (1977) [FLAC] [24B-96kHz]/
|
||||
# __artwork/cover-9202762427033526105.jpg
|
||||
assert os.path.isfile(t.cover_path)
|
||||
assert isinstance(t, Track)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue