|
|
@@ -1,3 +1,4 @@ |
|
|
|
use std::path::Path; |
|
|
|
|
|
|
|
/// Identifier for a particular movie or episode. Doesn't handle different |
|
|
|
/// releases of movies or anything like that. |
|
|
@@ -8,14 +9,14 @@ pub enum MediaId { |
|
|
|
name: String, |
|
|
|
|
|
|
|
/// Year released, to disambiguate. |
|
|
|
year: String |
|
|
|
year: String, |
|
|
|
}, |
|
|
|
|
|
|
|
/// Episode of some TV show or anime. |
|
|
|
Episode { |
|
|
|
/// Name of the show. |
|
|
|
name: String, |
|
|
|
|
|
|
|
|
|
|
|
/// Some shows aren't released as seasons, often anime. |
|
|
|
season: Option<u32>, |
|
|
|
|
|
|
@@ -23,8 +24,8 @@ pub enum MediaId { |
|
|
|
episode: u32, |
|
|
|
|
|
|
|
/// What kind of TV is it? |
|
|
|
cat: TvCategory |
|
|
|
} |
|
|
|
cat: TvCategory, |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] |
|
|
@@ -33,7 +34,7 @@ pub enum TvCategory { |
|
|
|
Tv, |
|
|
|
|
|
|
|
/// Anime, which often is categorized seperately. |
|
|
|
Anime |
|
|
|
Anime, |
|
|
|
} |
|
|
|
|
|
|
|
/// Hint to provide to matching engine about content identity. |
|
|
@@ -49,12 +50,12 @@ pub enum IdHint { |
|
|
|
Season(String), |
|
|
|
|
|
|
|
/// Episode number, usually passed *with* a season, like "E11". |
|
|
|
Episode(String) |
|
|
|
Episode(String), |
|
|
|
} |
|
|
|
|
|
|
|
/// Some kind of error that can happen when trying to identify a match. |
|
|
|
#[derive(Debug)] |
|
|
|
enum MatchError { |
|
|
|
pub enum MatchError { |
|
|
|
/// No matches found. |
|
|
|
NoMatches, |
|
|
|
|
|
|
@@ -66,13 +67,12 @@ enum MatchError { |
|
|
|
|
|
|
|
/// File permissions error. |
|
|
|
PermissionsError, |
|
|
|
|
|
|
|
|
|
|
|
/// In case they're using the wrong version of filebot. |
|
|
|
NonlibreError, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// TODO Decide what we want to be able to do with an engine. |
|
|
|
trait MatchinEngine { |
|
|
|
pub trait MatchingEngine { |
|
|
|
fn identify(&self, path: &Path) -> Result<MediaId, MatchError>; |
|
|
|
} |