Serve EPUBs instead XTC in daily OPDS
It turns out it is currently impossible for the Xteink X4 to download XTC files from an OPDS server. So I switched the built-in OPDS server in this binary (daily.hallada.net/opds) to serve the EPUB files instead of the XTC files. The X4 is pretty capable of reading the X4 edition of the EPUB that was optimized for it anyways, and I prefer the flexibility of EPUB, so I might end up eventually deleting the XTC conversion. For now, I kept the conversion step (in case I ever want to ever try manually copying them to the device) and I keep a limited number of XTC issues on the server since they are quite big in filesize. The BookOrbit integration is now optional since the built-in OPDS server is able to serve the EPUBs. In my installation, I serve the EPUBs through both. The daily.hallada.net/opds server is just a little quicker to navigate and download the EPUBs on the X4 since the BookOrbit OPDS requires diving into a couple layers of folders before you get to the files.
This commit is contained in:
+19
-1
@@ -411,7 +411,10 @@ pub const WORLD_BRIEFING_SECTION: &str = "World Briefing";
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Which of the two editions is being built (§3.10).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
///
|
||||
/// The declaration order is the listing order: standard first, then X4. The
|
||||
/// OPDS feed sorts on it.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Edition {
|
||||
/// 1200px images, full CSS.
|
||||
@@ -421,6 +424,9 @@ pub enum Edition {
|
||||
}
|
||||
|
||||
impl Edition {
|
||||
/// Every edition, in the order they are listed and built (§3.10).
|
||||
pub const ALL: [Edition; 2] = [Edition::Standard, Edition::X4];
|
||||
|
||||
/// Filename suffix: `""` / `" (X4)"` (§3.11).
|
||||
pub fn file_suffix(self) -> &'static str {
|
||||
match self {
|
||||
@@ -428,6 +434,18 @@ impl Edition {
|
||||
Edition::X4 => " (X4)",
|
||||
}
|
||||
}
|
||||
|
||||
/// Recover the edition from a published filename's stem (§3.11).
|
||||
///
|
||||
/// The OPDS feed is rebuilt by scanning the publish directory, so the
|
||||
/// filename is the only record of which edition a file is.
|
||||
pub fn from_file_stem(stem: &str) -> Edition {
|
||||
if stem.ends_with(Edition::X4.file_suffix()) {
|
||||
Edition::X4
|
||||
} else {
|
||||
Edition::Standard
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Issue-level metadata rendered on the cover, front page and OPF (§3.10).
|
||||
|
||||
Reference in New Issue
Block a user