mirror of
https://github.com/OMGeeky/downloader.git
synced 2026-01-21 18:58:34 +01:00
misc & rustfmt
This commit is contained in:
@@ -26,7 +26,8 @@ tracing = { version = "0.1", optional = true }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
tracing = ["dep:tracing",
|
||||
tracing = [
|
||||
"dep:tracing",
|
||||
"google_bigquery_v2/tracing",
|
||||
"google_youtube/tracing",
|
||||
"twitch_data/tracing",
|
||||
|
||||
@@ -15,22 +15,13 @@ pub struct Streamers {
|
||||
pub login: String,
|
||||
#[client]
|
||||
pub client: BigqueryClient,
|
||||
pub display_name: Option::<String>,
|
||||
pub watched: Option::<bool>,
|
||||
pub youtube_user: Option::<String>,
|
||||
pub public_videos_default: Option::<bool>,
|
||||
pub display_name: Option<String>,
|
||||
pub watched: Option<bool>,
|
||||
pub youtube_user: Option<String>,
|
||||
pub public_videos_default: Option<bool>,
|
||||
pub youtube_google_ident: Option<String>,
|
||||
}
|
||||
|
||||
/*impl<'a> Streamers<'a> {
|
||||
pub fn get_watched(&self) -> String {
|
||||
self.login.clone()
|
||||
}
|
||||
|
||||
fn get_pk_value(&self) -> String {
|
||||
self.login.clone()
|
||||
}
|
||||
}*/
|
||||
|
||||
#[derive(BigDataTableDerive, Debug, Default, Clone)]
|
||||
#[db_name("videos")]
|
||||
pub struct Videos {
|
||||
@@ -40,18 +31,18 @@ pub struct Videos {
|
||||
#[client]
|
||||
pub client: BigqueryClient,
|
||||
|
||||
pub title: Option::<String>,
|
||||
pub description: Option::<String>,
|
||||
pub bool_test: Option::<bool>,
|
||||
pub user_login: Option::<String>,
|
||||
pub created_at: Option::<DateTime<Utc>>,
|
||||
pub url: Option::<String>,
|
||||
pub viewable: Option::<String>,
|
||||
pub language: Option::<String>,
|
||||
pub view_count: Option::<i64>,
|
||||
pub video_type: Option::<String>,
|
||||
pub duration: Option::<i64>,
|
||||
pub thumbnail_url: Option::<String>,
|
||||
pub title: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub bool_test: Option<bool>,
|
||||
pub user_login: Option<String>,
|
||||
pub created_at: Option<DateTime<Utc>>,
|
||||
pub url: Option<String>,
|
||||
pub viewable: Option<String>,
|
||||
pub language: Option<String>,
|
||||
pub view_count: Option<i64>,
|
||||
pub video_type: Option<String>,
|
||||
pub duration: Option<i64>,
|
||||
pub thumbnail_url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(BigDataTableDerive, Debug, Default, Clone)]
|
||||
@@ -63,13 +54,13 @@ pub struct VideoMetadata {
|
||||
#[client]
|
||||
pub client: BigqueryClient,
|
||||
|
||||
pub backed_up: Option::<bool>,
|
||||
pub total_clips_amount: Option::<i64>,
|
||||
pub parts_backed_up_id: Option::<i64>,
|
||||
pub parts_size: Option::<i64>,
|
||||
pub error: Option::<String>,
|
||||
pub download_playlist_url: Option::<String>,
|
||||
pub youtube_playlist_url: Option::<String>,
|
||||
pub backed_up: Option<bool>,
|
||||
pub total_clips_amount: Option<i64>,
|
||||
pub parts_backed_up_id: Option<i64>,
|
||||
pub parts_size: Option<i64>,
|
||||
pub error: Option<String>,
|
||||
pub download_playlist_url: Option<String>,
|
||||
pub youtube_playlist_url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
@@ -78,6 +69,7 @@ pub struct VideoData {
|
||||
pub metadata: VideoMetadata,
|
||||
pub streamer: Streamers,
|
||||
}
|
||||
|
||||
impl VideoData {
|
||||
pub fn from_twitch_video(video: &twitch_data::Video, client: BigqueryClient) -> Result<Self> {
|
||||
Ok(Self {
|
||||
|
||||
@@ -135,8 +135,8 @@ pub async fn start_backup() -> Result<()> {
|
||||
.map_err(|e| anyhow!("{}", e))?;
|
||||
|
||||
//sleep for an hour
|
||||
info!("Sleeping for an hour");
|
||||
tokio::time::sleep(std::time::Duration::from_secs(60 * 60)).await;
|
||||
info!("Sleeping for a while");
|
||||
tokio::time::sleep(std::time::Duration::from_secs(3 * 60 * 60)).await;
|
||||
//repeat
|
||||
}
|
||||
}
|
||||
@@ -221,8 +221,7 @@ async fn get_not_downloaded_videos_from_db(
|
||||
amount
|
||||
);
|
||||
let user_login = video.user_login.clone().unwrap().to_lowercase();
|
||||
let streamer =
|
||||
data::Streamers::get_by_pk(client.clone(), &user_login).await;
|
||||
let streamer = data::Streamers::get_by_pk(client.clone(), &user_login).await;
|
||||
if streamer.is_err() {
|
||||
// .expect(format!("Streamer with login not found: {}", user_login).as_str());
|
||||
warn!("Streamer with login not found: {}", user_login);
|
||||
|
||||
Reference in New Issue
Block a user