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:
2026-11-19 10:45:59 -05:00
parent 55382478af
commit 8386aa609b
3 changed files with 20 additions and 3 deletions

View File

@@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### 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). - 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). - 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). - 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).

View File

@@ -2673,12 +2673,15 @@ impl Db {
/// The next N enclosures with no file, newest entry first -- what "download latest" /// The next N enclosures with no file, newest entry first -- what "download latest"
/// queues up. /// queues up.
/// A feed's files not downloaded, newest first, or one season's in its own order (#482): what /// 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>> { pub async fn undownloaded(&self, feed_id: &str, season: Season, limit: i64) -> Result<Vec<i64>> {
let mut a = Args::default(); let mut a = Args::default();
let (feed, limit) = (a.p(feed_id), a.p(limit)); let (feed, limit) = (a.p(feed_id), a.p(limit));
let (which, order) = match season { 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::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")), Season::Unnumbered => ("AND e.season IS NULL".into(), order_sql("published", "asc")),
}; };
@@ -2686,7 +2689,7 @@ impl Db {
&format!( &format!(
"SELECT x.id FROM enclosures x "SELECT x.id FROM enclosures x
JOIN entries e ON e.feed_id = x.feed_id AND e.guid = x.guid 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} ORDER BY {order}
LIMIT {limit}" LIMIT {limit}"
), ),
@@ -4240,6 +4243,18 @@ mod tests {
assert_eq!(all.into_iter().map(|r| r.title.unwrap()).collect::<Vec<_>>(), ["S1E1", "S1E2", "S2E1", "Trailer"]); 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(); 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")); 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] #[tokio::test]

View File

@@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Downloading a season whose files retention removed downloads them again, rather than saying all of it is on iPX already (#483).
- On a phone, a pinned item's pin in the reader's floating actions is on its accent disc again, rather than nearly invisible on a light theme (#480). - On a phone, a pinned item's pin in the reader's floating actions is on its accent disc again, rather than nearly invisible on a light theme (#480).
- Swiping between items on a phone no longer flashes: the pictures of the items either side are loaded ahead, so the preview under your finger shows its picture with its text, and the swipe ends only once the new item's pictures are ready (#471). - Swiping between items on a phone no longer flashes: the pictures of the items either side are loaded ahead, so the preview under your finger shows its picture with its text, and the swipe ends only once the new item's pictures are ready (#471).
- Deleting a downloaded file, marking everything read, deleting a signal and the other actions that ask first now ask in the page's own dialog, so they go ahead in the iOS app, which answered the browser's question Cancel without showing it (#462). - Deleting a downloaded file, marking everything read, deleting a signal and the other actions that ask first now ask in the page's own dialog, so they go ahead in the iOS app, which answered the browser's question Cancel without showing it (#462).