From 2eb2b8ed1fe6d00f77f080d42c0afdbe07f124a8 Mon Sep 17 00:00:00 2001 From: liulifox233 Date: Sat, 7 Dec 2024 17:12:02 +0800 Subject: [PATCH] add publish CI --- .github/workflows/check.yml | 3 ++ Cargo.lock | 91 ++++++++++++------------------------- Cargo.toml | 7 ++- src/api/songs.rs | 25 ++++++++-- 4 files changed, 57 insertions(+), 69 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 7ff49b3..4cd0517 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -24,3 +24,6 @@ jobs: run: cargo check --verbose - name: Run tests run: cargo test --lib --verbose + - uses: katyo/publish-crates@v2 + with: + registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index d52af46..4ab978d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,15 +97,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "bento4-src" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1d8a36a87e77dc45cfe72df3502eef6f69f43b0da18e00c39f6164d2da3b1a" -dependencies = [ - "cc", -] - [[package]] name = "bit-set" version = "0.8.0" @@ -189,8 +180,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ - "jobserver", - "libc", "shlex", ] @@ -931,15 +920,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.72" @@ -1047,15 +1027,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "mp4decrypt" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2362bd781fc61817b4ac41511d4a7e3e13ff2a2ab0803e6aa63a94c3796d15ce" -dependencies = [ - "bento4-src", -] - [[package]] name = "multimap" version = "0.10.0" @@ -1365,9 +1336,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +checksum = "2c0fef6c4230e4ccf618a35c59d7ede15dea37de8427500f50aff708806e42ec" dependencies = [ "bytes", "prost-derive", @@ -1375,11 +1346,10 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c1318b19085f08681016926435853bbf7858f9c082d0999b80550ff5d9abe15" +checksum = "d0f3e5beed80eb580c68e2c600937ac2c4eedabdfd5ef1e5b7ea4f3fba84497b" dependencies = [ - "bytes", "heck", "itertools", "log", @@ -1396,9 +1366,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" dependencies = [ "anyhow", "itertools", @@ -1409,9 +1379,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4759aa0d3a6232fb8dbdb97b61de2c20047c68aca932c7ed76da9d788508d670" +checksum = "cc2f1e56baa61e93533aebc21af4d2134b70f66275e0fcdf3cbe43d77ff7e8fc" dependencies = [ "prost", ] @@ -1492,7 +1462,7 @@ dependencies = [ "serde_path_to_error", "serde_with", "tracing", - "zerocopy 0.8.11", + "zerocopy 0.8.13", ] [[package]] @@ -1516,18 +1486,17 @@ dependencies = [ [[package]] name = "ramdl" -version = "1.0.1" +version = "1.0.2" dependencies = [ "base64", "fancy-regex", "hex", "m3u8-rs", - "mp4decrypt", "pssh-box", "reqwest", "serde", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.4", "tokio", "widevine", ] @@ -2058,11 +2027,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" dependencies = [ - "thiserror-impl 2.0.3", + "thiserror-impl 2.0.4", ] [[package]] @@ -2078,9 +2047,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" dependencies = [ "proc-macro2", "quote", @@ -2089,9 +2058,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -2110,9 +2079,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -2130,9 +2099,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.41.1" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -2427,7 +2396,7 @@ dependencies = [ "rsa", "sha1", "sha2", - "thiserror 2.0.3", + "thiserror 2.0.4", "widevine-proto", ] @@ -2585,9 +2554,9 @@ checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" [[package]] name = "xml-rs" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af310deaae937e48a26602b730250b4949e125f468f11e6990be3e5304ddd96f" +checksum = "ea8b391c9a790b496184c29f7f93b9ed5b16abb306c05415b68bcc16e4d06432" [[package]] name = "yoke" @@ -2625,11 +2594,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cce3b5629d87654b53a49002acc2ce64aa5aa7255f5c718374a37ac7fd98c218" +checksum = "67914ab451f3bfd2e69e5e9d2ef3858484e7074d63f204fd166ec391b54de21d" dependencies = [ - "zerocopy-derive 0.8.11", + "zerocopy-derive 0.8.13", ] [[package]] @@ -2645,9 +2614,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.11" +version = "0.8.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74a82c26c3986af2623ec9eb890ff4aa19c006e30a1133dc9bd1830ec1612e20" +checksum = "7988d73a4303ca289df03316bc490e934accf371af6bc745393cf3c2c5c4f25d" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 89a4368..bd8a7b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ramdl" -version = "1.0.1" +version = "1.0.2" edition = "2021" license = "GPL-3.0-or-later" description = "A Rust library for downloading Apple Music songs/music videos/posts" @@ -14,9 +14,8 @@ m3u8-rs = "6.0.0" reqwest = { version = "0.12.9", features = ["json"] } serde = { version = "1.0.215", features = ["serde_derive"] } serde_json = "1.0.132" -thiserror = "2.0.3" -tokio = { version = "1.41.1", features = ["full"] } +thiserror = "2.0.4" +tokio = { version = "1.42.0", features = ["full"] } pssh-box = "0.1.10" -mp4decrypt = "0.4.2" widevine = "0.1.0" hex = "0.4.3" diff --git a/src/api/songs.rs b/src/api/songs.rs index 9b1f380..ea16cc2 100644 --- a/src/api/songs.rs +++ b/src/api/songs.rs @@ -1,14 +1,19 @@ #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Song { + /// The identifier for the song. pub id: String, + /// This value is always songs. #[serde(rename = "type")] pub type_: String, + /// The relative location for the song resource. pub href: String, + /// The attributes for the song. pub attributes: Attributes, - /// The relationships for a song resource. + /// The relationships for the song. pub relationships: Relationships, - pub meta: Meta, + /// Information about the request or response. + pub meta: Option, } #[derive(serde::Serialize, serde::Deserialize, Debug, Clone)] @@ -32,10 +37,21 @@ pub struct Attributes { pub album_name: Option, /// The artist’s name. pub artist_name: String, + /// The URL of the artist for the content. + pub artist_url: Option, /// The album artwork. pub artwork: Artwork, + /// (Classical music only) The name of the artist or composer to attribute the song with. + pub attribution: Option, + /// (Extended) Indicates the specific audio variant for a song. + /// Possible Values: dolby-atmos, dolby-audio, hi-res-lossless, lossless, lossy-stereo + /// ## Important + /// Use badges to indicate the audio variant in Apple Music. For more information, see Dolby Asset Center (DAC) for identifying tracks with the Dolby Atmos logo and Apple Lossless glyphs for identifying tracks with the specific Apple Lossless glyph. + pub audio_variants: Option>, + /// The song’s composer. + pub composer_name: Option, /// The Recording Industry Association of America (RIAA) rating of the content. The possible values for this rating are clean and explicit. No value means no rating. - pub content_rating: String, + pub content_rating: Option, /// The disc number the song appears on. pub disc_number: u32, /// The approximate length of the song in milliseconds. @@ -73,7 +89,7 @@ pub struct Attributes { pub has_time_synced_lyrics: Option, pub is_vocal_attenuation_allowed: bool, pub is_mastered_for_itunes: bool, - pub composer_name: Option, + pub audio_locale: Option, pub audio_traits: Option>, pub extended_asset_urls: Option, @@ -165,6 +181,7 @@ mod tests { .await .unwrap(); let song = apple_music.get_songs("1214782673").await.unwrap(); + println!("{:?}", song); assert_eq!( song.attributes.name, "サイレンは彼方より (feat. Hatsune Miku)"