Closed dgspeedyz closed 1 year ago
I have not used mopidy-pidi before so I cannot say if it is possible to show custom messages, such as the tidal login prompt.
But normally, you only have to do this login process once, unless you want to change your user account or if you have upgraded mopidy-tidal.
It would be nice, if the message could be displayed elsewhere - such as through the web frontend or similar. As far as I know there is no universal way to display messages through mopidy, so this feature would need to be added in both mopidy-tidal and each plugin.
I am willing to test! I can read code just can't make it from scratch. All it does is send SPI info to the screen that's 240x240 resolution while pulling the music info/album art from the web.
The main issue is when the login prompt is waiting for authentication. While that happens, Mopidy doesn't load the web interface. If the user needs to login, they won't be able to. They can't pull up the web interface or know the IP of the machine (unless set to static) until login is complete and the webserver starts.
I have had the extension in the past ask to re-authenticate after several days. I would love to help in any way I can.
Mopidy-Spotify with Iris brings up a login prompt in the settings It loads up a popup for creds. Though I think this is part of Iris.
This is what I use. The screens them selves are cheap. works on both the 1.3" and 1.5" screen https://github.com/pimoroni/mopidy-pidi https://raspberrypi.stackexchange.com/questions/105364/how-to-connect-st7789-lcd-to-raspberry-pi
Here is an image of what it does at startup after Mopidy-Tidal authenticates and after the music starts. its neat if making a small standalone device. It's showing the song playing from Tidal.
@dgspeedyz Thanks for the useful images. I was not aware that logon is so well integrated in Iris UI. Perhaps something similar can be implemented for Mopidy-Tidal so the user can avoid opening the console to logon.
The real issue is how to avoid Mopidy-Tidal blocking while waiting for logon.
@tehkillerbee I'm guessing to run it as a while loop that waits for a second script to register the authentication. If no authentication is made it gives playback/auth errors. If authentication is made, the second script sends the info to the first script that holds the info for the playback duration until reboot.
Treating each part as a separate program/script will help this act as a "login page" of sorts. Send that web page to a display so the user can login from a browser on another device. the Mopidy device can host the webpage that redirects to the Tidal authentication page it generates. All this while the first half sits and waits making Mopidy think everything is working.
@dgspeedyz I agree, this issue is two part:
It really looks like mopidy could use a universal way to display messages to the user, apart from using the console output.
@tehkillerbee I like your idea with a 'login' track. It's a hack ofc but a good one... and pretty much guaranteed to work. I think we can just override PlaybackProvider.change_track
(or .play
) and add some logic to insert a temporary login track if need be. I might have a go at implementing that soon.
@2e0byo I completely forgot about this. Yes, it would be a quick hack to solve a major annoyance with Tidal login, if we can use the track name.
Looking forward to see what you come up with!
Needs cleaning up and tests but I think this is going to work. It's a glorious hack...
That is awesome! And the QR code represents the link as well?
Yes. I got even more carried away though and added text-to-speech to read it out...
I'll clean up and push today.
@2e0byo That is awesome! Really looking forward to test it. :)
@dgspeedyz could you test #116 at some point? You can install directly from git with pip with
pip install git+https://github.com/tehkillerbee/mopidy-tidal.git@refs/pull/116/head
It's prompting me to enter the OAutch Flow but not showing as a playable song name on my side. I can see it print in verbose mode to screen when I'm ssh in from another machine. I just get whats in the screenshot below. I set "lazy = true" to get it to load the web interface. Nothing on the small screen I have. from the images above. This is all running from a fresh install of the OS because upgrading to the test build gave me pip errors. I haven't authorized the device yet with the tidal OAuth link so I can do more testing for you. What are you using to trigger that song title screen so I can manually force it on my end?
What does work though: When it queries Tidal by clicking on say.... "Browse", it immediately generates the "link.tidal.com/XXXXX" screen in the ssh session.
Pi image used: http://davesteele.github.io/comitup/
Here is what the machine is showing me before making the OAuth.json file:
comitup@comitup-671:~ $ mopidy INFO 2023-05-10 02:51:48,031 [929:MainThread] mopidy.main
Starting Mopidy 3.4.1
INFO 2023-05-10 02:51:49,096 [929:MainThread] mopidy.config Loading config from builtin defaults
INFO 2023-05-10 02:51:49,119 [929:MainThread] mopidy.config Loading config from file:///home/comitup/.config/mopidy/mopidy.conf
INFO 2023-05-10 02:51:49,126 [929:MainThread] mopidy.config Loading config from command line options
WARNING 2023-05-10 02:51:49,160 [929:MainThread] mopidy.config Ignoring config section 'spotify' because no matching extension was found
INFO 2023-05-10 02:51:51,512 [929:MainThread] mopidy.main Enabled extensions: iris, softwaremixer, m3u, mpd, http, tidal, pidi, raspberry-gpio, stream, file
INFO 2023-05-10 02:51:51,513 [929:MainThread] mopidy.main Disabled extensions: local
WARNING 2023-05-10 02:51:51,517 [929:MainThread] mopidy.main Found local configuration errors. The extension has been automatically disabled:
WARNING 2023-05-10 02:51:51,519 [929:MainThread] mopidy.main local/media_dir must be set.
WARNING 2023-05-10 02:51:51,520 [929:MainThread] mopidy.main Please fix the extension configuration errors or disable the extensions to silence these messages.
INFO 2023-05-10 02:51:52,436 [929:MainThread] mopidy.commands Starting Mopidy mixer: SoftwareMixer
INFO 2023-05-10 02:51:52,448 [929:MainThread] mopidy.commands Mixer volume set to 40
INFO 2023-05-10 02:51:52,450 [929:MainThread] mopidy.commands Starting Mopidy audio
INFO 2023-05-10 02:51:52,463 [929:MainThread] mopidy.commands Starting Mopidy backends: FileBackend, M3UBackend, StreamBackend, TidalBackend
INFO 2023-05-10 02:51:52,540 [929:Audio-2] mopidy.audio.actor Audio output set to "alsasink device=hw:sndrpihifiberry"
INFO 2023-05-10 02:51:52,620 [929:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... Quality = LOSSLESS
INFO 2023-05-10 02:51:52,632 [929:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... login method BLOCK.
INFO 2023-05-10 02:51:52,644 [929:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... using default client id & client secret from python-tidal
INFO 2023-05-10 02:51:52,660 [929:MainThread] mopidy.commands Starting Mopidy core
INFO 2023-05-10 02:51:52,718 [929:MainThread] mopidy.commands Starting Mopidy frontends: HttpFrontend, PiDiFrontend, RaspberryGPIOFrontend, MpdFrontend, IrisFrontend
INFO 2023-05-10 02:51:52,724 [929:HttpFrontend-9] mopidy.http.actor HTTP server running at [::ffff:0.0.0.0]:6680
INFO 2023-05-10 02:51:52,909 [929:MainThread] mopidy_mpd.actor MPD server running at [::ffff:0.0.0.0]:6600
INFO 2023-05-10 02:51:52,939 [929:IrisFrontend-13] mopidy_iris.core Starting Iris 3.66.1
INFO 2023-05-10 02:51:52,946 [929:MainThread] mopidy.commands Starting GLib mainloop
INFO 2023-05-10 02:52:07,393 [929:TidalBackend-6] mopidy_tidal.library Searching Tidal for images for ['tidal:directory']
INFO 2023-05-10 02:52:07,394 [929:TidalBackend-6] mopidy_tidal.backend Loading OAuth session from /home/comitup/.local/share/mopidy/tidal/tidal-oauth.json...
INFO 2023-05-10 02:52:07,396 [929:TidalBackend-6] mopidy_tidal.backend Could not load OAuth session from /home/comitup/.local/share/mopidy/tidal/tidal-oauth.json: Expecting value: line 1 column 1 (char 0)
INFO 2023-05-10 02:52:07,397 [929:TidalBackend-6] mopidy_tidal.backend Creating new OAuth session...
INFO 2023-05-10 02:52:07,661 [929:TidalBackend-6] mopidy_tidal.backend Visit link.tidal.com/XXXXX to log in, the code will expire in 300 seconds
Here is it after manually making it:
comitup@comitup-671:~ $ mopidy INFO 2023-05-10 02:51:48,031 [929:MainThread] mopidy.main
Starting Mopidy 3.4.1
INFO 2023-05-10 02:51:49,096 [929:MainThread] mopidy.config Loading config from builtin defaults
INFO 2023-05-10 02:51:49,119 [929:MainThread] mopidy.config Loading config from file:///home/comitup/.config/mopidy/mopidy.conf
INFO 2023-05-10 02:51:49,126 [929:MainThread] mopidy.config Loading config from command line options
WARNING 2023-05-10 02:51:49,160 [929:MainThread] mopidy.config Ignoring config section 'spotify' because no matching extension was found
INFO 2023-05-10 02:51:51,512 [929:MainThread] mopidy.main Enabled extensions: iris, softwaremixer, m3u, mpd, http, tidal, pidi, raspberry-gpio, stream, file
INFO 2023-05-10 02:51:51,513 [929:MainThread] mopidy.main Disabled extensions: local
WARNING 2023-05-10 02:51:51,517 [929:MainThread] mopidy.main Found local configuration errors. The extension has been automatically disabled:
WARNING 2023-05-10 02:51:51,519 [929:MainThread] mopidy.main local/media_dir must be set.
WARNING 2023-05-10 02:51:51,520 [929:MainThread] mopidy.main Please fix the extension configuration errors or disable the extensions to silence these messages.
INFO 2023-05-10 02:51:52,436 [929:MainThread] mopidy.commands Starting Mopidy mixer: SoftwareMixer
INFO 2023-05-10 02:51:52,448 [929:MainThread] mopidy.commands Mixer volume set to 40
INFO 2023-05-10 02:51:52,450 [929:MainThread] mopidy.commands Starting Mopidy audio
INFO 2023-05-10 02:51:52,463 [929:MainThread] mopidy.commands Starting Mopidy backends: FileBackend, M3UBackend, StreamBackend, TidalBackend
INFO 2023-05-10 02:51:52,540 [929:Audio-2] mopidy.audio.actor Audio output set to "alsasink device=hw:sndrpihifiberry"
INFO 2023-05-10 02:51:52,620 [929:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... Quality = LOSSLESS
INFO 2023-05-10 02:51:52,632 [929:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... login method BLOCK.
INFO 2023-05-10 02:51:52,644 [929:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... using default client id & client secret from python-tidal
INFO 2023-05-10 02:51:52,660 [929:MainThread] mopidy.commands Starting Mopidy core
INFO 2023-05-10 02:51:52,718 [929:MainThread] mopidy.commands Starting Mopidy frontends: HttpFrontend, PiDiFrontend, RaspberryGPIOFrontend, MpdFrontend, IrisFrontend
INFO 2023-05-10 02:51:52,724 [929:HttpFrontend-9] mopidy.http.actor HTTP server running at [::ffff:0.0.0.0]:6680
INFO 2023-05-10 02:51:52,909 [929:MainThread] mopidy_mpd.actor MPD server running at [::ffff:0.0.0.0]:6600
INFO 2023-05-10 02:51:52,939 [929:IrisFrontend-13] mopidy_iris.core Starting Iris 3.66.1
INFO 2023-05-10 02:51:52,946 [929:MainThread] mopidy.commands Starting GLib mainloop
INFO 2023-05-10 02:52:07,393 [929:TidalBackend-6] mopidy_tidal.library Searching Tidal for images for ['tidal:directory']
INFO 2023-05-10 02:52:07,394 [929:TidalBackend-6] mopidy_tidal.backend Loading OAuth session from /home/comitup/.local/share/mopidy/tidal/tidal-oauth.json...
INFO 2023-05-10 02:52:07,396 [929:TidalBackend-6] mopidy_tidal.backend Could not load OAuth session from /home/comitup/.local/share/mopidy/tidal/tidal-oauth.json: Expecting value: line 1 column 1 (char 0)
INFO 2023-05-10 02:52:07,397 [929:TidalBackend-6] mopidy_tidal.backend Creating new OAuth session...
INFO 2023-05-10 02:52:07,661 [929:TidalBackend-6] mopidy_tidal.backend Visit link.tidal.com/XXXXX to log in, the code will expire in 300 seconds
What I get when clicking anything Tidal related in from within Iris.
Rats sorry I forgot to explain how to use it! You need to add login_method = HACK
(as well as lazy=true
: I should probably make it require lazy mode) to your config file. But you're running the right code as this line is new:
Connecting to TIDAL... login method BLOCK.
This will become 'login method HACK' when you add the line to the config file.
Sorry!
Yup, that did it! NICE!
If I cancel and close out of the program from terminal it hangs next at the mainloop and wont come back until restart of the entire OS. Iris wont even load in the browser at that point until reboot.
Though I only had this issue once and after that reboot it seems to be working fine as well as generating a different key each time I restart tidal. I would call this a success!
After a little Fiddling i final got it to load the song. It took a while though....
clicking play in the drop-down menu on the right:
Only shows when selecting the song onece:
Seems to be a bit inconsistent if trying to get the QR code to load up. I backed out and tried again and it brought me to playback history with the QR code now and the previous login attempts. Now I cant get back to the first screen when just hitting browse. (just gives me a blank screen)
Basic function of getting the login link and clicking on its song title to play it works consistently without issues and gives the QR code.
Text-to-Speach works for its playback
Before reboot when I cant load Iris:
comitup@comitup-671:~ $ mopidy INFO 2023-05-11 01:57:39,932 [874:MainThread] mopidy.main Starting Mopidy 3.4.1
INFO 2023-05-11 01:57:40,974 [874:MainThread] mopidy.config Loading config from builtin defaults
INFO 2023-05-11 01:57:40,998 [874:MainThread] mopidy.config Loading config from file:///home/comitup/.config/mopidy/mopidy.conf
INFO 2023-05-11 01:57:41,005 [874:MainThread] mopidy.config Loading config from command line options
WARNING 2023-05-11 01:57:41,038 [874:MainThread] mopidy.config Ignoring config section 'spotify' because no matching extension was found
INFO 2023-05-11 01:57:43,337 [874:MainThread] mopidy.main Enabled extensions: pidi, file, raspberry-gpio, softwaremixer, http, mpd, iris, tidal, m3u, stream
INFO 2023-05-11 01:57:43,337 [874:MainThread] mopidy.main Disabled extensions: local
WARNING 2023-05-11 01:57:43,338 [874:MainThread] mopidy.main Found local configuration errors. The extension has been automatically disabled:
WARNING 2023-05-11 01:57:43,339 [874:MainThread] mopidy.main local/media_dir must be set.
WARNING 2023-05-11 01:57:43,340 [874:MainThread] mopidy.main Please fix the extension configuration errors or disable the extensions to silence these messages.
INFO 2023-05-11 01:57:44,244 [874:MainThread] mopidy.commands Starting Mopidy mixer: SoftwareMixer
INFO 2023-05-11 01:57:44,255 [874:MainThread] mopidy.commands Mixer volume set to 40
INFO 2023-05-11 01:57:44,257 [874:MainThread] mopidy.commands Starting Mopidy audio
INFO 2023-05-11 01:57:44,270 [874:MainThread] mopidy.commands Starting Mopidy backends: FileBackend, M3UBackend, StreamBackend, TidalBackend
INFO 2023-05-11 01:57:44,351 [874:Audio-2] mopidy.audio.actor Audio output set to "alsasink device=hw:sndrpihifiberry"
INFO 2023-05-11 01:57:44,432 [874:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... Quality = LOSSLESS
INFO 2023-05-11 01:57:44,445 [874:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... login method HACK.
INFO 2023-05-11 01:57:44,456 [874:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... using default client id & client secret from python-tidal
INFO 2023-05-11 01:57:44,473 [874:MainThread] mopidy.commands Starting Mopidy core
INFO 2023-05-11 01:57:44,531 [874:MainThread] mopidy.commands Starting Mopidy frontends: HttpFrontend, PiDiFrontend, RaspberryGPIOFrontend, MpdFrontend, IrisFrontend
ERROR 2023-05-11 01:57:44,535 [874:MainThread] mopidy.commands Frontend (HttpFrontend) initialization error: HTTP server startup failed: [Errno 98] Address already in use
INFO 2023-05-11 01:57:44,556 [874:MainThread] mopidy_mpd.actor MPD server running at [::ffff:0.0.0.0]:6600
INFO 2023-05-11 01:57:44,562 [874:IrisFrontend-11] mopidy_iris.core Starting Iris 3.66.1
INFO 2023-05-11 01:57:44,564 [874:MainThread] mopidy.commands Starting GLib mainloop
After reboot when I can load iris:
comitup@comitup-671:~ $ mopidy INFO 2023-05-11 02:00:14,027 [726:MainThread] mopidy.main Starting Mopidy 3.4.1
INFO 2023-05-11 02:00:15,830 [726:MainThread] mopidy.config Loading config from builtin defaults
INFO 2023-05-11 02:00:15,853 [726:MainThread] mopidy.config Loading config from file:///home/comitup/.config/mopidy/mopidy.conf
INFO 2023-05-11 02:00:15,864 [726:MainThread] mopidy.config Loading config from command line options
WARNING 2023-05-11 02:00:15,907 [726:MainThread] mopidy.config Ignoring config section 'spotify' because no matching extension was found
INFO 2023-05-11 02:00:18,444 [726:MainThread] mopidy.main Enabled extensions: m3u, raspberry-gpio, http, pidi, mpd, softwaremixer, tidal, iris, stream, file
INFO 2023-05-11 02:00:18,445 [726:MainThread] mopidy.main Disabled extensions: local
WARNING 2023-05-11 02:00:18,446 [726:MainThread] mopidy.main Found local configuration errors. The extension has been automatically disabled:
WARNING 2023-05-11 02:00:18,447 [726:MainThread] mopidy.main local/media_dir must be set.
WARNING 2023-05-11 02:00:18,448 [726:MainThread] mopidy.main Please fix the extension configuration errors or disable the extensions to silence these messages.
INFO 2023-05-11 02:00:19,718 [726:MainThread] mopidy.commands Starting Mopidy mixer: SoftwareMixer
INFO 2023-05-11 02:00:19,729 [726:MainThread] mopidy.commands Mixer volume set to 40
INFO 2023-05-11 02:00:19,731 [726:MainThread] mopidy.commands Starting Mopidy audio
INFO 2023-05-11 02:00:19,744 [726:MainThread] mopidy.commands Starting Mopidy backends: FileBackend, M3UBackend, StreamBackend, TidalBackend
INFO 2023-05-11 02:00:19,870 [726:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... Quality = LOSSLESS
INFO 2023-05-11 02:00:19,886 [726:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... login method HACK.
INFO 2023-05-11 02:00:19,907 [726:TidalBackend-6] mopidy_tidal.backend Connecting to TIDAL... using default client id & client secret from python-tidal
INFO 2023-05-11 02:00:19,914 [726:MainThread] mopidy.commands Starting Mopidy core
INFO 2023-05-11 02:00:19,917 [726:Audio-2] mopidy.audio.actor Audio output set to "alsasink device=hw:sndrpihifiberry"
INFO 2023-05-11 02:00:20,002 [726:MainThread] mopidy.commands Starting Mopidy frontends: HttpFrontend, PiDiFrontend, RaspberryGPIOFrontend, MpdFrontend, IrisFrontend
INFO 2023-05-11 02:00:20,008 [726:HttpFrontend-9] mopidy.http.actor HTTP server running at [::ffff:0.0.0.0]:6680
INFO 2023-05-11 02:00:20,191 [726:MainThread] mopidy_mpd.actor MPD server running at [::ffff:0.0.0.0]:6600
INFO 2023-05-11 02:00:20,247 [726:IrisFrontend-13] mopidy_iris.core Starting Iris 3.66.1
INFO 2023-05-11 02:00:20,276 [726:MainThread] mopidy.commands Starting GLib mainloop
I think the iris issues are unrelated:
Frontend (HttpFrontend) initialization error: HTTP server startup failed: [Errno 98] Address already in use
Either the port is in use, or the os thought it was when it was asked (port release isn't atomic). In any case we're not using port 6680.
The browse issue sounds like a bug. I'll try to reproduce.
Thanks for testing!
Hi,
When Mopidy-Tidal starts up, it shows the IP address and network port on a small st7789 screen with mopidy-pidi. before it starts, the screen is blank while waiting for the link.tidal.com/xxxx screen. Is it possible to show the output of "journalctl -u mopidy | tail -10" to that screen during the login prompt timeframe?