type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
use super::*;
#[test]
fn video_file_duration() -> Result<()> {
let path = "tests/files/video1.mp4";
let content = VideoMediaSource::new(path)?;
assert!(content.duration() == Some(212));
Ok(())
}
#[test]
fn video_file_title() -> Result<()> {
let path = "tests/files/video1.mp4";
let content = VideoMediaSource::new(path)?;
assert_eq!(content.title_hint(), "video1");
Ok(())
}
#[test]
fn search() -> Result<()> {
let md = MetaData::guess_from_title("the terminator")?;
assert_eq!(md.title, "The Terminator");
assert_eq!(md.id, 218);
Ok(())
}
#[test]
fn fetch_metadata() -> Result<()> {
let md = MetaData::from_id(218)?;
assert_eq!(md.year, 1984);
assert_eq!(md.genre, Some("Action".to_owned()));
assert_eq!(md.rating, Some("R".to_owned()));
Ok(())
}