muse icon indicating copy to clipboard operation
muse copied to clipboard

feat: allow running without spotify

Open sofushn opened this issue 1 year ago • 1 comments

Closes #835

This PR allows muse to run without a Spotify client ID and secret.

The command will responde with 🚫 ope: Spotify is not enabled! if a user tries to query a song with a Spotify URL.

Logic changes

To allow for cases where Spotify isn't available two methods required changes.

addToQueue(): The logic for determining which source to fetch songs from has been moved to the getSongs service class in get-songs.ts. Songs are fetched through a single method named getSongs() which include the old logic from addToQueue(), all other methods in the class has been made private.

getYouTubeAndSpotifySuggestionsFor(): Has been refactored, all Spotify logic has been moved to the end of the method (fetching still happens asynchrony at the beginning).

PR also updates YoutubeAPI.search() method to return an empty array if no match is found for the search query. This allows for better error handling other places in the code.

  • [ ] I updated the changelog

sofushn avatar Sep 07 '24 12:09 sofushn

:package: :robot: A new release has been made for this pull request.

To play around with this PR, pull ghcr.io/museofficial/muse:pr-1092.

Images are available for x86_64 and ARM64.

Latest commit: 88f17c115386b318353874801138fa1136ff2de1

codetheweb avatar Sep 07 '24 12:09 codetheweb

@sofushn Thanks for the PR, it currently lgtm. But to confirm something, this does still display the spotify query in the search function. Even if spotify is disabled?

Xeravax avatar Oct 28 '24 12:10 Xeravax

Thanks for the PR, it currently lgtm. But to confirm something, this does still display the spotify query in the search function. Even if spotify is disabled?

@Codixer It's quite a long time since I wrote this PR, if I remember correctly I just show an error to the user if they try to search with a Spotify URL otherwise the whole Spotify part is ignored.

edit: is this what you are referring to? Have never noticed that it said Spotify there so didn't think to remove it 😅 image

sofushn avatar Oct 28 '24 13:10 sofushn

For reference this is how the query result looks (fixed the Spotify URL prompt) image

sofushn avatar Oct 28 '24 14:10 sofushn

No worries @sofushn, I was just given access to this repo. I am going through everything to check what has been updated. What still needs to be done and so on and so forth.

Xeravax avatar Oct 28 '24 15:10 Xeravax

For reference this is how the query result looks (fixed the Spotify URL prompt) image

Ah thanks, that's what I had to know. Will test this later today.

Xeravax avatar Oct 28 '24 15:10 Xeravax

🚀 Released in Release v2.10.0.

codetheweb avatar Nov 04 '24 14:11 codetheweb