Skip to content

Commit

Permalink
Change current_title for title
Browse files Browse the repository at this point in the history
  • Loading branch information
jecaro committed Sep 23, 2024
1 parent 3f91a00 commit b020f7c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/lms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ impl LmsClient {
}

// Same remark as [`get_artist`]
pub async fn get_current_title(&self, name: String) -> Result<Option<String>> {
pub async fn get_title(&self, name: String) -> Result<Option<String>> {
self.handle_error(
(|| async {
let (request, field) = LmsRequest::current_title(name);
let (request, field) = LmsRequest::title(name);
let lms_response = self.post(&request).await?;
as_string_or_not_there(lms_response, &field)
})()
.await,
anyhow!("Error get_current_title"),
anyhow!("Error get_title"),
)
.await
}
Expand Down
4 changes: 2 additions & 2 deletions src/lms/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ impl LmsRequest {
Self::new(name).question("artist".to_string())
}

pub fn current_title(name: String) -> (Self, String) {
Self::new(name).question("current_title".to_string())
pub fn title(name: String) -> (Self, String) {
Self::new(name).question("title".to_string())
}

pub fn album(name: String) -> (Self, String) {
Expand Down
6 changes: 3 additions & 3 deletions src/mpris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ impl MprisPlayer {
.get_album(self.player_name.clone())
.await
.map_err(to_fdo_error)?;
let current_title = self
let title = self
.client
.get_current_title(self.player_name.clone())
.get_title(self.player_name.clone())
.await
.map_err(to_fdo_error)?;
let index = self
Expand All @@ -224,7 +224,7 @@ impl MprisPlayer {
album.map(|album| {
hm.insert("xesam:album".to_string(), album.into());
});
current_title.map(|title| {
title.map(|title| {
hm.insert("xesam:title".to_string(), title.into());
});
Ok(hm)
Expand Down

0 comments on commit b020f7c

Please sign in to comment.