The episodes to download and the files to delete on a device, by the listener's rules.
Downloading, deleting and choosing when are up to you. The rules are the kinds that podcast apps have, and a rule selects its episodes with the options of criteria/episodes, e.g.:
{:download? true
:episodes {:where {:duration [600 nil] :not {:text #{"rerun"}}}
:limit 3}
:played 86400}
The rules sync in the profile, and a device can have rules of its own. The record of the files on a device, which the plan reads, is kept by start-download, finish-download, remove-file and keep-file, and app.library holds it and saves it.
The episodes to download and the files to delete on a device, by the
listener's rules.
Downloading, deleting and choosing when are up to you. The rules are the
kinds that podcast apps have, and a rule selects its episodes with the
options of criteria/episodes, e.g.:
{:download? true
:episodes {:where {:duration [600 nil] :not {:text #{"rerun"}}}
:limit 3}
:played 86400}
The rules sync in the profile, and a device can have rules of its own.
The record of the files on a device, which the plan reads, is kept by
start-download, finish-download, remove-file and keep-file, and
app.library holds it and saves it.The bytes of one second of an episode whose feed gives neither its length nor its bitrate, for :audio at 128 kbit/s and :video at 1 Mbit/s, unless the :estimate-fn of the options says otherwise.
The bytes of one second of an episode whose feed gives neither its length nor its bitrate, for :audio at 128 kbit/s and :video at 1 Mbit/s, unless the :estimate-fn of the options says otherwise.
The rule of a show until the listener gives another:
The rule of a show until the listener gives another: - :download?, whether the episodes of the show are downloaded - :episodes, the :where, :order, :limit and :scale of criteria/episodes that select them - :played, the seconds that the file of a played episode stays, where 0 deletes it at once and nil keeps it - :inactive, the seconds that a file stays while its episode isn't played, counted from the download or the last reported position - :trim?, whether a file goes when :episodes no longer selects it - :keep, a set of the names in keeps whose files stay
The rules of a listener until the listener gives others:
The rules of a listener until the listener gives others: - :default, the rule of a show without one, with the keys of default-rule - :shows, the rules of the shows by feed guid - :queue, how many episodes at the front of the queue to download, or true for all of them - :filters, the saved filters of the profile whose episodes to download across all shows, as a map from the name of each to the most of its episodes, or nil for as many as its own :limit - :max-episodes and :max-bytes, the most files and bytes on the device - :max-file-bytes, the most bytes of one file, e.g. to keep a video of several gigabytes from a phone - :make-room?, whether the files of played episodes go when a download needs room - :delete-unsubscribed?, whether the files of a show go once the listener unsubscribes from it, but for those that the rules keep and the episodes added on their own
(estimate item {:keys [bitrate] :as enclosure})The bytes that the enclosure of item takes when its feed gives no
length: the duration at the bitrate of the enclosure, or else at
bytes-per-second, and 0 without a duration.
The bytes that the `enclosure` of `item` takes when its feed gives no length: the duration at the bitrate of the enclosure, or else at bytes-per-second, and 0 without a duration.
(fail-download files id {:keys [received] :as details} at)The files of a device with the download of the episode id failed at
at, with the details below. The plan lists it again once the wait
of retry-waits after the failure has passed.
The `files` of a device with the download of the episode `id` failed at `at`, with the `details` below. The plan lists it again once the wait of retry-waits after the failure has passed. - :received, the bytes of the file that are on the device, from which the next download can go on, or 0 for none. Without it, the bytes of the last try stay. - :etag, :last-modified and :date, the headers of the answer that gave the bytes, which tell whether the file is still the same - :error, a diagnostic of why it failed
(file-name {:keys [id type url] :as entry} title)A name for the file of the download entry of a plan, made from the
title of its episode, that every file system takes, e.g.
Episode-274-Vibe-Cloning-3fa2b9c1.mp3.
The name keeps the letters and digits of the title without their accents, and a hyphen for any other run of characters, up to 80 of them. Eight hex digits of the episode's id come next, so that two episodes with one title don't share a name, and then the extension of the media type of the entry, or else of its URL.
A name for the file of the download `entry` of a plan, made from the `title` of its episode, that every file system takes, e.g. Episode-274-Vibe-Cloning-3fa2b9c1.mp3. The name keeps the letters and digits of the title without their accents, and a hyphen for any other run of characters, up to 80 of them. Eight hex digits of the episode's id come next, so that two episodes with one title don't share a name, and then the extension of the media type of the entry, or else of its URL.
(finish-download files id {:keys [path bytes] :as details} at)The files of a device with the download of the episode id finished
at at, with the :path and the :bytes of the file in details. The
path is whatever the platform reads the file by, e.g. a file path or
the key of a cached response.
The `files` of a device with the download of the episode `id` finished at `at`, with the :path and the :bytes of the file in `details`. The path is whatever the platform reads the file by, e.g. a file path or the key of a cached response.
(keep-file files id keep?)The files of a device with the file of the episode id kept whatever
the rules say, or no longer kept when keep? is false.
The `files` of a device with the file of the episode `id` kept whatever the rules say, or no longer kept when `keep?` is false.
What the :keep of a rule can name, whose files stay on the device:
What the :keep of a rule can name, whose files stay on the device: - :starred, an episode with a star - :queued, an episode in the queue - :playlists, an episode in a playlist - :in-progress, an episode that the listener started and didn't end
(local-file files id)The path of the downloaded file of the episode id in the files of a
device, or nil until a download of it has finished.
The path of the downloaded file of the episode `id` in the `files` of a device, or nil until a download of it has finished.
(on-device files)The entries of the files of a device that are on it, by episode id:
the finished files, the downloads that run, and the bytes of those that
broke off.
The entries of the `files` of a device that are on it, by episode id: the finished files, the downloads that run, and the bytes of those that broke off.
(plan profile feeds files at)(plan profile feeds files at opts)The plan at at for a device with files: the episodes of feeds to
download and the files to delete, by the rules in profile and opts.
The feeds are the parsed feeds of the shows, or one feed, and files
are the files on the device by episode id:
{id {:bytes 51093220 :at #inst "2026-09-01"}}
The :at of a file is when it was downloaded. No rule deletes a file with
:keep?, and a file that's gone has :removed?. Keep that entry, since no
episode with an entry is downloaded again, but for one that failed,
which comes again after the :retry-waits of opts, retry-waits by
default. One that broke off comes with the :received bytes and the
:headers that ask for the rest, when they can, as resume-headers says.
The functions start-download, finish-download, fail-download,
remove-file and keep-file keep such a record. The result is:
{:download [{:id id :url "…" :bytes 48211004 :reason :rule …}]
:delete [{:id id :bytes 51093220 :reason :played}]
:waiting [{:id id :url "…" :bytes 912004113 :limit :max-bytes …}]}
The downloads come in this order, with these reasons:
Played or dismissed episodes aren't downloaded, and downloads without room within :max-episodes and :max-bytes wait, as do files above :max-file-bytes. A file is deleted for one of these reasons:
The opts are:
When the rules have a problem, the result describes it under :problems.
The plan at `at` for a device with `files`: the episodes of `feeds` to
download and the files to delete, by the rules in `profile` and `opts`.
The `feeds` are the parsed feeds of the shows, or one feed, and `files`
are the files on the device by episode id:
{id {:bytes 51093220 :at #inst "2026-09-01"}}
The :at of a file is when it was downloaded. No rule deletes a file with
:keep?, and a file that's gone has :removed?. Keep that entry, since no
episode with an entry is downloaded again, but for one that failed,
which comes again after the :retry-waits of `opts`, retry-waits by
default. One that broke off comes with the :received bytes and the
:headers that ask for the rest, when they can, as resume-headers says.
The functions start-download, finish-download, fail-download,
remove-file and keep-file keep such a record. The result is:
{:download [{:id id :url "…" :bytes 48211004 :reason :rule …}]
:delete [{:id id :bytes 51093220 :reason :played}]
:waiting [{:id id :url "…" :bytes 912004113 :limit :max-bytes …}]}
The downloads come in this order, with these reasons:
- :queue, the front of the queue
- :filter, what the saved filters in the rules select, across all
shows
- :rule, what the rules of the shows select, newest first
Played or dismissed episodes aren't downloaded, and downloads without
room within :max-episodes and :max-bytes wait, as do files above
:max-file-bytes. A file is deleted for one of these reasons:
- :unsubscribed, the listener left the show, and the rules have
:delete-unsubscribed?
- :played, the episode was played :played seconds ago
- :inactive, it wasn't played for :inactive seconds
- :trimmed, the rule no longer selects it, and has :trim?
- :room, a download needs the room, and the rules have :make-room?
The `opts` are:
- :rules, instead of the rules in the profile
- :url, the URL of a feed without a podcast:guid, as a string or a
function of the feed
- :enclosure, the options of resolve/enclosure, which selects the file
of an episode among those that resolve/downloadable? takes. Its
:video? is profile/prefers-video? for the show unless they give one.
- :estimate-fn, a function of an item and its enclosure that gives the
bytes of a file whose feed gives no length, estimate by default
- :scale, the scale of the criterion :rating
- :retry-waits, the seconds before a failed download comes again, as
retry-waits has them
When the rules have a problem, the result describes it under
:problems.(problems rules)A description of what in rules this version of podcast-clj doesn't
know, by place, or nil.
A place is a key of the rules, or the feed guid of a show. The rules can come from a device with a later version. For a show whose rule has a problem, a plan does nothing, and for a problem elsewhere, it does nothing at all.
A description of what in `rules` this version of podcast-clj doesn't know, by place, or nil. A place is a key of the rules, or the feed guid of a show. The rules can come from a device with a later version. For a show whose rule has a problem, a plan does nothing, and for a problem elsewhere, it does nothing at all.
(remove-file files id at)The files of a device without the file of the episode id, deleted
at at. Its entry stays with :removed?, so that no plan downloads it
again.
The `files` of a device without the file of the episode `id`, deleted at `at`. Its entry stays with :removed?, so that no plan downloads it again.
(resume-headers {:keys [received etag last-modified date] :as file})The headers of a request for the rest of the partial file, from the
bytes it has to the end, or nil when it can't go on: when it has no
bytes, or no strong validator that tells whether the file is still the
same, as headers/if-range of wary-fetch chooses it, e.g.
{"Range" "bytes=1048576-" "If-Range" "\"5f3a\""}
The headers of a request for the rest of the partial `file`, from the
bytes it has to the end, or nil when it can't go on: when it has no
bytes, or no strong validator that tells whether the file is still the
same, as headers/if-range of wary-fetch chooses it, e.g.
{"Range" "bytes=1048576-" "If-Range" "\"5f3a\""}(resume-result {:keys [received] :as file}
{:keys [status headers] :as response})What the response to a request with the resume-headers of the partial
file means for the bytes of the file that the device has, or nil for
an answer that isn't a success, which leaves them as they are:
The response is a map of :status and :headers, with the names of the headers in lower case, as wary-fetch gives them.
What the `response` to a request with the resume-headers of the partial `file` means for the bytes of the file that the device has, or nil for an answer that isn't a success, which leaves them as they are: - :append, a 206 from the end of the bytes, whose body goes after them - :replace, a 200 with the whole file, which changed or came whole, so the body replaces them - :complete, a 416 that gives the size of the file as that of the bytes, which were whole already - :restart, another 206 or 416, so the bytes go, and the file downloads again from its start The response is a map of :status and :headers, with the names of the headers in lower case, as wary-fetch gives them.
How many seconds the plan waits before it lists a failed download again, by how many times in a row it failed, repeating the last wait: none after the first failure, so that a download that broke off goes on at the next plan, and longer after each one that follows.
How many seconds the plan waits before it lists a failed download again, by how many times in a row it failed, repeating the last wait: none after the first failure, so that a download that broke off goes on at the next plan, and longer after each one that follows.
(rule rules feed-guid)The rule of the show feed-guid in rules: the rule of the show, over
the :default of the rules, over default-rule.
The rule of the show `feed-guid` in `rules`: the rule of the show, over the :default of the rules, over default-rule.
(rules profile)The rules that profile holds, over default-rules: the listener's
preference :downloads, with the setting :downloads of each show as its
rule.
The rules that `profile` holds, over default-rules: the listener's preference :downloads, with the setting :downloads of each show as its rule.
(start-download files {:keys [id received] :as entry} at)The files of a device with the download of entry, one of the
:download of a plan, started at at.
The entry of the file keeps the :url, the :type and the :bytes that the plan expects, and the time as :at. A file that the listener asked to keep stays kept, and the bytes of a download that broke off stay when the plan entry goes on from them, with :received.
The `files` of a device with the download of `entry`, one of the :download of a plan, started at `at`. The entry of the file keeps the :url, the :type and the :bytes that the plan expects, and the time as :at. A file that the listener asked to keep stays kept, and the bytes of a download that broke off stay when the plan entry goes on from them, with :received.
(usage files)How many of the files of a device are on it, and their bytes, by feed
guid, e.g. {feed-guid {:episodes 3 :bytes 151000000}}. A download that
runs counts with the bytes that the plan expects, and one that broke off
with the bytes it received.
How many of the `files` of a device are on it, and their bytes, by feed
guid, e.g. {feed-guid {:episodes 3 :bytes 151000000}}. A download that
runs counts with the bytes that the plan expects, and one that broke off
with the bytes it received.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |