Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search: exclude "Single"/"EP" text from album artist list #698

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions tests/mixins/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from ytmusicapi import YTMusic
from ytmusicapi.exceptions import YTMusicUserError
from ytmusicapi.parsers.search import ALL_RESULT_TYPES
from ytmusicapi.parsers.search import ALL_RESULT_TYPES, API_RESULT_TYPES


class TestSearch:
Expand All @@ -22,12 +22,41 @@ def test_search_queries(self, query: str, yt_instance: str, request: pytest.Fixt
assert ["resultType" in r for r in results] == [True] * len(results)
assert len(results) >= 5
assert not any(
artist["name"].lower() in ALL_RESULT_TYPES
artist["name"].lower() in API_RESULT_TYPES
for result in results
if "artists" in result
for artist in result["artists"]
)

@pytest.mark.parametrize(
"case",
[
(
"Eminem Houdini",
{
"title": "Houdini",
"artists": [{"name": "Eminem", "id": "UCedvOgsKFzcK3hA5taf3KoQ"}],
"type": "Single",
"resultType": "album",
},
),
(
"Seven Martin Garrix",
{
"title": "Seven",
"artists": [{"name": "Martin Garrix", "id": "UCqJnSdHjKtfsrHi9aI-9d3g"}],
"type": "EP",
"resultType": "album",
},
),
],
)
def test_search_album_artists(self, yt, case: tuple[str, dict]):
(query, expected) = case
results = yt.search(query, filter="albums")

assert any(result == result | expected for result in results)

def test_search_ignore_spelling(self, yt_auth):
results = yt_auth.search("Martin Stig Andersen - Deteriation", ignore_spelling=True)
assert len(results) > 0
Expand Down
Binary file modified ytmusicapi/locales/ar/LC_MESSAGES/base.mo
Binary file not shown.
40 changes: 26 additions & 14 deletions ytmusicapi/locales/ar/LC_MESSAGES/base.po
Original file line number Diff line number Diff line change
Expand Up @@ -18,65 +18,77 @@ msgstr ""
"X-Generator: Poedit 3.2.2\n"

#: parsers/i18n.py:32
msgid "album"
msgstr "ألبوم"

#: parsers/i18n.py:33
msgid "artist"
msgstr "فنان"

#: parsers/i18n.py:33
#: parsers/i18n.py:34
msgid "playlist"
msgstr "قائمةالتشغيل"

#: parsers/i18n.py:34
#: parsers/i18n.py:35
msgid "song"
msgstr "أغنية"

#: parsers/i18n.py:35
#: parsers/i18n.py:36
msgid "video"
msgstr "فيديو"

#: parsers/i18n.py:36
#: parsers/i18n.py:37
msgid "station"
msgstr "محطة"

#: parsers/i18n.py:37
#: parsers/i18n.py:38
msgid "profile"
msgstr "الملف الشخصي"

#: parsers/i18n.py:38
#: parsers/i18n.py:39
msgid "podcast"
msgstr "بودكاست"

#: parsers/i18n.py:39
#: parsers/i18n.py:40
msgid "episode"
msgstr "حلقة"

#: parsers/i18n.py:46
msgid "single"
msgstr "أغنية منفردة"

#: parsers/i18n.py:47
msgid "ep"
msgstr "ألبوم قصير"

#: parsers/i18n.py:55
msgid "albums"
msgstr "ألبومات"

#: parsers/i18n.py:47
#: parsers/i18n.py:56
msgid "singles"
msgstr "الفردي"

#: parsers/i18n.py:48
#: parsers/i18n.py:57
msgid "shows"
msgstr "الكتب المسموعة والعروض"

#: parsers/i18n.py:49
#: parsers/i18n.py:58
msgid "videos"
msgstr "أشرطة فيديو"

#: parsers/i18n.py:50
#: parsers/i18n.py:59
msgid "playlists"
msgstr "قوائم التشغيل"

#: parsers/i18n.py:51
#: parsers/i18n.py:60
msgid "related"
msgstr "ذات صلة"

#: parsers/i18n.py:52
#: parsers/i18n.py:61
msgid "episodes"
msgstr "أحدث الحلقات"

#: parsers/i18n.py:53
#: parsers/i18n.py:62
msgid "podcasts"
msgstr "بودكاست"
40 changes: 26 additions & 14 deletions ytmusicapi/locales/base.pot
Original file line number Diff line number Diff line change
Expand Up @@ -18,65 +18,77 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"

#: parsers/i18n.py:32
msgid "artist"
msgid "album"
msgstr ""

#: parsers/i18n.py:33
msgid "playlist"
msgid "artist"
msgstr ""

#: parsers/i18n.py:34
msgid "song"
msgid "playlist"
msgstr ""

#: parsers/i18n.py:35
msgid "video"
msgid "song"
msgstr ""

#: parsers/i18n.py:36
msgid "station"
msgid "video"
msgstr ""

#: parsers/i18n.py:37
msgid "profile"
msgid "station"
msgstr ""

#: parsers/i18n.py:38
msgid "podcast"
msgid "profile"
msgstr ""

#: parsers/i18n.py:39
msgid "podcast"
msgstr ""

#: parsers/i18n.py:40
msgid "episode"
msgstr ""

#: parsers/i18n.py:46
msgid "albums"
msgid "single"
msgstr ""

#: parsers/i18n.py:47
msgid "ep"
msgstr ""

#: parsers/i18n.py:55
msgid "albums"
msgstr ""

#: parsers/i18n.py:56
msgid "singles"
msgstr ""

#: parsers/i18n.py:48
#: parsers/i18n.py:57
msgid "shows"
msgstr ""

#: parsers/i18n.py:49
#: parsers/i18n.py:58
msgid "videos"
msgstr ""

#: parsers/i18n.py:50
#: parsers/i18n.py:59
msgid "playlists"
msgstr ""

#: parsers/i18n.py:51
#: parsers/i18n.py:60
msgid "related"
msgstr ""

#: parsers/i18n.py:52
#: parsers/i18n.py:61
msgid "episodes"
msgstr ""

#: parsers/i18n.py:53
#: parsers/i18n.py:62
msgid "podcasts"
msgstr ""
Binary file modified ytmusicapi/locales/de/LC_MESSAGES/base.mo
Binary file not shown.
40 changes: 26 additions & 14 deletions ytmusicapi/locales/de/LC_MESSAGES/base.po
Original file line number Diff line number Diff line change
Expand Up @@ -18,65 +18,77 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"

#: parsers/i18n.py:32
msgid "album"
msgstr "album"

#: parsers/i18n.py:33
msgid "artist"
msgstr "künstler"

#: parsers/i18n.py:33
#: parsers/i18n.py:34
msgid "playlist"
msgstr "playlist"

#: parsers/i18n.py:34
#: parsers/i18n.py:35
msgid "song"
msgstr "titel"

#: parsers/i18n.py:35
#: parsers/i18n.py:36
msgid "video"
msgstr "video"

#: parsers/i18n.py:36
#: parsers/i18n.py:37
msgid "station"
msgstr "sender"

#: parsers/i18n.py:37
#: parsers/i18n.py:38
msgid "profile"
msgstr "profil"

#: parsers/i18n.py:38
#: parsers/i18n.py:39
msgid "podcast"
msgstr ""

#: parsers/i18n.py:39
#: parsers/i18n.py:40
msgid "episode"
msgstr "Folge"

#: parsers/i18n.py:46
msgid "single"
msgstr "single"

#: parsers/i18n.py:47
msgid "ep"
msgstr "ep"

#: parsers/i18n.py:55
msgid "albums"
msgstr "alben"

#: parsers/i18n.py:47
#: parsers/i18n.py:56
msgid "singles"
msgstr "singles"

#: parsers/i18n.py:48
#: parsers/i18n.py:57
msgid "shows"
msgstr "Hörbücher und Serien"

#: parsers/i18n.py:49
#: parsers/i18n.py:58
msgid "videos"
msgstr "videos"

#: parsers/i18n.py:50
#: parsers/i18n.py:59
msgid "playlists"
msgstr "playlists"

#: parsers/i18n.py:51
#: parsers/i18n.py:60
msgid "related"
msgstr "das könnte fans auch gefallen"

#: parsers/i18n.py:52
#: parsers/i18n.py:61
msgid "episodes"
msgstr "neueste folgen"

#: parsers/i18n.py:53
#: parsers/i18n.py:62
msgid "podcasts"
msgstr "podcasts"
Binary file modified ytmusicapi/locales/en/LC_MESSAGES/base.mo
Binary file not shown.
Loading
Loading