This commit is contained in:
Reid 2024-12-08 18:35:27 -08:00
parent a6dbe2cd0a
commit 3173029f5a
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
10 changed files with 14 additions and 12 deletions

View file

@ -4,6 +4,8 @@ root = true
end_of_line = lf end_of_line = lf
indent_style = space indent_style = space
indent_size = 4 indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[*.nix] [*.nix]
indent_size = 2 indent_size = 2

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
/target /target
/result /result
.env .env

View file

@ -73,4 +73,4 @@ you also have the option to define your mpris bus name, which will instead wait
```sh ```sh
cargo build --release cargo build --release
``` ```

View file

@ -20,7 +20,7 @@
cargo = toolchain; cargo = toolchain;
rustc = toolchain; rustc = toolchain;
}; };
in in
rec { rec {
packages = flake-utils.lib.flattenTree rec { packages = flake-utils.lib.flattenTree rec {
default = lastfmpris; default = lastfmpris;
@ -32,7 +32,7 @@
# very scuffed but endorsed! # very scuffed but endorsed!
#cargoSha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; #cargoSha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
cargoSha256 = "sha256-KOMEvg3iGjmMEFxsrIqD4SaDw63ojiNNNqCfzRlbYLw="; cargoSha256 = "sha256-KOMEvg3iGjmMEFxsrIqD4SaDw63ojiNNNqCfzRlbYLw=";
nativeBuildInputs = with pkgs; [ pkg-config ]; nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ openssl dbus ]; buildInputs = with pkgs; [ openssl dbus ];

View file

@ -43,7 +43,7 @@ pub fn load_config() -> Result<Config> {
.open(&path) .open(&path)
.context("failed to create config file")?; .context("failed to create config file")?;
// write into the config file with the example configuration // write into the config file with the example configuration
// we put inside the base working directory for the project // we put inside the base working directory for the project
file.write_all(include_str!("../config.example.ini").as_bytes()) file.write_all(include_str!("../config.example.ini").as_bytes())
.context("failed to write boilerplate config")?; .context("failed to write boilerplate config")?;
@ -59,4 +59,4 @@ pub fn load_config() -> Result<Config> {
.context("failed to deserialize ini into a readable format")?; .context("failed to deserialize ini into a readable format")?;
Ok(config) Ok(config)
} }

View file

@ -12,4 +12,4 @@ pub fn get_scrobbler(config: &Config) -> Result<Scrobbler> {
info!(" successfully authenticated"); info!(" successfully authenticated");
return Ok(scrobbler); return Ok(scrobbler);
} }

View file

@ -29,4 +29,4 @@ fn main() -> Result<()> {
main_loop::start(&config, scrobbler)?; main_loop::start(&config, scrobbler)?;
Ok(()) Ok(())
} }

View file

@ -81,7 +81,7 @@ pub fn start(config: &Config, scrobbler: Scrobbler) -> Result<()> {
scrobbled_current_song = true scrobbled_current_song = true
} else if length } else if length
.map(|length| current_play_time >= length) .map(|length| current_play_time >= length)
.unwrap_or(false) .unwrap_or(false)
{ {
current_play_time = Duration::from_secs(0); current_play_time = Duration::from_secs(0);
scrobbled_current_song = false; scrobbled_current_song = false;

View file

@ -48,4 +48,4 @@ pub fn wait_for_player(config: &Config) -> Result<Player> {
thread::sleep(INTERVAL); thread::sleep(INTERVAL);
} }
} }

View file

@ -74,4 +74,4 @@ impl Track {
album, album,
} }
} }
} }