Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
add publish CI
Browse files Browse the repository at this point in the history
  • Loading branch information
liulifox233 committed Dec 7, 2024
1 parent 6d6e856 commit 2eb2b8e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 69 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
91 changes: 30 additions & 61 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
25 changes: 21 additions & 4 deletions src/api/songs.rs
Original file line number Diff line number Diff line change
@@ -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<Meta>,
}

#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
Expand All @@ -32,10 +37,21 @@ pub struct Attributes {
pub album_name: Option<String>,
/// The artist’s name.
pub artist_name: String,
/// The URL of the artist for the content.
pub artist_url: Option<String>,
/// The album artwork.
pub artwork: Artwork,
/// (Classical music only) The name of the artist or composer to attribute the song with.
pub attribution: Option<String>,
/// (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<Vec<String>>,
/// The song’s composer.
pub composer_name: Option<String>,
/// 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<String>,
/// The disc number the song appears on.
pub disc_number: u32,
/// The approximate length of the song in milliseconds.
Expand Down Expand Up @@ -73,7 +89,7 @@ pub struct Attributes {
pub has_time_synced_lyrics: Option<bool>,
pub is_vocal_attenuation_allowed: bool,
pub is_mastered_for_itunes: bool,
pub composer_name: Option<String>,

pub audio_locale: Option<String>,
pub audio_traits: Option<Vec<String>>,
pub extended_asset_urls: Option<ExtendedAssetUrls>,
Expand Down Expand Up @@ -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)"
Expand Down

0 comments on commit 2eb2b8e

Please sign in to comment.