natumbri / mopidy-youtube

Mopidy extension for playing music from YouTube
Apache License 2.0
257 stars 75 forks source link

Unknown config key for dl_package. #227

Closed blueyshark closed 2 years ago

blueyshark commented 2 years ago

Hi there, having trouble getting the YT extension running. I have installed the latest extension version, mopidy and yt-dlp packages. My etc/mopidy/mopidy.conf entry for YT looks like this currently:

[youtube] enabled = true youtube_dl_package = yt-dlp youtube_api_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX api_enabled = true

I have tried variations with both a hyphen, a long dash, and an underscore with the "yt-dlp" entry, but I get this every time when I use sudo journalctl -u mopidy

May 22 15:50:28 SONYPI01 mopidy[488]: WARNING [MainThread] mopidy.main Found youtube configuration errors. The extension has been automatically disabled: May 22 15:50:28 SONYPI01 mopidy[488]: WARNING [MainThread] mopidy.main youtube/youtube_dl_package unknown config key. May 22 15:50:28 SONYPI01 mopidy[488]: WARNING [MainThread] mopidy.main Please fix the extension configuration errors or disable the extensions to silence these messages.

What am I doing wrong? I appreciate all the work going into this extension, and I wish I could use it! Cheers all T

natumbri commented 2 years ago
youtube_dl_package = yt_dlp

It's fussy about - vs _. I should probably improve the error message.

Cheers Nik

blueyshark commented 2 years ago

Hi @natumbri unfortunately I'm still getting the same error - which leads me to believe maybe I'm doing something wrong in the configuration elsewhere?

[youtube] enabled = true youtube_dl_package = yt_dlp youtube_api_key = XXXXXXXXXXXX api_enabled = true

and sudo journalctl -u mopidy output in full

May 22 23:25:48 SONYPI01 mopidy[531]: INFO [MainThread] mopidy.main Starting Mopidy 3.2.0 May 22 23:25:48 SONYPI01 mopidy[531]: INFO [MainThread] mopidy.config Loading config from builtin defaults May 22 23:25:48 SONYPI01 mopidy[531]: INFO [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy.conf May 22 23:25:48 SONYPI01 mopidy[531]: INFO [MainThread] mopidy.config Loading config from file:///etc/mopidy/mopidy.conf May 22 23:25:48 SONYPI01 mopidy[531]: INFO [MainThread] mopidy.config Loading config from command line options May 22 23:25:48 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.config Ignoring config section 'mopidy-autoplay' because no matching extension was found May 22 23:25:50 SONYPI01 mopidy[531]: INFO [MainThread] mopidy.main Enabled extensions: musicbox_webclient, mpd, file, m3u, http, stream, mixcloud, softwaremixer, pidi May 22 23:25:50 SONYPI01 mopidy[531]: INFO [MainThread] mopidy.main Disabled extensions: spotify, soundcloud, raspberry-gpio, youtube May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main Found soundcloud configuration errors. The extension has been automatically disabled: May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main soundcloud/auth_token must be set. May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main Found spotify configuration errors. The extension has been automatically disabled: May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main spotify/username must be set. May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main spotify/password must be set. May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main spotify/client_id must be set. May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main spotify/client_secret must be set. May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main spotify/enables unknown config key. Did you mean 'enabled'? May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main Found youtube configuration errors. The extension has been automatically disabled: May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main youtube/youtube_dl_package unknown config key. May 22 23:25:50 SONYPI01 mopidy[531]: WARNING [MainThread] mopidy.main Please fix the extension configuration errors or disable the extensions to silence these messages.

Any ideas? Thanks for any assistance!

natumbri commented 2 years ago

That seems strange. Have you tried just the default config?

[youtube]
enabled = true
blueyshark commented 2 years ago

Hi @natumbri So I tried the default config as you suggested - which made some progress, and the extension now loads:

May 28 19:01:56 SONYPI01 mopidy[491]: INFO [MainThread] mopidy.commands Starting Mopidy backends: YouTubeBackend, MopidyMixcloud, FileBackend, M3UBackend, StreamBackend May 28 19:01:56 SONYPI01 mopidy[491]: INFO [YouTubeBackend-3] mopidy_youtube using bs4API

So that's good. But I've now run into another issue - any searches, or browsing, produces zero results. Just a No tracks found... message.

I see that some users are pointing to consent cookies? Might this be an issue? Unfortunately compiling in python is a little above my dilletant level of coding... Thanks again for your patience!

natumbri commented 2 years ago

@blueyshark looks like you have an old version of mopidy-youtube. How did you install it?

blueyshark commented 2 years ago

@natumbri Hello again, thanks so much for the help, I really appreciate it. Here's how I update and the output:

pi@SONYPI01:~ $ python3 -m pip install Mopidy-Youtube Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: Mopidy-Youtube in ./.local/lib/python3.7/site-packages (3.5) Requirement already satisfied: Mopidy>=3.1 in /usr/lib/python3/dist-packages (from Mopidy-Youtube) (3.2.0) Requirement already satisfied: requests in ./.local/lib/python3.7/site-packages (from Mopidy-Youtube) (2.27.1) Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.7/dist-packages (from Mopidy-Youtube) (4.9.3) Requirement already satisfied: cachetools in /usr/local/lib/python3.7/dist-packages (from Mopidy-Youtube) (4.2.1) Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from Mopidy-Youtube) (40.8.0) Requirement already satisfied: Pykka>=2.0.1 in /usr/lib/python3/dist-packages (from Mopidy-Youtube) (2.0.3) Requirement already satisfied: charset-normalizer~=2.0.0; python_version >= "3" in ./.local/lib/python3.7/site-packages (from requests->Mopidy-Youtube) (2.0.12) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests->Mopidy-Youtube) (1.24.1) Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests->Mopidy-Youtube) (2018.8.24) Requirement already satisfied: idna<4,>=2.5; python_version >= "3" in /usr/lib/python3/dist-packages (from requests->Mopidy-Youtube) (2.6) Requirement already satisfied: soupsieve>1.2; python_version >= "3.0" in /usr/local/lib/python3.7/dist-packages (from beautifulsoup4->Mopidy-Youtube) (2.2)

natumbri commented 2 years ago

Looks like the current version of mopidy-youtube is installed in ./.local/lib/python3.7/site-packages. Is there any chance that an older version is also installed in /usr/lib/python3/dist-packages (where mopidy is installed) or /usr/local/lib/python3.7/dist-packages or similar?

Perhaps you originally installed mopidy-youtube using sudo?

blueyshark commented 2 years ago

Hi @natumbri

I tried the sudo approach too

pi@SONYPI01:~ $ sudo python3 -m pip install Mopidy-Youtube Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: Mopidy-Youtube in /usr/local/lib/python3.7/dist-packages (3.2) Requirement already satisfied: Mopidy>=3.1 in /usr/lib/python3/dist-packages (from Mopidy-Youtube) (3.2.0) Requirement already satisfied: Pykka>=2.0.1 in /usr/lib/python3/dist-packages (from Mopidy-Youtube) (2.0.3) Requirement already satisfied: cachetools in /usr/local/lib/python3.7/dist-packages (from Mopidy-Youtube) (4.2.1) Requirement already satisfied: youtube-dl>=2020.12.22 in /usr/local/lib/python3.7/dist-packages (from Mopidy-Youtube) (2021.4.17) Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from Mopidy-Youtube) (2.21.0) Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.7/dist-packages (from Mopidy-Youtube) (4.9.3) Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from Mopidy-Youtube) (40.8.0) Requirement already satisfied: soupsieve>1.2; python_version >= "3.0" in /usr/local/lib/python3.7/dist-packages (from beautifulsoup4->Mopidy-Youtube) (2.2)

natumbri commented 2 years ago

Your problem is that the one in /usr/local/lib/python3.7/dist-packages is version 3.2

sudo python3 -m pip install -U Mopidy-Youtube should fix it. (Or break it worse šŸ™ƒ)

blueyshark commented 2 years ago

Hi @natumbri Looks like it is totally wrecked šŸ˜‚

May 30 12:50:17 SONYPI01 mopidy[539]: ERROR [MainThread] mopidy.main Extension youtube failed during setup. This might have left the registry in a bad state. May 30 12:50:17 SONYPI01 mopidy[539]: Traceback (most recent call last): May 30 12:50:17 SONYPI01 mopidy[539]: File "/usr/lib/python3/dist-packages/mopidy/main.py", line 129, in main May 30 12:50:17 SONYPI01 mopidy[539]: extension.setup(registry) May 30 12:50:17 SONYPI01 mopidy[539]: File "/usr/local/lib/python3.7/dist-packages/mopidy_youtube/init.py", line 39, in setup May 30 12:50:17 SONYPI01 mopidy[539]: from .backend import YouTubeBackend, YouTubeCoreListener May 30 12:50:17 SONYPI01 mopidy[539]: File "/usr/local/lib/python3.7/dist-packages/mopidy_youtube/backend.py", line 10, in May 30 12:50:17 SONYPI01 mopidy[539]: from mopidy_youtube.apis import youtube_api, youtube_japi, youtube_music May 30 12:50:17 SONYPI01 mopidy[539]: File "/usr/local/lib/python3.7/dist-packages/mopidy_youtube/apis/youtube_music.py", line 7, in May 30 12:50:17 SONYPI01 mopidy[539]: from ytmusicapi import YTMusic May 30 12:50:17 SONYPI01 mopidy[539]: ModuleNotFoundError: No module named 'ytmusicapi'

natumbri commented 2 years ago

Nope - you're now on the right track. Install the ytmusicapi module and you'll be in business.

sudo python3 -m pip install -U ytmusicapi

That include is a bug that I haven't tidied up yet.

blueyshark commented 2 years ago

This all worked PERFECTLY.

So was the issue down to user/permissions? Should I always install using sudo when using Mopidy (it's the only thing running on this particular Pi, well that and Syncthing)

natumbri commented 2 years ago

Glad it is working for you.

I think, typically, something like mopidy (and it's extensions) should be installed as root, which results in it being available to all users, including system processes and users. I guess if you were sharing a machine, or you didn't have root access, it might make sense to install it in a particular user's local library.

Best of luck, and thanks for persisting. Feel free to provide feedback as you use the extension.