Skip to main content

Crate crispy_xmltv

Crate crispy_xmltv 

Source
Expand description

Streaming XMLTV/EPG parser and writer.

Faithfully translates the @iptv/xmltv TypeScript library into Rust, using quick_xml event-based parsing for efficient handling of 100 MB+ EPG files without buffering the entire DOM.

§Usage

use crispy_xmltv::{parse, write};

let xml = r#"<?xml version="1.0" encoding="UTF-8"?>
<tv>
  <channel id="ch1">
    <display-name>Channel One</display-name>
  </channel>
  <programme start="20250115120000 +0000" stop="20250115130000 +0000" channel="ch1">
    <title>Test Show</title>
  </programme>
</tv>"#;

let doc = parse(xml).unwrap();
assert_eq!(doc.channels.len(), 1);
assert_eq!(doc.programmes.len(), 1);

let output = write(&doc);
assert!(output.contains("<channel id=\"ch1\">"));

Re-exports§

pub use compression::decompress_auto;
pub use episode::EpisodeInfo;
pub use episode::parse_episode_number;
pub use error::XmltvError;
pub use parser::parse;
pub use parser::parse_compressed;
pub use parser::parse_reader;
pub use types::XmltvDocument;
pub use writer::write;

Modules§

compression
Auto-detect and decompress gzip / XZ compressed XMLTV data.
episode
Episode numbering parsers for XMLTV <episode-num> elements.
error
Error types for XMLTV parsing and writing.
parser
Streaming XMLTV parser using quick_xml event-based pull parsing.
timestamp
XMLTV timestamp parsing and formatting.
types
XMLTV document types.
writer
XMLTV writer — serializes XmltvDocument to valid XMLTV XML.