Skip to content

Spotify plugin unable to find Chinese/Japanese albums #5699

@Pahina0

Description

@Pahina0

Using the Spotify plugin, it is unable to correctly search for albums & artists with Chinese/Japanese characters as its being converted to Ascii before the search. Resulting in 0 results from spotify.

Searches instead should keep the characters as the original (like how MusicBrainz works) so Spotify can return the correct results as spotify doesn't support searching with Pinyin/Romaji

Problem

With a folder containing songs from 盗作 - ヨルシカ (or any album/artist using Chinese characters)

Running this command in verbose (-vv) mode:

$ beet -vv import . -t

Led to this problem:

spotify: Searching Spotify for 'album:Dao Zuo  artist:yorushika'
spotify: Found 0 result(s) from Spotify for 'album:Dao Zuo  artist:yorushika'

The album name is getting converted to ascii when searched, resulting in 0 results.
In this case, 盗作 -> Dao Zuo

The album it should be finding:
https://open.spotify.com/album/6pZ0SrZCP8Bm28L6JhMtBy?si=X2sNSW5oTAGuJBNaVCAD0w

Setup

  • OS: Arch Linux
  • Python version: 3.13.2
  • beets version: 2.2.0

My configuration (output of beet config) is:

directory: ~/Music

plugins:
    - embedart
    - fetchart
    - lyrics
    - lastgenre
    - spotify
    - scrub

import:
    move: yes


spotify:
    source_weight: 0.0
    mode: open
    show_failures: on

This is most likely due to unidecode.unidecode(query) which converts all characters into ascii prior to the search.

beets/beetsplug/spotify.py

Lines 399 to 407 in 030fd1f

query_components = [
keywords,
" ".join(":".join((k, v)) for k, v in filters.items()),
]
query = " ".join([q for q in query_components if q])
if not isinstance(query, str):
query = query.decode("utf8")
return unidecode.unidecode(query)

Activity

semohr

semohr commented on Apr 2, 2025

@semohr
Contributor

You are correct, I think something like quote should be used instead. Although, request.get should quote strings correctly. Converting from ascii does not really make sense for url params, imo.

added
bugbugs that are confirmed and actionable
on Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbugs that are confirmed and actionable

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @wisp3rwind@semohr@Pahina0

      Issue actions

        Spotify plugin unable to find Chinese/Japanese albums · Issue #5699 · beetbox/beets