Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature suggestions/requests #103

Closed
apprehensions opened this issue Jan 9, 2023 · 9 comments · Fixed by #244
Closed

feature suggestions/requests #103

apprehensions opened this issue Jan 9, 2023 · 9 comments · Fixed by #244
Labels
enhancement New feature or request

Comments

@apprehensions
Copy link
Contributor

apprehensions commented Jan 9, 2023

1. download the current playing song's album cover into a file or into a cache for another script to use; my usecase for this is to display the album cover with an image viewer, as i missed this feature from playing music with mpv.
2. display the album cover as braille; my usecase for this is with st boxdraw, as it can render braille characters as block. (might be replaced by sixel) viuer backend request, not spotify-player

  1. support querying of status, like in spotify-tui, with the ability for custom format:
λ spt playback
🔀 ▶ Warakumbla - Hypothermia
  1. support running a command on new song or supply current playing song, data, albumcover file, volume on music event to an external command via configuration, or a really over-engineered fifo.
@apprehensions
Copy link
Contributor Author

apprehensions commented Jan 9, 2023

@apprehensions

This comment was marked as outdated.

@apprehensions
Copy link
Contributor Author

support running a command on new song or supply current playing song, data, albumcover file, volume on music event to an external command via configuration, or a really over-engineered fifo.

a workaround to this would be to wait for a new file in the album cover cache directory i guess?

aome510 added a commit that referenced this issue Apr 26, 2023
Resolves #111.
Partially #103.

## Changes
Added CLI commands and subcommands:
- `get`: 
```
Get spotify data

Usage: spotify_player get <COMMAND>

Commands:
  key      Get data by key
  context  Get context data
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help
``` 
- `get key`:
```
Get data by key

Usage: spotify_player get key <key>

Arguments:
  <key>  [possible values: playback, devices, user-playlists, user-liked-tracks, user-saved-albums, user-followed-artists, user-top-tracks, queue]

Options:
  -h, --help  Print help
```
- `get context`
```
Get context data

Usage: spotify_player get context <context_type> <context_id>

Arguments:
  <context_type>  [possible values: playlist, album, artist]
  <context_id>

Options:
  -h, --help  Print help
```
- `playback`
```
Interact with the playback

Usage: spotify_player playback <COMMAND>

Commands:
  play      Start a playback
  resume    Resume the playback
  pause     Pause the playback
  next      Next track
  previous  Previous track
  shuffle   Toggle the shuffle mode
  repeat    Cycle the repeat mode
  volume    Set playback's volume percentage
  seek      Seek the playback by an offset
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help
```
aome510 added a commit that referenced this issue Sep 4, 2023
Resolves #190. 
Resolves #103.

Added `player_event_hook_command` as a config option. Each time the application receives a player event, `player_event_hook_command ` is executed with the event JSON string as the standard input.
@apprehensions
Copy link
Contributor Author

I found a workaround to the slow cli commands, which is to use the new hooks feature to output the tracks name to a file in ~/.cache, and have a seperate program read it.

I'm still unsure why spotify-player uses a network socket; it should be using a FIFO as its much faster than performing a network request.

@aome510
Copy link
Owner

aome510 commented Sep 7, 2023

I'm still unsure why spotify-player uses a network socket; it should be using a FIFO as its much faster than performing a network request.

Not sure how FIFO can be implemented as a way for CLI to communicate with another running client. Do you mind to elaborate?

@aome510
Copy link
Owner

aome510 commented Sep 7, 2023

socket should be really fast. The slowness you see should mostly come from network request to get Spotify data.

@apprehensions
Copy link
Contributor Author

apprehensions commented Sep 7, 2023

Not sure how FIFO can be implemented as a way for CLI to communicate with another running client. Do you mind to elaborate?

You could make a FIFO at /tmp, have a program write a command to it (such as 'get playback'), and that program will read from the FIFO after writing, in which case spotify_player will get that command, and write to the FIFO, which the program will retrieve.

image

The slowness you see should mostly come from network request to get Spotify data.

Wait what? Why is this done? Shouldn't spotify_player store the current playing song? Why is this required for retrieving data that is already available?

@aome510
Copy link
Owner

aome510 commented Sep 7, 2023

Wait what? Why is this done? Shouldn't spotify_player store the current playing song? Why is this required for retrieving data that is already available?

Yes, playback, specifically, can be parsed from the application's state so don't really need to make an API call. Getting playback through an API call was implemented for the first iteration because it's simpler and similar to the way the client handles other get commands. Please create an issue with description + observed runtime for get playback so that people can track it if you want get playback to be faster.

You could make a FIFO at /tmp, have a program write a command to it (such as 'get playback'), and that program will read from the FIFO after writing, in which case spotify_player will get that command, and write to the FIFO, which the program will retrieve.

If client and server both write to the same file, how does one differentiate between the other? Do you mean client and server have different FIFO file, server writes to /tmp/command, and client writes to /tmp/command_result?

@apprehensions
Copy link
Contributor Author

Forget the FIFO, i'd rather have the 'retrieve data remotely' problem gone, making a new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants