Skip to content

Commit 418b233

Browse files
committed
fix: migrate to alternative API
1 parent 27b73c3 commit 418b233

File tree

10 files changed

+223
-117
lines changed

10 files changed

+223
-117
lines changed

Cargo.lock

Lines changed: 54 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ repository = "https://github.com/ryanccn/am.git"
1414
[dependencies]
1515
async-trait = "0.1.82"
1616
chrono = "0.4.38"
17-
clap = { version = "4.5.16", features = ["derive"] }
18-
clap_complete = "4.5.24"
17+
clap = { version = "4.5.17", features = ["derive"] }
18+
clap_complete = "4.5.26"
1919
color-eyre = "0.6.3"
2020
crossterm = "0.28.1"
21-
owo-colors = "4.0.0"
21+
owo-colors = "4.1.0"
22+
regex = "1.10.6"
2223
reqwest = { version = "0.12.7", features = ["rustls-tls", "json", "brotli"], default-features = false }
23-
serde = { version = "1.0.209", features = ["derive"] }
24-
serde_json = "1.0.127"
24+
serde = { version = "1.0.210", features = ["derive"] }
25+
serde_json = "1.0.128"
2526
thiserror = "1.0.63"
2627
tokio = { version = "1.40.0", features = ["full"] }
2728
uuid = { version = "1.10.0", features = ["v4"] }

package.nix renamed to default.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010
enableLTO ? true,
1111
enableOptimizeSize ? false,
1212
}:
13+
let
14+
year = builtins.substring 0 4 self.lastModifiedDate;
15+
month = builtins.substring 4 2 self.lastModifiedDate;
16+
day = builtins.substring 6 2 self.lastModifiedDate;
17+
in
1318
rustPlatform.buildRustPackage rec {
1419
pname = passthru.cargoToml.package.name;
15-
inherit (passthru.cargoToml.package) version;
20+
version = passthru.cargoToml.package.version + "-unstable-${year}-${month}-${day}";
1621

1722
strictDeps = true;
1823

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
141141

142142
overlays.default = _: prev: {
143-
am = prev.callPackage ./package.nix { inherit nix-filter self; };
143+
am = prev.callPackage ./default.nix { inherit nix-filter self; };
144144
};
145145

146146
homeManagerModules.default =

src/cmd/discord/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,18 @@ async fn update_presence(
115115
if let Some(metadata) = &metadata {
116116
activity = activity.buttons(vec![
117117
Button::new("Listen on Apple Music", &metadata.share_url)?,
118-
Button::new(
119-
"View on SongLink",
120-
&format!("https://song.link/i/{}", metadata.id),
121-
)?,
118+
Button::new("View on SongLink", &metadata.song_link)?,
122119
])?;
123120
}
124121

125122
client.set_activity(activity).await?;
126123

127124
println!(
128-
"{} {} · {}{}",
125+
"{} {} {} {}",
129126
"Song updated".blue(),
130127
&track.name,
128+
"·".dimmed(),
131129
&track.artist,
132-
match &metadata {
133-
Some(metadata) => format!(" {}", metadata.id.dimmed()),
134-
None => String::new(),
135-
}
136130
);
137131

138132
state.last_position = Some(position);

src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,13 @@ async fn main() -> Result<()> {
132132
println!("{} playing music", "Started".green());
133133
concise_now_playing().await?;
134134
}
135+
135136
Commands::Pause => {
136137
music::tell("pause").await?;
137138
println!("{} playing music", "Stopped".red());
138139
concise_now_playing().await?;
139140
}
141+
140142
Commands::Toggle => {
141143
let player_state = music::tell("player state").await?;
142144

@@ -156,6 +158,7 @@ async fn main() -> Result<()> {
156158
println!("{} to current or previous track", "Back tracked".cyan());
157159
concise_now_playing().await?;
158160
}
161+
159162
Commands::Forward => {
160163
music::tell("fast forward").await?;
161164
println!("{} in current track", "Fast forwarded".cyan());
@@ -167,6 +170,7 @@ async fn main() -> Result<()> {
167170
println!("{} to next track", "Advanced".magenta());
168171
concise_now_playing().await?;
169172
}
173+
170174
Commands::Previous => {
171175
music::tell("previous track").await?;
172176
println!("{} to previous track", "Returned".magenta());

0 commit comments

Comments
 (0)