mirror of
https://codeberg.org/YGGverse/ytd.git
synced 2026-04-08 12:55:32 +00:00
implement channel limit option; increase minor version
This commit is contained in:
parent
532f87311b
commit
f52fe3a710
5 changed files with 9 additions and 3 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -2448,7 +2448,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ytd"
|
name = "ytd"
|
||||||
version = "0.2.1"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ytd"
|
name = "ytd"
|
||||||
version = "0.2.1"
|
version = "0.3.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ sleep = 1
|
||||||
is_live = false
|
is_live = false
|
||||||
is_short = false
|
is_short = false
|
||||||
is_upcoming = false
|
is_upcoming = false
|
||||||
|
# limit = 1
|
||||||
|
|
||||||
# Channel item commands to apply (in order)
|
# Channel item commands to apply (in order)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,5 @@ pub struct Channel {
|
||||||
pub is_live: bool,
|
pub is_live: bool,
|
||||||
pub is_short: bool,
|
pub is_short: bool,
|
||||||
pub is_upcoming: bool,
|
pub is_upcoming: bool,
|
||||||
|
pub limit: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,11 @@ async fn main() {
|
||||||
Ok(result) => {
|
Ok(result) => {
|
||||||
let items = result.content.items;
|
let items = result.content.items;
|
||||||
debug!("received {:?} items to handle...", items.len());
|
debug!("received {:?} items to handle...", items.len());
|
||||||
for item in items {
|
for (i, item) in items.into_iter().enumerate() {
|
||||||
|
if channel.limit.is_some_and(|l| i > l) {
|
||||||
|
debug!("items limit for channel `{c}` reached at {i}; break.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
match database.get(&item.id) {
|
match database.get(&item.id) {
|
||||||
Ok(id) => {
|
Ok(id) => {
|
||||||
if id.is_some() {
|
if id.is_some() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue