mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-25 04:24:49 -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."""
|
"""Manages the information that will be embeded in the audio file."""
|
||||||
from . import util
|
from . import util
|
||||||
from .album_metadata import AlbumMetadata
|
from .album import AlbumInfo, AlbumMetadata
|
||||||
from .artist_metadata import ArtistMetadata
|
from .artist import ArtistMetadata
|
||||||
from .covers import Covers
|
from .covers import Covers
|
||||||
from .label_metadata import LabelMetadata
|
from .label import LabelMetadata
|
||||||
from .playlist_metadata import PlaylistMetadata
|
from .playlist import PlaylistMetadata
|
||||||
from .search_results import (
|
from .search_results import (
|
||||||
AlbumSummary,
|
AlbumSummary,
|
||||||
ArtistSummary,
|
ArtistSummary,
|
||||||
|
@ -15,11 +15,13 @@ from .search_results import (
|
||||||
TrackSummary,
|
TrackSummary,
|
||||||
)
|
)
|
||||||
from .tagger import tag_file
|
from .tagger import tag_file
|
||||||
from .track_metadata import TrackMetadata
|
from .track import TrackInfo, TrackMetadata
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"AlbumMetadata",
|
"AlbumMetadata",
|
||||||
"ArtistMetadata",
|
"ArtistMetadata",
|
||||||
|
"AlbumInfo",
|
||||||
|
"TrackInfo",
|
||||||
"LabelMetadata",
|
"LabelMetadata",
|
||||||
"TrackMetadata",
|
"TrackMetadata",
|
||||||
"PlaylistMetadata",
|
"PlaylistMetadata",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import logging
|
import logging
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from .album_metadata import AlbumMetadata
|
from .album import AlbumMetadata
|
||||||
from .track_metadata import TrackMetadata
|
from .track import TrackMetadata
|
||||||
from .util import typed
|
from .util import typed
|
||||||
|
|
||||||
NON_STREAMABLE = "_non_streamable"
|
NON_STREAMABLE = "_non_streamable"
|
|
@ -12,7 +12,7 @@ from mutagen.id3 import (
|
||||||
)
|
)
|
||||||
from mutagen.mp4 import MP4, MP4Cover
|
from mutagen.mp4 import MP4, MP4Cover
|
||||||
|
|
||||||
from .track_metadata import TrackMetadata
|
from .track import TrackMetadata
|
||||||
|
|
||||||
logger = logging.getLogger("streamrip")
|
logger = logging.getLogger("streamrip")
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from .album_metadata import AlbumMetadata
|
from .album import AlbumMetadata
|
||||||
from .util import safe_get, typed
|
from .util import safe_get, typed
|
||||||
|
|
||||||
logger = logging.getLogger("streamrip")
|
logger = logging.getLogger("streamrip")
|
Binary file not shown.
|
@ -1,14 +1,13 @@
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from util import afor, arun
|
from util import arun
|
||||||
|
|
||||||
from streamrip.config import Config
|
|
||||||
from streamrip.client.downloadable import BasicDownloadable
|
from streamrip.client.downloadable import BasicDownloadable
|
||||||
from streamrip.exceptions import MissingCredentialsError
|
|
||||||
from streamrip.client.qobuz import QobuzClient
|
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")
|
logger = logging.getLogger("streamrip")
|
||||||
|
|
||||||
|
@ -24,6 +23,9 @@ def test_client_raises_missing_credentials():
|
||||||
arun(QobuzClient(c).login())
|
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):
|
def test_client_get_metadata(client):
|
||||||
meta = arun(client.get_metadata("s9nzkwg2rh1nc", "album"))
|
meta = arun(client.get_metadata("s9nzkwg2rh1nc", "album"))
|
||||||
assert meta["title"] == "I Killed Your Dog"
|
assert meta["title"] == "I Killed Your Dog"
|
||||||
|
@ -31,6 +33,9 @@ def test_client_get_metadata(client):
|
||||||
assert meta["maximum_bit_depth"] == 24
|
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):
|
def test_client_get_downloadable(client):
|
||||||
d = arun(client.get_downloadable("19512574", 3))
|
d = arun(client.get_downloadable("19512574", 3))
|
||||||
assert isinstance(d, BasicDownloadable)
|
assert isinstance(d, BasicDownloadable)
|
||||||
|
@ -39,6 +44,9 @@ def test_client_get_downloadable(client):
|
||||||
assert "https://" in d.url
|
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):
|
def test_client_search_limit(client):
|
||||||
res = client.search("album", "rumours", limit=5)
|
res = client.search("album", "rumours", limit=5)
|
||||||
total = 0
|
total = 0
|
||||||
|
@ -47,6 +55,9 @@ def test_client_search_limit(client):
|
||||||
assert total == 5
|
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):
|
def test_client_search_no_limit(client):
|
||||||
# Setting no limit has become impossible because `limit: int` now
|
# Setting no limit has become impossible because `limit: int` now
|
||||||
res = client.search("album", "rumours", limit=10000)
|
res = client.search("album", "rumours", limit=10000)
|
||||||
|
|
|
@ -3,9 +3,6 @@ from mutagen.flac import FLAC
|
||||||
from util import arun
|
from util import arun
|
||||||
|
|
||||||
from streamrip.metadata import *
|
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_flac = "tests/silence.flac"
|
||||||
test_cover = "tests/1x1_pixel.jpg"
|
test_cover = "tests/1x1_pixel.jpg"
|
||||||
|
|
|
@ -1,18 +1,26 @@
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
import pytest
|
||||||
from util import arun
|
from util import arun
|
||||||
|
|
||||||
|
import streamrip.db as db
|
||||||
from streamrip.client.downloadable import Downloadable
|
from streamrip.client.downloadable import Downloadable
|
||||||
from streamrip.client.qobuz import QobuzClient
|
from streamrip.client.qobuz import QobuzClient
|
||||||
from streamrip.media.track import PendingSingle, Track
|
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):
|
def test_pending_resolve(qobuz_client: QobuzClient):
|
||||||
qobuz_client.config.session.downloads.folder = "./tests"
|
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())
|
t = arun(p.resolve())
|
||||||
dir = "tests/tests/Fleetwood Mac - Rumours (1977) [FLAC] [24B-96kHz]"
|
dir = "tests/tests/Fleetwood Mac - Rumours (1977) [FLAC] [24B-96kHz]"
|
||||||
assert os.path.isdir(dir)
|
assert os.path.isdir(dir)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue