Skip to content

Commit

Permalink
feat: cache ncm search result
Browse files Browse the repository at this point in the history
  • Loading branch information
Discreater committed Dec 5, 2023
1 parent 6c35ea3 commit 10803c4
Show file tree
Hide file tree
Showing 30 changed files with 1,055 additions and 675 deletions.
5 changes: 4 additions & 1 deletion protos/musync.proto
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ message Track {
message NeteaseSource {
// id of the track in netease
string id = 1;
// popularity of the track
optional float pop = 2;
}

// LocalSource
Expand Down Expand Up @@ -315,9 +317,10 @@ message SearchAllRequest {
}

message SearchAllResponse {
reserved 2;
repeated Track db_tracks = 1;
// netease music search result
string ncm_res = 2;
repeated Track ncm_tracks = 3;
}

message RebuildIndexRequest {}
Expand Down
2 changes: 2 additions & 0 deletions src-tauri/Cargo.lock

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

2 changes: 2 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ futures = "0.3.28"
futures-channel = "0.3.25"
futures-util = "0.3.25"
dotenvy = "0.15.7"
# ncmapi = { path="../../ncmapi-rs" }
ncmapi = { git="https://github.com/Discreater/ncmapi-rs" }

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
7 changes: 5 additions & 2 deletions src-tauri/abi/src/pb/musync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ pub struct NeteaseSource {
/// id of the track in netease
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
/// popularity of the track
#[prost(float, optional, tag = "2")]
pub pop: ::core::option::Option<f32>,
}
/// LocalSource
#[derive(serde::Serialize, serde::Deserialize)]
Expand Down Expand Up @@ -526,8 +529,8 @@ pub struct SearchAllResponse {
#[prost(message, repeated, tag = "1")]
pub db_tracks: ::prost::alloc::vec::Vec<Track>,
/// netease music search result
#[prost(string, tag = "2")]
pub ncm_res: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub ncm_tracks: ::prost::alloc::vec::Vec<Track>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/dbm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ chrono = { workspace = true }
tonic = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tokio-stream = { workspace = true }
async-stream = { version = "0.3" }
utils = { path = "../utils" }
debounced = { git = "https://github.com/Discreater/debounced" }
futures-channel = { workspace = true, features = ["sink"] }
futures-util = { workspace = true, features = ["sink"] }

ncmapi = { workspace = true }

[dev-dependencies]
tracing-subscriber = { workspace = true }
4 changes: 4 additions & 0 deletions src-tauri/dbm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
pub mod error;
mod manager;
mod playlist;
mod track;
mod player;
mod user;

pub use error::MusyncError;
use sea_orm::DatabaseConnection;
Expand Down
Loading

0 comments on commit 10803c4

Please sign in to comment.