Downloading a season takes back what retention removed (#483)
Time For Chaos's Season 1 had all 20 files downloaded and since reaped. Download Season 1 queued nothing and said all of it was on iPX, because Db::undownloaded left out reaped files, as Download latest wants: there they would only come back to be reaped again. A season asked for by name is wanted whole, so its reaped files are queued; a fresh download is new again to the quota and age sweeps, which order by when it was downloaded. A file already downloading is no longer queued a second time, for either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RqkrVAJFkEgz9cXG3jG1Zy
This commit is contained in:
@@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Downloading a season takes back the files of it retention removed, rather than queuing nothing, and no file on its way already is queued twice (#483).
|
||||
- A feed an OPML stops listing leaves All Subscriptions with it, rather than its items staying there with no feed name beside them: the scan no longer reads it again after the list drops it, and its subscriptions go with it, as they do when a feed is removed with `ipx rm`. Any left from before are removed when ipx starts (#478).
|
||||
- Searching All Subscriptions answers in a fraction of a second, not five: a search reads each item's title and text without its markup, indexed on Postgres, and still finds part of a word. It no longer matches words inside the HTML's tags, such as a link's address. Text past the first 4,000 characters of a very long post is not searched (#459, #472).
|
||||
- Artwork that cannot be shown is asked for again a day later rather than every hour: one too large is refused on its stated size before it is read, and a refusal from the publisher or one ipx makes (too large, not an image) is remembered for a day; JPEG XL pictures sent without a type are shown (#448).
|
||||
|
||||
@@ -2673,12 +2673,15 @@ impl Db {
|
||||
/// The next N enclosures with no file, newest entry first -- what "download latest"
|
||||
/// queues up.
|
||||
/// A feed's files not downloaded, newest first, or one season's in its own order (#482): what
|
||||
/// Download latest, or Download this season, queues.
|
||||
/// Download latest, or Download this season, queues. Latest leaves out what retention removed,
|
||||
/// which it would only fetch again; a season asked for by name is wanted whole, and leaving
|
||||
/// those out said all of a season was on iPX when retention had taken every file (#483). One
|
||||
/// on its way already is not asked for twice.
|
||||
pub async fn undownloaded(&self, feed_id: &str, season: Season, limit: i64) -> Result<Vec<i64>> {
|
||||
let mut a = Args::default();
|
||||
let (feed, limit) = (a.p(feed_id), a.p(limit));
|
||||
let (which, order) = match season {
|
||||
Season::Any => (String::new(), order_sql("published", "desc")),
|
||||
Season::Any => ("AND x.state <> 'reaped'".into(), order_sql("published", "desc")),
|
||||
Season::Of(n) => (format!("AND e.season = {}", a.p(n)), order_sql("episode", "asc")),
|
||||
Season::Unnumbered => ("AND e.season IS NULL".into(), order_sql("published", "asc")),
|
||||
};
|
||||
@@ -2686,7 +2689,7 @@ impl Db {
|
||||
&format!(
|
||||
"SELECT x.id FROM enclosures x
|
||||
JOIN entries e ON e.feed_id = x.feed_id AND e.guid = x.guid
|
||||
WHERE x.feed_id = {feed} AND x.path IS NULL AND x.state <> 'reaped' {which}
|
||||
WHERE x.feed_id = {feed} AND x.path IS NULL AND x.state <> 'downloading' {which}
|
||||
ORDER BY {order}
|
||||
LIMIT {limit}"
|
||||
),
|
||||
@@ -4240,6 +4243,18 @@ mod tests {
|
||||
assert_eq!(all.into_iter().map(|r| r.title.unwrap()).collect::<Vec<_>>(), ["S1E1", "S1E2", "S2E1", "Trailer"]);
|
||||
let back = db.season_entries(1, &["f"], Season::Any, Filter::All, None, 0, 50, &down).await.unwrap();
|
||||
assert_eq!(back.last().unwrap().title.as_deref(), Some("Trailer"));
|
||||
|
||||
// A season asked for whole takes back what retention removed; Download latest does not,
|
||||
// and nothing on its way already is asked for twice (#483).
|
||||
db.exec_for_test(
|
||||
"INSERT INTO enclosures (id, feed_id, guid, url, path, state) VALUES
|
||||
(1, 'f', 'a', 'http://x/a.mp3', NULL, 'reaped'), (2, 'f', 'b', 'http://x/b.mp3', NULL, 'downloading'),
|
||||
(3, 'f', 'c', 'http://x/c.mp3', NULL, 'pending');",
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(db.undownloaded("f", Season::Of(1), 300).await.unwrap(), [1]);
|
||||
assert_eq!(db.undownloaded("f", Season::Any, 5).await.unwrap(), [3]);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user