Refactor: extract Spotify Worker to separate file
This commit is contained in:
@@ -8,8 +8,8 @@ use crate::library::Library;
|
||||
use crate::playlist::Playlist;
|
||||
use crate::queue::Queue;
|
||||
use crate::show::Show;
|
||||
use crate::spotify::{Spotify, URIType};
|
||||
use crate::spotify_url::SpotifyURL;
|
||||
use crate::spotify::{Spotify, UriType};
|
||||
use crate::spotify_url::SpotifyUrl;
|
||||
use crate::track::Track;
|
||||
use crate::traits::{ListItem, ViewExt};
|
||||
use crate::ui::listview::ListView;
|
||||
@@ -381,9 +381,9 @@ impl SearchResultsView {
|
||||
self.spotify.refresh_token();
|
||||
|
||||
// is the query a Spotify URI?
|
||||
if let Some(uritype) = URIType::from_uri(&query) {
|
||||
if let Some(uritype) = UriType::from_uri(&query) {
|
||||
match uritype {
|
||||
URIType::Track => {
|
||||
UriType::Track => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_track),
|
||||
&self.results_tracks,
|
||||
@@ -392,7 +392,7 @@ impl SearchResultsView {
|
||||
);
|
||||
self.tabs.move_focus_to(0);
|
||||
}
|
||||
URIType::Album => {
|
||||
UriType::Album => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_album),
|
||||
&self.results_albums,
|
||||
@@ -401,7 +401,7 @@ impl SearchResultsView {
|
||||
);
|
||||
self.tabs.move_focus_to(1);
|
||||
}
|
||||
URIType::Artist => {
|
||||
UriType::Artist => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_artist),
|
||||
&self.results_artists,
|
||||
@@ -410,7 +410,7 @@ impl SearchResultsView {
|
||||
);
|
||||
self.tabs.move_focus_to(2);
|
||||
}
|
||||
URIType::Playlist => {
|
||||
UriType::Playlist => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_playlist),
|
||||
&self.results_playlists,
|
||||
@@ -419,7 +419,7 @@ impl SearchResultsView {
|
||||
);
|
||||
self.tabs.move_focus_to(3);
|
||||
}
|
||||
URIType::Show => {
|
||||
UriType::Show => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_show),
|
||||
&self.results_shows,
|
||||
@@ -428,7 +428,7 @@ impl SearchResultsView {
|
||||
);
|
||||
self.tabs.move_focus_to(4);
|
||||
}
|
||||
URIType::Episode => {
|
||||
UriType::Episode => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_episode),
|
||||
&self.results_episodes,
|
||||
@@ -440,9 +440,9 @@ impl SearchResultsView {
|
||||
}
|
||||
// Is the query a spotify URL?
|
||||
// https://open.spotify.com/track/4uLU6hMCjMI75M1A2tKUQC
|
||||
} else if let Some(url) = SpotifyURL::from_url(&query) {
|
||||
} else if let Some(url) = SpotifyUrl::from_url(&query) {
|
||||
match url.uri_type {
|
||||
URIType::Track => {
|
||||
UriType::Track => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_track),
|
||||
&self.results_tracks,
|
||||
@@ -451,7 +451,7 @@ impl SearchResultsView {
|
||||
);
|
||||
self.tabs.move_focus_to(0);
|
||||
}
|
||||
URIType::Album => {
|
||||
UriType::Album => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_album),
|
||||
&self.results_albums,
|
||||
@@ -460,7 +460,7 @@ impl SearchResultsView {
|
||||
);
|
||||
self.tabs.move_focus_to(1);
|
||||
}
|
||||
URIType::Artist => {
|
||||
UriType::Artist => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_artist),
|
||||
&self.results_artists,
|
||||
@@ -469,7 +469,7 @@ impl SearchResultsView {
|
||||
);
|
||||
self.tabs.move_focus_to(2);
|
||||
}
|
||||
URIType::Playlist => {
|
||||
UriType::Playlist => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_playlist),
|
||||
&self.results_playlists,
|
||||
@@ -478,7 +478,7 @@ impl SearchResultsView {
|
||||
);
|
||||
self.tabs.move_focus_to(3);
|
||||
}
|
||||
URIType::Show => {
|
||||
UriType::Show => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_show),
|
||||
&self.results_shows,
|
||||
@@ -487,7 +487,7 @@ impl SearchResultsView {
|
||||
);
|
||||
self.tabs.move_focus_to(4);
|
||||
}
|
||||
URIType::Episode => {
|
||||
UriType::Episode => {
|
||||
self.perform_search(
|
||||
Box::new(Self::get_episode),
|
||||
&self.results_episodes,
|
||||
|
||||
Reference in New Issue
Block a user