[PR #623] [MERGED] Support searching by Spotify share URLs and URIs analogously to the desktop client #936

Closed
opened 2026-02-28 14:53:53 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Rigellute/spotify-tui/pull/623
Author: @Utagai
Created: 10/16/2020
Status: Merged
Merged: 10/22/2020
Merged by: @Rigellute

Base: masterHead: open-by-uri-or-url


📝 Commits (10+)

  • 1f79f45 Generalize input processing to both URLs and URIs
  • 9ab6b47 Add the boilerplate code for supporting tracks, playlists and podcasts
  • e4fad09 Introduce a spotify_resource_id() closure to reduce some duplication
  • 63468a2 Support searching playlists by URL/Spotify-URI
  • 7bec3ca Support searching shows by URL/Spotify-URI
  • 629ec19 Support searching individual tracks by URL/Spotify-URI
  • 4747a9c Add initial parsing tests and required refactors
  • 89ac773 Add full suite of happy path test cases
  • dac45bf Verify that we fail to match on invalid strings
  • 5688f2b Remove debug prints

📊 Changes

2 files changed (+212 additions, -31 deletions)

View changed files

📝 src/handlers/input.rs (+174 -28)
📝 src/network.rs (+38 -3)

📄 Description

This closes #41.

To be more precise, this actually adds significantly more functionality than what is requested in #41. In particular, this PR adds support for opening:

  • Tracks (will open its containing album and move the selection to the searched track)
  • Albums
  • Artists
  • Playlists
  • Shows/Podcasts

Via either their Spotify share URL, e.g.:

https://open.spotify.com/album/6QdCohkHKNTVoaSx1ZzitH?si=vJQhe4H5RwiGcDf4xr9DuQ

Or their Spotify URI:

spotify:album:6QdCohkHKNTVoaSx1ZzitH

On the official desktop client, searching with either of these leads you to the Metallica album, Metallica.

If the given input string fails to match either URI format, it will default to the original raw phrase search.

Here are some representative screenshots:
image
Press enter...
image
Note The highlighting/focusing of the track is automatically done.

There were some decisions I made in this PR that may be worth discussing. For those, I've let a comment.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Rigellute/spotify-tui/pull/623 **Author:** [@Utagai](https://github.com/Utagai) **Created:** 10/16/2020 **Status:** ✅ Merged **Merged:** 10/22/2020 **Merged by:** [@Rigellute](https://github.com/Rigellute) **Base:** `master` ← **Head:** `open-by-uri-or-url` --- ### 📝 Commits (10+) - [`1f79f45`](https://github.com/Rigellute/spotify-tui/commit/1f79f45a671f60c81e632937a397d32da86f60e1) Generalize input processing to both URLs and URIs - [`9ab6b47`](https://github.com/Rigellute/spotify-tui/commit/9ab6b47e3705960e2adf79cd24faade23b724c3c) Add the boilerplate code for supporting tracks, playlists and podcasts - [`e4fad09`](https://github.com/Rigellute/spotify-tui/commit/e4fad09ab28b048b4023f75ab06b178fe1365e32) Introduce a spotify_resource_id() closure to reduce some duplication - [`63468a2`](https://github.com/Rigellute/spotify-tui/commit/63468a271c381d8cb67acdfbc31cd0644776e48f) Support searching playlists by URL/Spotify-URI - [`7bec3ca`](https://github.com/Rigellute/spotify-tui/commit/7bec3ca1c0129116452deebf30f68554edc220d8) Support searching shows by URL/Spotify-URI - [`629ec19`](https://github.com/Rigellute/spotify-tui/commit/629ec19a3fce27fa7ac6f746e5814aadb57262ed) Support searching individual tracks by URL/Spotify-URI - [`4747a9c`](https://github.com/Rigellute/spotify-tui/commit/4747a9cb24ce616587fb497eaa4f3d54f72d9602) Add initial parsing tests and required refactors - [`89ac773`](https://github.com/Rigellute/spotify-tui/commit/89ac7731174ab9ba609d339f8d9cbd1bebd66a8e) Add full suite of happy path test cases - [`dac45bf`](https://github.com/Rigellute/spotify-tui/commit/dac45bf1134347985c1572063f43538a8863ff06) Verify that we fail to match on invalid strings - [`5688f2b`](https://github.com/Rigellute/spotify-tui/commit/5688f2b71262a4eb9699ff022e146d83118f78bd) Remove debug prints ### 📊 Changes **2 files changed** (+212 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `src/handlers/input.rs` (+174 -28) 📝 `src/network.rs` (+38 -3) </details> ### 📄 Description This closes #41. To be more precise, this actually adds significantly more functionality than what is requested in #41. In particular, this PR adds support for opening: - Tracks (will open its containing album and move the selection to the searched track) - Albums - Artists - Playlists - Shows/Podcasts Via either their Spotify share URL, e.g.: ``` https://open.spotify.com/album/6QdCohkHKNTVoaSx1ZzitH?si=vJQhe4H5RwiGcDf4xr9DuQ ``` Or their Spotify URI: ``` spotify:album:6QdCohkHKNTVoaSx1ZzitH ``` On the official desktop client, searching with either of these leads you to the Metallica album, [Metallica](https://open.spotify.com/album/6QdCohkHKNTVoaSx1ZzitH). If the given input string fails to match either URI format, it will default to the original raw phrase search. Here are some representative screenshots: ![image](https://user-images.githubusercontent.com/10730394/96223947-c3201680-0f5c-11eb-83c1-9828ab287cc9.png) Press enter... ![image](https://user-images.githubusercontent.com/10730394/96223979-cca97e80-0f5c-11eb-9f61-8aec05580218.png) **Note** The highlighting/focusing of the track is automatically done. There were some decisions I made in this PR that may be worth discussing. For those, I've let a comment. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:53:53 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-tui#936
No description provided.