Make file names shorter in metadata module (#519)

* Rename files in metadata module

* Fix tests
This commit is contained in:
Nathan Thomas 2023-12-27 14:40:51 -08:00 committed by GitHub
parent d1b5bd2958
commit 7b59e623ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 43 additions and 22 deletions

Binary file not shown.

View file

@ -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)

View file

@ -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"

View file

@ -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)