aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs24
-rw-r--r--pkgs/by-name/mp/mpdpopm/src/clients.rs2
-rw-r--r--pkgs/by-name/mp/mpdpopm/src/filters_ast.rs6
-rw-r--r--pkgs/by-name/mp/mpdpopm/src/playcounts.rs6
-rw-r--r--pkgs/by-name/mp/mpdpopm/src/storage/mod.rs4
5 files changed, 20 insertions, 22 deletions
diff --git a/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs b/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs
index 82272aeb..5d4eeae4 100644
--- a/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs
+++ b/pkgs/by-name/mp/mpdpopm/src/bin/mpdpopm.rs
@@ -31,7 +31,7 @@ use mpdpopm::{
config::{self, Config},
filters::ExpressionParser,
filters_ast::{FilterStickerNames, evaluate},
- storage::{last_played, play_count, rating_count},
+ storage::{last_played, play_count, rating},
};
use anyhow::{Context, Result, anyhow, bail};
@@ -93,7 +93,7 @@ async fn get_ratings(
let mut ratings: Vec<(String, i8)> = Vec::new();
for file in map_tracks(client, tracks).await? {
- let rating = rating_count::get(client, &file).await?;
+ let rating = rating::get(client, &file).await?;
ratings.push((file, rating.unwrap_or_default()));
}
@@ -114,7 +114,7 @@ async fn set_rating(client: &mut Client, rating: i8, arg: Option<String>) -> Res
let is_current = arg.is_none();
let file = provide_file(client, arg).await?;
- rating_count::set(client, &file, rating).await?;
+ rating::set(client, &file, rating).await?;
match is_current {
false => info!("Set the rating for \"{}\" to \"{}\".", file, rating),
@@ -129,9 +129,9 @@ async fn inc_rating(client: &mut Client, arg: Option<String>) -> Result<()> {
let is_current = arg.is_none();
let file = provide_file(client, arg).await?;
- let now = rating_count::get(client, &file).await?;
+ let now = rating::get(client, &file).await?;
- rating_count::set(client, &file, now.unwrap_or_default().saturating_add(1)).await?;
+ rating::set(client, &file, now.unwrap_or_default().saturating_add(1)).await?;
match is_current {
false => info!("Incremented the rating for \"{}\".", file),
@@ -146,9 +146,9 @@ async fn decr_rating(client: &mut Client, arg: Option<String>) -> Result<()> {
let is_current = arg.is_none();
let file = provide_file(client, arg).await?;
- let now = rating_count::get(client, &file).await?;
+ let now = rating::get(client, &file).await?;
- rating_count::set(client, &file, now.unwrap_or_default().saturating_sub(1)).await?;
+ rating::set(client, &file, now.unwrap_or_default().saturating_sub(1)).await?;
match is_current {
false => info!("Decremented the rating for \"{}\".", file),
@@ -323,7 +323,7 @@ enum RatingCommand {
/// on stdout. With multiple arguments, print their ratings on stdout, one
/// per line, prefixed by the track name.
///
- /// Ratings are expressed as an integer between 0 & 255, inclusive, with
+ /// Ratings are expressed as an integer between -128 & 128, exclusive, with
/// the convention that 0 denotes "un-rated".
#[clap(verbatim_doc_comment)]
Get {
@@ -462,16 +462,16 @@ enum SubCommand {
/// This command adds three new terms on which you can filter: rating, playcount & lastplayed. Each is
/// expressed as an unsigned integer, with zero interpreted as "not set". For instance:
///
- /// mppopm searchadd "(rating > 128)"
+ /// mppopm searchadd "(rating > 2)"
///
- /// Will add all songs in the library with a rating sticker > 128 to the play queue.
+ /// Will add all songs in the library with a rating sticker > 2 to the play queue.
///
/// mppopm also introduces OR clauses (MPD only supports AND), so that:
///
- /// mppopm searchadd "((rating > 128) AND (artist =~ \"pogues\"))"
+ /// mppopm searchadd "((rating > 2) AND (artist =~ \"pogues\"))"
///
/// will add all songs whose artist tag matches the regexp "pogues" with a rating greater than
- /// 128.
+ /// 2.
#[clap(verbatim_doc_comment)]
Searchadd {
filter: String,
diff --git a/pkgs/by-name/mp/mpdpopm/src/clients.rs b/pkgs/by-name/mp/mpdpopm/src/clients.rs
index b88e4041..b934714a 100644
--- a/pkgs/by-name/mp/mpdpopm/src/clients.rs
+++ b/pkgs/by-name/mp/mpdpopm/src/clients.rs
@@ -716,9 +716,7 @@ impl Client {
}
#[cfg(test)]
-/// Let's test Client!
mod client_tests {
-
use super::test_mock::Mock;
use super::*;
diff --git a/pkgs/by-name/mp/mpdpopm/src/filters_ast.rs b/pkgs/by-name/mp/mpdpopm/src/filters_ast.rs
index 8b8c2696..9c68d329 100644
--- a/pkgs/by-name/mp/mpdpopm/src/filters_ast.rs
+++ b/pkgs/by-name/mp/mpdpopm/src/filters_ast.rs
@@ -18,7 +18,7 @@
//! This module provides support for our [lalrpop](https://github.com/lalrpop/lalrpop) grammar.
use crate::clients::Client;
-use crate::storage::{last_played, play_count, rating_count, skipped};
+use crate::storage::{last_played, play_count, rating, skip_count};
use anyhow::{Context, Error, Result, anyhow, bail};
use boolinator::Boolinator;
@@ -693,10 +693,10 @@ impl FilterStickerNames<'static> {
impl Default for FilterStickerNames<'static> {
fn default() -> Self {
Self {
- rating: rating_count::STICKER,
+ rating: rating::STICKER,
playcount: play_count::STICKER,
lastplayed: last_played::STICKER,
- skipped: skipped::STICKER,
+ skipped: skip_count::STICKER,
}
}
}
diff --git a/pkgs/by-name/mp/mpdpopm/src/playcounts.rs b/pkgs/by-name/mp/mpdpopm/src/playcounts.rs
index 7d646b4c..417b3e7e 100644
--- a/pkgs/by-name/mp/mpdpopm/src/playcounts.rs
+++ b/pkgs/by-name/mp/mpdpopm/src/playcounts.rs
@@ -26,7 +26,7 @@
//!
use crate::clients::{Client, PlayerStatus};
-use crate::storage::{last_played, play_count, skipped};
+use crate::storage::{last_played, play_count, skip_count};
use anyhow::{Context, Error, Result, anyhow};
use tracing::{debug, info};
@@ -160,8 +160,8 @@ impl PlayState {
anyhow!("Failed to parse path as utf8: `{}`", last.file.display())
})?;
- let skip_count = skipped::get(client, file).await?.unwrap_or_default();
- skipped::set(client, file, skip_count + 1).await?;
+ let skip_count = skip_count::get(client, file).await?.unwrap_or_default();
+ skip_count::set(client, file, skip_count + 1).await?;
}
}
PlayerStatus::Pause(_) | PlayerStatus::Stopped => (),
diff --git a/pkgs/by-name/mp/mpdpopm/src/storage/mod.rs b/pkgs/by-name/mp/mpdpopm/src/storage/mod.rs
index c13475ad..a6f20d5b 100644
--- a/pkgs/by-name/mp/mpdpopm/src/storage/mod.rs
+++ b/pkgs/by-name/mp/mpdpopm/src/storage/mod.rs
@@ -60,7 +60,7 @@ pub mod play_count {
}
}
-pub mod skipped {
+pub mod skip_count {
use anyhow::Context;
use crate::clients::Client;
@@ -117,7 +117,7 @@ pub mod last_played {
}
}
-pub mod rating_count {
+pub mod rating {
use anyhow::Context;
use crate::clients::Client;