aome510 / spotify-player

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

Add Shuffle & repeat to startup configuration file? #440

Open mrfatboy opened 2 months ago

mrfatboy commented 2 months ago

Is it possible to set Shuffle and Repeat (others?) options in "app.toml" conf file?

I would like to set them both to True on start up without sending cli commands every time the Spotify player app restarts.

mrfatboy commented 2 months ago

A follow up question, currently there is a cli commands for toggling shuffle and repeat.

Can you add discrete On and Off commands? So when I send the on/off command I know exactly what state it is in.

Thanks

mrfatboy commented 2 months ago

After experimenting with the repeat & shuffle commands I have some observations.

After I set Spotify player repeat to "context" it will get reset to off if Spotify player is restarted. However, if a new playlist is started the current repeat value is remembered. It would be good to have default settings in the app.toml file.

With regards to the shuffle command, it never gets remembered. It will always revert back to false on app restart as well as playing a new playlist (different from the repeat command). It would be good to have default settings in the app.toml file.

The current (non elegant) work around is start a playlist and toggle the shuffle. I have built a script that starts the playlist, sleep 5 seconds to give the playlist time to load then toggle the shuffle to True.

I don't know if these are Spotify limitations or Spotify_player bugs.

Please let me know what you think.

aome510 commented 2 months ago

Can you add discrete On and Off commands? So when I send the on/off command I know exactly what state it is in.

Yes, should be easy to add one, but I will not be actively working on this project next few weeks. Open to PRs though.

mrfatboy commented 2 months ago

Great. I look forward to the feature addition.

aome510 commented 2 months ago

It will always revert back to false on app restart as well as playing a new playlist (different from the repeat command)

I know this as well and it's a limitation of the third-party library used for streaming (https://github.com/librespot-org/librespot/issues/19). However, shuffle should be the similar to repeat when playing a new playlist as I've implemented a patch in:

https://github.com/aome510/spotify-player/blob/b3c0592c46f32692a64784e750697ffd55b07533/spotify_player/src/client/mod.rs#L196-L198

Not sure if that's because you control the player using CLI. What's your setup?

mrfatboy commented 2 months ago

I built and run Spotify player on a macmini 2012 Ubuntu 22.04.

I am using your cli commands to control everything.

Is that what you are asking?

aome510 commented 2 months ago

I built and run Spotify player on a macmini 2012 Ubuntu 22.04.

Does it run as UI or daemon?

I am using your cli commands to control everything.

Do you run CLI commands in the same machine as the daemon?

mrfatboy commented 2 months ago

I followed the instructions to make my own binary. The binary is either run directly from terminal (testing) to bring up the gui or I have Spotify player launched at startup.

Since you brought it up I wanted to ask you a related question. If I launch spotify player from terminal it opens the gui in that terminal window. If I launch it from startup I don't get a terminal gui window. Am I doing something incorrectly? I a not running a daemon service.

aome510 commented 2 months ago

If I launch it from startup I don't get a terminal gui window. Am I doing something incorrectly?

Not too familiar with this startup process, maybe you need to initiate the app with a terminal as spotify_player itself cannot spawn a terminal window. For example, IIRC, with kitty terminal, you can do it with

kitty --class floating spotify_player
aome510 commented 2 months ago

Do you run CLI commands in the same machine as the daemon?

If you run the CLI in the same machine with the app/GUI, the shuffle state should be correct upon starting a new playback

mrfatboy commented 2 months ago

Everything is run one the same machine. Anytime I run a cli command to play a playlist the shuffle gets reset to false.