mirror of
https://github.com/TeamPiped/sponsorblock-mirror.git
synced 2025-01-08 02:20:37 +05:30
40 lines
950 B
Rust
40 lines
950 B
Rust
use std::cmp::Ordering;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
|
pub struct Sponsor {
|
|
pub hash: String,
|
|
#[serde(rename = "videoID")]
|
|
pub video_id: String,
|
|
pub segments: Vec<Segment>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
|
pub struct Segment {
|
|
#[serde(rename = "UUID")]
|
|
pub uuid: String,
|
|
#[serde(rename = "actionType")]
|
|
pub action_type: String,
|
|
pub category: String,
|
|
pub description: String,
|
|
pub locked: i32,
|
|
pub segment: Vec<f32>,
|
|
#[serde(rename = "userID")]
|
|
pub user_id: String,
|
|
#[serde(rename = "videoDuration")]
|
|
pub video_duration: f32,
|
|
pub votes: i32,
|
|
}
|
|
|
|
impl PartialEq for Segment {
|
|
fn eq(&self, other: &Self) -> bool {
|
|
self.uuid == other.uuid
|
|
}
|
|
}
|
|
|
|
impl PartialOrd for Segment {
|
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
|
self.segment[0].partial_cmp(&other.segment[0])
|
|
}
|
|
}
|