fix: include music releases in channel feeds
Channel feeds previously queried only the Videos tab, excluding artist release tracks visible in general Search. Flatten Releases albums after uploads while retaining raw-row pagination, deduplication, cancellation, and extractor errors.
This commit is contained in:
+21
-1
@@ -10,6 +10,8 @@ use std::{
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
mod catalog;
|
||||
|
||||
pub const PAGE_SIZE: usize = 60;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
@@ -387,6 +389,7 @@ const MAX_EXTRACTORS: usize = 4;
|
||||
pub struct Job {
|
||||
children: Vec<Extraction>,
|
||||
queued: VecDeque<Command>,
|
||||
feed: Option<catalog::FeedExpansion>,
|
||||
}
|
||||
|
||||
struct Extraction {
|
||||
@@ -486,7 +489,11 @@ impl Job {
|
||||
}
|
||||
|
||||
pub fn feed(channels: &[String], requests: &[FeedRequest], query: &str) -> io::Result<Self> {
|
||||
Self::spawn_all(feed_commands(channels, requests, query)?)
|
||||
let mut job = Self::spawn_all(feed_commands(channels, requests, query)?)?;
|
||||
if query.is_empty() {
|
||||
job.feed = Some(catalog::FeedExpansion::new(channels, requests));
|
||||
}
|
||||
Ok(job)
|
||||
}
|
||||
|
||||
pub fn channel(id: &str) -> io::Result<Self> {
|
||||
@@ -518,6 +525,7 @@ impl Job {
|
||||
Ok(Self {
|
||||
children: vec![Extraction::spawn(command)?],
|
||||
queued: VecDeque::new(),
|
||||
feed: None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -525,6 +533,7 @@ impl Job {
|
||||
let mut job = Self {
|
||||
children: Vec::new(),
|
||||
queued: VecDeque::new(),
|
||||
feed: None,
|
||||
};
|
||||
// Dropping job also cancels started children if any initial spawn fails.
|
||||
for mut command in commands {
|
||||
@@ -538,6 +547,17 @@ impl Job {
|
||||
}
|
||||
|
||||
pub fn poll(&mut self) -> Option<Result<String, String>> {
|
||||
if let Some(mut feed) = self.feed.take() {
|
||||
let result = feed.poll(self);
|
||||
if result.is_none() {
|
||||
self.feed = Some(feed);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
self.poll_extractions()
|
||||
}
|
||||
|
||||
fn poll_extractions(&mut self) -> Option<Result<String, String>> {
|
||||
if self.children.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user