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:
@@ -1,12 +1,12 @@
|
||||
[package]
|
||||
name = "twba-twitch-fetcher"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
twba-twitch-data = { version = "0.3", git = "https://github.com/OMGeeky/twitch_data.git" }
|
||||
twba-twitch-data = { version = "0.4", git = "https://github.com/OMGeeky/twitch_data.git" }
|
||||
twba-common = { version = "0.2", git = "https://github.com/OMGeeky/twba.common.git" }
|
||||
|
||||
tracing = "0.1"
|
||||
|
||||
@@ -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