Skip to content

Commit

Permalink
Merge branch 'maintenance' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Diegovsky authored Jul 24, 2024
2 parents 657ba5d + f71cdf3 commit 37b9f88
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 69 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ bbb651
Julius Rüberg
janbrummer
Alisson Lauffer
Riley Smith
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spot"
version = "0.4.0"
version = "0.4.1"
edition = "2018"
license = "MIT"

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Join the discussion on [Matrix](https://matrix.to/#/#spot-devel:matrix.org).

<a href='https://flathub.org/apps/details/dev.alextren.Spot'><img width='130' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-en.png'/></a>

[![Packaging status](https://repology.org/badge/vertical-allrepos/spot-client.svg)](https://repology.org/project/spot-client/versions)

## Usage notes

### Credentials
Expand Down
1 change: 1 addition & 0 deletions TRANSLATORS
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ Seioo Inoue
Dmitry
Julius Rüberg
Francesco Babetto
Walther Smith
123 changes: 69 additions & 54 deletions data/dev.alextren.Spot.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<id>dev.alextren.Spot</id>
<url type="homepage">/~https://github.com/xou816/spot</url>
<name>Spot</name>
<developer_name>Alexandre Trendel</developer_name>
<summary>Listen to music on Spotify</summary>
<launchable type="desktop-id">dev.alextren.Spot.desktop</launchable>
<metadata_license>CC0-1.0</metadata_license>
Expand All @@ -16,16 +17,11 @@
<control>pointing</control>
<control>touch</control>
</recommends>
<!-- see https://puri.sm/posts/specify-form-factors-in-your-librem-5-apps/ -->
<custom>
<value key="Purism::form_factor">workstation</value>
<value key="Purism::form_factor">mobile</value>
</custom>
<description>
<p>
Listen to music on Spotify.
<b>Requires a premium account.</b>
</p>
<p>Requires a premium account.</p>
<p>Current features:</p>
<ul>
<li>playback control (play/pause, prev/next, seeking)</li>
Expand All @@ -40,7 +36,7 @@
</ul>
</description>
<screenshots>
<screenshot>
<screenshot type="default">
<image>https://raw.githubusercontent.com/xou816/spot/master/data/appstream/1.png</image>
</screenshot>
<screenshot>
Expand All @@ -50,53 +46,73 @@
<image>https://raw.githubusercontent.com/xou816/spot/master/data/appstream/3.png</image>
</screenshot>
</screenshots>
<release version="0.4.0" date="2023-02-24">
<description>
<p>
It's been a while, hasn't it? I'm back, but please allow everyone some time to work through the issues and pull requests :)
</p>
<ul>
<li>added an option for gapless playback (thanks @supremesnickers!)</li>
<li>fixed theme management (thanks @ctsk!)</li>
<li>fixed the behaviour of the "previous" button for consistency with other media players (thanks @SomewhereOutInSpace!)</li>
<li>the user will now be prompted to unlock the keyring if needed (thanks @rainDiX!)</li>
<li>added playlist creation and edition</li>
<li>more bug fixes</li>
</ul>
<p>
Thanks to all the contributors who are somehow still around :) If you feel like you've been unjustly forgotten from the AUTHORS or TRANSLATORS file, feel free to open a PR.
</p>
</description>
</release>
<release version="0.3.3" date="2022-03-29">
<description>
<p>
What's new:
</p>
<ul>
<li>login dialog now uses a password entry (thanks @Toorero!)</li>
<li>fix a startup crash with some locales</li>
</ul>
</description>
</release>
<release version="0.3.2" date="2022-03-27">
<description>
<p>
New features:
</p>
<ul>
<li>save tracks to library</li>
<li>basic Spotify URI handling (thanks @bbb651!)</li>
<li>settings dialog (thanks @sei0o!)</li>
<li>brand new icon (thanks @bertob!)</li>
<li>bug fixes</li>
</ul>
<p>
Thank you to everyone involved in this release!
</p>
</description>
</release>
<releases>
<release version="0.4.1" date="2024-02-01">
<description>
<p>
Hello, everyone! I'm releasing this tiny version of Spot with just some minor features and fixes.
</p>
<p>
This release includes a major fix for Spotify's API.
</p>
<ul>
<li>Port UI to Blueprint (made by @alissonlauffer)</li>
<li>Provide Application Name to PulseAudio (made by @XGZepto)</li>
<li>GStreamer backend (made by @xou816)</li>
<li>Add link to matrix rooms. (made by @knokelmaat)</li>
<li>Fix login screen according to #625 (made by @hegdenischay)</li>
<li>Use libadwaita::AboutWindow instead of gtk::AboutDialog (made by @hegdenischay)</li>
<li>Add play button to album and playlist view (made by @Zaedus)</li>
<li>Update subproject blueprint-compiler to v0.8.1 (made by @nmschulte)</li>
</ul>
</description>
</release>
<release version="0.4.0" date="2023-02-24">
<description>
<p>
It's been a while, hasn't it? I'm back, but please allow everyone some time to work through the issues and pull requests :)
</p>
<ul>
<li>added an option for gapless playback (thanks @supremesnickers!)</li>
<li>fixed theme management (thanks @ctsk!)</li>
<li>fixed the behaviour of the "previous" button for consistency with other media players (thanks @SomewhereOutInSpace!)</li>
<li>the user will now be prompted to unlock the keyring if needed (thanks @rainDiX!)</li>
<li>added playlist creation and edition</li>
<li>more bug fixes</li>
</ul>
<p>
Thanks to all the contributors who are somehow still around :) If you feel like you've been unjustly forgotten from the AUTHORS or TRANSLATORS file, feel free to open a PR.
</p>
</description>
</release>
<release version="0.3.3" date="2022-03-29">
<description>
<p>
What's new:
</p>
<ul>
<li>login dialog now uses a password entry (thanks @Toorero!)</li>
<li>fix a startup crash with some locales</li>
</ul>
</description>
</release>
<release version="0.3.2" date="2022-03-27">
<description>
<p>
New features:
</p>
<ul>
<li>save tracks to library</li>
<li>basic Spotify URI handling (thanks @bbb651!)</li>
<li>settings dialog (thanks @sei0o!)</li>
<li>brand new icon (thanks @bertob!)</li>
<li>bug fixes</li>
</ul>
<p>
Thank you to everyone involved in this release!
</p>
</description>
</release>
<release version="0.3.1" date="2022-01-23">
<description>
<p>Bugfix release:</p>
Expand Down Expand Up @@ -186,7 +202,6 @@
<li>MPRIS: the desktop entry for Spot is now properly referenced (thanks nicolasfella!)</li>
<li>quality: various clippy fixes (thanks nn1ks!)</li>
<li>new translations: Turkish, Indonesian and Brazilian Portuguese (thanks YusufOzmen01, cho2 and lucraraujo, as well as ondras12345 for the reviews!)</li>
<li></li>
</ul>
</description>
</release>
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project(
'spot',
version: '0.4.0',
version: '0.4.1',
meson_version: '>= 0.59.0',
default_options: ['warning_level=2', 'buildtype=release'],
)
Expand Down
9 changes: 5 additions & 4 deletions src/api/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ impl SpotifyClient {

pub(crate) fn get_playlist(&self, id: &str) -> SpotifyRequest<'_, (), Playlist> {
let query = make_query_params()
.append_pair(
"fields",
"id,name,images,owner,tracks(total,items(is_local,track(name,id,uri,duration_ms,artists(name,id),album(name,id,images,artists))))",
)
.append_pair("market", "from_token")
// why still grab the tracks field?
// the model still expects the appearance of a tracks field
.append_pair("fields", "id,name,images,owner,tracks(total)")
.finish();
self.request()
.method(Method::GET)
Expand All @@ -404,6 +404,7 @@ impl SpotifyClient {
limit: usize,
) -> SpotifyRequest<'_, (), Page<PlaylistTrack>> {
let query = make_query_params()
.append_pair("market", "from_token")
.append_pair("offset", &offset.to_string()[..])
.append_pair("limit", &limit.to_string()[..])
.finish();
Expand Down
1 change: 1 addition & 0 deletions src/app/components/album/album.blp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ template $AlbumWidget : Adw.Bin {
Button cover_btn {
hexpand: false;
halign: center;
valign: start;

Box {
halign: center;
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/library/library.blp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ template $LibraryWidget : Box {
ScrolledWindow scrolled_window {
hexpand: true;
vexpand: true;
vscrollbar-policy: always;
vscrollbar-policy: automatic;
min-content-width: 250;
Overlay overlay {
FlowBox flowbox {
Expand Down
21 changes: 18 additions & 3 deletions src/app/components/playlist_details/playlist_details_model.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use gettextrs::gettext;
use gio::prelude::*;
use gio::SimpleActionGroup;
use std::cell::Ref;
Expand Down Expand Up @@ -62,6 +63,17 @@ impl PlaylistDetailsModel {
self.dispatcher
.dispatch(AppAction::PlaybackAction(PlaybackAction::ToggleShuffle));
}
// The playlist has no songs and the user has still decided to click the play button,
// lets just do an early return and show an error...
if playlist.songs.songs.is_empty() {
error!("Unable to start playback because songs is empty");
self.dispatcher
.dispatch(AppAction::ShowNotification(gettext(
"An error occured. Check logs for details!",
)));
return;
}

let id_of_first_song = playlist.songs.songs[0].id.as_str();
self.play_song_at(0, id_of_first_song);
return;
Expand All @@ -82,10 +94,13 @@ impl PlaylistDetailsModel {
self.dispatcher
.call_spotify_and_dispatch(move || async move {
let playlist = api.get_playlist(&id).await;
let playlist_tracks = api.get_playlist_tracks(&id, 0, 100).await?;
match playlist {
Ok(playlist) => {
Ok(BrowserAction::SetPlaylistDetails(Box::new(playlist)).into())
}
Ok(playlist) => Ok(BrowserAction::SetPlaylistDetails(
Box::new(playlist),
Box::new(playlist_tracks),
)
.into()),
Err(SpotifyApiError::BadStatus(400, _))
| Err(SpotifyApiError::BadStatus(404, _)) => {
Ok(BrowserAction::NavigationPop.into())
Expand Down
2 changes: 1 addition & 1 deletion src/app/state/browser_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub enum BrowserAction {
RemoveTracksFromPlaylist(String, Vec<String>),
SetAlbumDetails(Box<AlbumFullDescription>),
AppendAlbumTracks(String, Box<SongBatch>),
SetPlaylistDetails(Box<PlaylistDescription>),
SetPlaylistDetails(Box<PlaylistDescription>, Box<SongBatch>),
UpdatePlaylistName(PlaylistSummary),
AppendPlaylistTracks(String, Box<SongBatch>),
Search(String),
Expand Down
6 changes: 3 additions & 3 deletions src/app/state/screen_states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ impl UpdatableState for PlaylistDetailsState {

fn update_with(&mut self, action: Cow<Self::Action>) -> Vec<Self::Event> {
match action.as_ref() {
BrowserAction::SetPlaylistDetails(playlist) if playlist.id == self.id => {
let PlaylistDescription { id, songs, .. } = *playlist.clone();
self.songs.add(songs).commit();
BrowserAction::SetPlaylistDetails(playlist, song_batch) if playlist.id == self.id => {
let PlaylistDescription { id, .. } = *playlist.clone();
self.songs.add(*song_batch.clone()).commit();
self.playlist = Some(*playlist.clone());
vec![BrowserEvent::PlaylistDetailsLoaded(id)]
}
Expand Down
2 changes: 1 addition & 1 deletion src/player/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ async fn player_setup_delegate(
delegate.notify_playback_state(position_ms);
}
PlayerEvent::TimeToPreloadNextTrack { .. } => {
debug!("Requestiong next track to be preloaded...");
debug!("Requesting next track to be preloaded...");
delegate.preload_next_track();
}
_ => {}
Expand Down

0 comments on commit 37b9f88

Please sign in to comment.