aome510 / spotify-player

A Spotify player in the terminal with full feature parity
MIT License
3.38k stars 147 forks source link

Allow spotify-player to launch without an internet connection #531

Open DOD-101 opened 1 month ago

DOD-101 commented 1 month ago

Is your feature already implemented in the latest master? No.

Is your feature request related to a problem? Please describe. When you try to launch spotify-player without an internet connection, it won't even show the UI simply printing:

Error: failed to lookup address information: Temporary failure in name resolution
Please check your internet connection.

If spotify-player is already running (at least as a daemon) it will crash when it doesn't have an internet connection anymore.

Describe the solution you'd like Ideally, spotify-player would launch, showing you the UI and then tell you there that it requires an internet connection to play music. This would not only make developing easier, without an internet connection, but would also make it clearer to people that the app works, but requires internet to play music.

The daemon on the other hand would continue running, without playing music, when an internet connection is lost and launch, but not play any music, without an internet connection.

Describe alternatives you've considered The daemon crashing isn't the most important thing, as one could set it up to restart, when connected to the internet again.

Additional context Add any other context or screenshots about the feature request here.

apprehensions commented 1 month ago

This might be a duplicate of https://github.com/aome510/spotify-player/issues/333

DOD-101 commented 1 month ago

Not quite.

This issue isn't asking for the ability to play locally stored music, but just to be able to have the UI / daemon run without an internet connection.

Although playing local music would be more useful if you could do it offline.

aome510 commented 1 month ago

So basically https://github.com/aome510/spotify-player/issues/62. I tried to think about this feature before. It was difficult because you need Spotify API to access most of the data used by the app.

Ideally, the offline mode will only operate on cached/downloaded data.

edit: nvm I misunderstood the thread. The app doesn't crash upon no internet connection. The error you show in the issue is when you launch it. If the app is running and no internet available, it keeps running. Then it will automatically recover upon network re-connection or when you trigger a restart with RestartIntegratedClient command.

DOD-101 commented 1 month ago

The app doesn't crash upon no internet connection

Yes, only the daemon seems to crash.

The error you show in the issue is when you launch it

Yes, and I would like this error to show up in the UI (in the playback section), rather than the app exiting.

Then it will automatically recover upon network re-connection

The client does do this, but not the daemon.


I've updated the wording in the original message to hopefully make this clearer.

Potentially, this could be split into two different Issues:

  1. Client should show the error message on launch in UI, instead of printing it out.
  2. Daemon shouldn't crash when an Internet connection is lost.
apprehensions commented 1 month ago

Why even allow the UI to display such a message when that's all it will do, forever? How it is now is better, because without internet nothing can be done anyway.

DOD-101 commented 1 month ago

Because it would allow people working on the project to compile and run the application without an Internet connection.

Or for example, if you are working on your config, you'd be able to view your changes without an internet connection.

In addition to this, if you want to the ability to play local songs through spotify-player in the future (#333) this would be a very useful first step in supporting that.

apprehensions commented 1 month ago

I agree, but keep in mind compiling the application requires fetching a significant amount of dependencies, if they're not already cached you can't build.