mirror of
https://github.com/OMGeeky/twba.twitch_fetcher.git
synced 2026-02-23 15:49:57 +01:00
Add check if user is live (prevents partial downloads)
This commit is contained in:
@@ -34,6 +34,10 @@ impl<'a> FetcherClient<'a> {
|
||||
.await?;
|
||||
info!("Fetching videos for {} users", users.len());
|
||||
for user in users {
|
||||
if self.twitch_client.is_live(&user.twitch_name).await.map_err(FetcherError::CheckLiveError)? {
|
||||
info!("User: {} is live, skipping fetching videos", user.twitch_name);
|
||||
continue;
|
||||
}
|
||||
match self.fetch_videos_for_user(&user).await {
|
||||
Ok(_) => {
|
||||
info!("Fetched videos for user: {}", user.twitch_name);
|
||||
|
||||
@@ -14,4 +14,6 @@ pub enum FetcherError {
|
||||
CreateClientError(#[source] Box<dyn StdError>),
|
||||
#[error("Could not get videos: {0:?}")]
|
||||
GetVideosError(#[source] Box<dyn StdError>),
|
||||
#[error("Could not get videos: {0:?}")]
|
||||
CheckLiveError(#[source] Box<dyn StdError>),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user