next_episode

Crates.ionext_episode
lib.rsnext_episode
version0.3.0
sourcesrc
created_at2018-06-16 19:58:40.054732
updated_at2018-06-17 12:41:05.25387
descriptionFind the next possible episode
homepagehttps://github.com/athiwatc/next_episode
repositoryhttps://github.com/athiwatc/next_episode
max_upload_size
id70402
size24,512
Athiwat Chunlakhan (athiwatc)

documentation

README

next_episode

Get the next possible episode

Version 0.2.0:

  • Improve speed of regex function
const EP_LIST: &'static [&'static str] = &[
    "SomeSeries.S01E01.1080p.SomeFormat.mkv",
    "SomeSeries.S01E05.720p.SomeFormat2.mkv",
    "SomeSeries.S01E02.720p.Format3.mkv",
    "Fav.Series.S01E01.720p.Format1.mkv",
    "Fav.Series.S02E02.1080p.Format2.mkv",
    "Fav.Series.S03E02.720p.Format3.mkv",
];

#[test]
fn next_ep() {
    let nxt = possible_next_episode("SomeSeries.S01E01.SomeFormat.mkv", &EP_LIST);
    assert_eq!(nxt, Some("SomeSeries.S01E02.720p.Format3.mkv"));
}

#[test]
fn next_ep_sprase() {
    let nxt = possible_next_episode("SomeSeries.S01E02.720p.Format3.mkv", &EP_LIST);
    assert_eq!(nxt, Some("SomeSeries.S01E05.720p.SomeFormat2.mkv"));
}

#[test]
fn across_season() {
    let nxt = possible_next_episode("Fav.Series.S01E01.720p.Format1.mkv", &EP_LIST);
    assert_eq!(nxt, Some("Fav.Series.S02E02.1080p.Format2.mkv"));
}

#[test]
fn last_ep() {
    let nxt = possible_next_episode("Fav.Series.S03E02.720p.Format3.mkv", &EP_LIST);
    assert_eq!(nxt, None);
}
Commit count: 19

cargo fmt