mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-05-11 10:00:18 +08:00
31 lines
1.1 KiB
Rust
31 lines
1.1 KiB
Rust
use serde_json::json;
|
|
|
|
use crate::config::CONFIG;
|
|
|
|
pub fn video_format_args(video_model: &bili_sync_entity::video::Model) -> serde_json::Value {
|
|
json!({
|
|
"bvid": &video_model.bvid,
|
|
"title": &video_model.name,
|
|
"upper_name": &video_model.upper_name,
|
|
"upper_mid": &video_model.upper_id,
|
|
"pubtime": &video_model.pubtime.and_utc().format(&CONFIG.time_format).to_string(),
|
|
"fav_time": &video_model.favtime.and_utc().format(&CONFIG.time_format).to_string(),
|
|
})
|
|
}
|
|
|
|
pub fn page_format_args(
|
|
video_model: &bili_sync_entity::video::Model,
|
|
page_model: &bili_sync_entity::page::Model,
|
|
) -> serde_json::Value {
|
|
json!({
|
|
"bvid": &video_model.bvid,
|
|
"title": &video_model.name,
|
|
"upper_name": &video_model.upper_name,
|
|
"upper_mid": &video_model.upper_id,
|
|
"ptitle": &page_model.name,
|
|
"pid": page_model.pid,
|
|
"pubtime": video_model.pubtime.and_utc().format(&CONFIG.time_format).to_string(),
|
|
"fav_time": video_model.favtime.and_utc().format(&CONFIG.time_format).to_string(),
|
|
})
|
|
}
|